663f0e9ed3ce8782e996e6a2f540d8e28d7c02b2
[openwrt/staging/chunkeey.git] / package / network / services / dnsmasq / patches / 200-let-makefile-be-aware-of-config-changes.patch
1 Index: dnsmasq-2.72/Makefile
2 ===================================================================
3 --- dnsmasq-2.72.orig/Makefile 2014-12-30 19:46:10.484921940 +0800
4 +++ dnsmasq-2.72/Makefile 2014-12-30 19:56:39.712926794 +0800
5 @@ -74,6 +74,10 @@
6 hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
7 dns-protocol.h radv-protocol.h ip6addr.h
8
9 +COPT_CONF = $(top)/.copt_$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/config.h | \
10 + ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ')
11 +COPT_CONF_WILD = $(top)/.copt_*
12 +
13 all : $(BUILDDIR)
14 @cd $(BUILDDIR) && $(MAKE) \
15 top="$(top)" \
16 @@ -83,7 +87,7 @@
17
18 mostly_clean :
19 rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot
20 - rm -f $(BUILDDIR)/.configured $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
21 + rm -f $(BUILDDIR)/$(COPT_CONF_WILD) $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
22
23 clean : mostly_clean
24 rm -f $(BUILDDIR)/dnsmasq_baseline
25 @@ -139,7 +143,7 @@
26
27 # rules below are targets in recusive makes with cwd=$(BUILDDIR)
28
29 -.configured: $(hdrs)
30 +$(COPT_CONF): $(hdrs)
31 @rm -f *.o
32 @touch $@
33
34 @@ -149,7 +153,7 @@
35 .c.o:
36 $(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $<
37
38 -dnsmasq : .configured $(hdrs) $(objs)
39 +dnsmasq : $(COPT_CONF) $(hdrs) $(objs)
40 $(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS)
41
42 dnsmasq.pot : $(objs:.o=.c) $(hdrs)