summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2015-01-03 16:36:14 +0000
committerSimon Kelley <simon@thekelleys.org.uk>2015-01-03 16:36:14 +0000
commit81c538efcebfce2ce4a1d3a420b6c885b8f08df9 (patch)
tree1627cf75b5123bea8f6d61dcea93e2a33de6beaf
parentd310ab7ecbffce79d3d90debba621e0222f9bced (diff)
downloaddnsmasq-81c538efcebfce2ce4a1d3a420b6c885b8f08df9.tar.gz
Implement makefile dependencies on COPTS variable.
-rw-r--r--.gitignore2
-rw-r--r--Makefile10
2 files changed, 7 insertions, 5 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..5675f60 100644
--- a/Makefile
+++ b/Makefile
@@ -64,6 +64,8 @@ nettle_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG
gmp_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC NO_GMP --copy -lgmp`
sunos_libs = `if uname | grep SunOS >/dev/null 2>&1; then echo -lsocket -lnsl -lposix4; fi`
version = -DVERSION='\"`$(top)/bld/get-version $(top)`\"'
+copts_conf = .copts_$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | \
+ ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ')
objs = cache.o rfc1035.o util.o option.o forward.o network.o \
dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \
@@ -83,7 +85,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_* $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
clean : mostly_clean
rm -f $(BUILDDIR)/dnsmasq_baseline
@@ -139,8 +141,8 @@ bloatcheck : $(BUILDDIR)/dnsmasq_baseline mostly_clean all
# rules below are targets in recusive makes with cwd=$(BUILDDIR)
-.configured: $(hdrs)
- @rm -f *.o
+$(copts_conf): $(hdrs)
+ @rm -f *.o .copts_*
@touch $@
$(objs:.o=.c) $(hdrs):
@@ -149,7 +151,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)