diff Makefile.in @ 1546:bb8eaa26bc93 fuzz

merge from main
author Matt Johnston <matt@ucc.asn.au>
date Mon, 26 Feb 2018 22:44:48 +0800
parents 5916af64acd4 198e2ee0f4b1
children 61a793b6e471
line wrap: on
line diff
--- a/Makefile.in	Wed Feb 21 21:59:52 2018 +0800
+++ b/Makefile.in	Mon Feb 26 22:44:48 2018 +0800
@@ -20,12 +20,13 @@
 ifeq (@BUNDLED_LIBTOM@, 1)
 LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM) 
 CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
-LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM) 
+LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
 endif
 
+OPTION_HEADERS = default_options_guard.h sysoptions.h
 ifneq ($(wildcard localoptions.h),)
 CFLAGS+=-DLOCALOPTIONS_H_EXISTS
-LOCALOPTIONS_H=localoptions.h
+OPTION_HEADERS += localoptions.h
 endif
 
 COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
@@ -103,7 +104,6 @@
 	CFLAGS+= -DDROPBEAR_CLIENT
 endif
 
-
 # these are exported so that libtomcrypt's makefile will use them
 export CC
 export CFLAGS
@@ -126,9 +126,16 @@
 
 all: $(TARGETS)
 
-# a bit lazy, but safer
-HEADERS=$(wildcard $(srcdir)/*.h *.h)
-*.o: $(HEADERS)
+# for simplicity assume all source depends on all headers
+HEADERS=$(wildcard $(srcdir)/*.h *.h) $(OPTION_HEADERS)
+%.o : %.c $(HEADERS)
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+default_options_guard.h: default_options.h
+	@echo Creating $@
+	@printf "/*\n > > > Do not edit this file (default_options_guard.h) < < <\nGenerated from "$^"\nLocal customisation goes in localoptions.h\n*/\n\n" > [email protected]
+	@$(srcdir)/ifndef_wrapper.sh < $^ >> [email protected]
+	@mv [email protected] $@
 
 strip: $(TARGETS)
 	$(STRIP) $(addsuffix $(EXEEXT), $(TARGETS))
@@ -202,10 +209,10 @@
 	-rm -f $*$(EXEEXT)
 	-ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
 
-$(STATIC_LTC): 
+$(STATIC_LTC): $(OPTION_HEADERS)
 	$(MAKE) -C libtomcrypt
 
-$(STATIC_LTM):
+$(STATIC_LTM): $(OPTION_HEADERS)
 	$(MAKE) -C libtommath
 
 .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
@@ -229,18 +236,11 @@
 distclean: clean tidy
 	-rm -f config.h
 	-rm -f Makefile
+	-rm -f default_options_guard.h
 
 tidy:
 	-rm -f *~ *.gcov */*~
 
-# default_options.h is stored in version control, could not find a workaround
-# for parallel "make -j" and dependency rules.
-default_options.h: default_options.h.in 
-	@echo Creating $@
-	@echo "/*\n > > > Do not edit this file (default_options.h) < < <\nGenerated from "$^"\nLocal customisation goes in localoptions.h\n*/\n\n" > [email protected]
-	@$(srcdir)/ifndef_wrapper.sh < $^ >> [email protected]
-	@mv [email protected] $@
-
 ## Fuzzing targets
 
 # list of fuzz targets