automatic rebuilds for makefile changes
# Copyright 2013-2015. The Regents of the University of California.
-# Copyright 2015-2018. Martin Uecker <martin.uecker@med.uni-goettingen.de>
+# Copyright 2015-2019. Martin Uecker <martin.uecker@med.uni-goettingen.de>
# All rights reserved. Use of this source code is governed by
# a BSD-style license which can be found in the LICENSE file.
@@ -9,6 +9,9 @@ MAKESTAGE ?= 1
# silent make
#MAKEFLAGS += --silent
+# auto clean on makefile updates
+AUTOCLEAN?=1
+
# clear out all implicit rules and variables
MAKEFLAGS += -R
@@ -192,7 +195,8 @@ MODULES_wavelet = -llinops -lwavelet
MODULES_wshfl = -llinops -lwavelet -liter -llowrank
-MAKEFILES = $(root)/Makefiles/Makefile.*
+MAKEFILES = $(wildcard $(root)/Makefiles/Makefile.*)
+ALLMAKEFILES = $(root)/Makefile $(wildcard $(root)/Makefile.* $(root)/*.mk $(root)/rules/*.mk $(root)/Makefiles/Makefile.*)
-include Makefile.$(NNAME)
-include Makefile.local
@@ -510,21 +514,39 @@ $(UTARGETS): % : utests/utest.c utests/%.o $$(MODULES_%) $(MODULES)
clean:
rm -f `find $(srcdir) -name "*.o"`
- rm -f utests/*.o
+ rm -f $(root)/utests/*.o
rm -f $(patsubst %, %, $(UTARGETS))
- rm -f $(root)/lib/.*.lock
+ rm -f $(libdir)/.*.lock
allclean: clean
rm -f $(libdir)/*.a $(ALLDEPS)
rm -f $(patsubst %, %, $(TARGETS))
rm -f $(srcdir)/misc/version.inc
rm -rf $(root)/tests/tmp/*/
- rm -rf doc/dx
- rm -f doc/commands.txt
+ rm -rf $(root)/doc/dx
+ rm -f $(root)/doc/commands.txt
+ touch isclean
distclean: allclean
+
+-include isclean
+
+
+isclean: $(ALLMAKEFILES)
+ifeq ($(AUTOCLEAN),1)
+ @echo "CONFIGURATION MODIFIED. RUNNING FULL REBUILD."
+ touch isclean
+ make allclean || rm isclean
+else
+ifneq ($(MAKECMDGOALS),allclean)
+ @echo "CONFIGURATION MODIFIED."
+endif
+endif
+
+
+
# automatic tests
# system tests
