[Dnsmasq-discuss] [PATCH] Let the Makefile be aware of changes in COPTS varaible.
Yousong Zhou
yszhou4tech at gmail.com
Wed Dec 31 10:23:11 GMT 2014
Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
.gitignore | 2 +-
Makefile | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
index fcdbcbd..23f1148 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,7 @@ src/*.mo
src/dnsmasq.pot
src/dnsmasq
src/dnsmasq_baseline
-src/.configured
+src/.copts_*
contrib/wrt/dhcp_lease_time
contrib/wrt/dhcp_release
debian/base/
diff --git a/Makefile b/Makefile
index c340f1c..c00eee6 100644
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,10 @@ objs = cache.o rfc1035.o util.o option.o forward.o network.o \
hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
dns-protocol.h radv-protocol.h ip6addr.h
+COPTS_CONF = .copts_$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/config.h | \
+ ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ')
+COPTS_CONF_WILD = .copts_*
+
all : $(BUILDDIR)
@cd $(BUILDDIR) && $(MAKE) \
top="$(top)" \
@@ -83,7 +87,7 @@ all : $(BUILDDIR)
mostly_clean :
rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot
- rm -f $(BUILDDIR)/.configured $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
+ rm -f $(BUILDDIR)/$(COPTS_CONF_WILD) $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
clean : mostly_clean
rm -f $(BUILDDIR)/dnsmasq_baseline
@@ -139,7 +143,7 @@ bloatcheck : $(BUILDDIR)/dnsmasq_baseline mostly_clean all
# rules below are targets in recusive makes with cwd=$(BUILDDIR)
-.configured: $(hdrs)
+$(COPTS_CONF): $(hdrs)
@rm -f *.o
@touch $@
@@ -149,7 +153,7 @@ $(objs:.o=.c) $(hdrs):
.c.o:
$(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $<
-dnsmasq : .configured $(hdrs) $(objs)
+dnsmasq : $(COPTS_CONF) $(hdrs) $(objs)
$(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS)
dnsmasq.pot : $(objs:.o=.c) $(hdrs)
--
1.7.10.4
More information about the Dnsmasq-discuss
mailing list