From e87a264cf282d74702daf6e9ef4c06fafe98fa7e Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Thu, 5 Jun 2014 11:37:49 +0200 Subject: [PATCH] build system: only try building command line scripts if ./configure ran --- Makefile | 65 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index f31d6f769..23543cb39 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,67 @@ .PHONY: all makefiles clean cleanall doxy -all: checkmakefiles run debug memcheck +# if out/config.py exists, we can also create command line scripts for running simulations +ADDL_TARGETS = +ifeq ($(wildcard out/config.py),) +else + ADDL_TARGETS += run debug memcheck +endif + +# default target +all: src/Makefile $(ADDL_TARGETS) @cd src && $(MAKE) +# command line scripts +run debug memcheck: % : src/scripts/%.in.py out/config.py + @echo "Creating script \"./$@\"" + @head -n1 "$<" > "$@" + @cat out/config.py >> "$@" + @tail -n+2 "$<" >> "$@" + @chmod a+x "$@" + +# legacy makefiles: + @echo + @echo '=====================================================================' + @echo 'Warning: make makefiles has been deprecated in favor of ./configure' + @echo '=====================================================================' + @echo ./configure + @echo + @echo '=====================================================================' + @echo 'Warning: make makefiles has been deprecated in favor of ./configure' + @echo '=====================================================================' + @echo -clean: checkmakefiles +clean: src/Makefile cd src && $(MAKE) clean rm -f run debug memcheck -cleanall: checkmakefiles +cleanall: src/Makefile cd src && $(MAKE) MODE=release clean cd src && $(MAKE) MODE=debug clean rm -f src/Makefile rm -f run debug memcheck -checkmakefiles: - @if [ ! -f src/Makefile ]; then \ - echo; \ - echo '====================================================================='; \ - echo 'src/Makefile does not exist. Please use "./configure" to generate it!'; \ - echo '====================================================================='; \ - echo; \ - exit 1; \ - fi +src/Makefile: + @echo + @echo '=====================================================================' + @echo '$@ does not exist.' + @echo 'Please run "./configure" or use the OMNeT++ IDE to generate it.' + @echo '=====================================================================' + @echo + @exit 1 -run debug memcheck: % : src/scripts/%.in.py out/config.py - @echo "Creating script \"./$@\"" - @head -n1 "$<" > "$@" - @cat out/config.py >> "$@" - @tail -n+2 "$<" >> "$@" - @chmod a+x "$@" +out/config.py: + @echo + @echo '=====================================================================' + @echo '$@ does not exist.' + @echo 'Please run "./configure" to generate it.' + @echo '=====================================================================' + @echo + @exit 1 +# autogenerated documentation doxy: doxygen doxy.cfg