]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Implement makefile dependencies on COPTS variable.
authorYousong Zhou <yszhou4tech@gmail.com>
Sat, 3 Jan 2015 16:36:14 +0000 (16:36 +0000)
committerSimon Kelley <simon@thekelleys.org.uk>
Sat, 3 Jan 2015 16:36:14 +0000 (16:36 +0000)
.gitignore
Makefile

index fcdbcbd135ae9c30b9348ee3d78482319d16b07e..23f11488ab4cb9132ca1d6ed046bdcd6f077be4c 100644 (file)
@@ -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/
index c340f1c7b59aa43a5cbc4097829c0d410c4fb3a2..5675f60c2036a8005a5da4cabf571fd4317598ac 100644 (file)
--- 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)