1 # 2 # Read COPYING for licensing details. 3 # 4 # Ngie Cooper, June 2010 5 # 6 7 # Makefiles that are considered critical to execution; if they don't exist 8 # all of the Makefiles will be rebuilt by default. 9 CRITICAL_MAKEFILE= conformance/interfaces/timer_settime/Makefile 10 11 # The default logfile for the tests. 12 LOGFILE?= logfile 13 # Subdirectories to traverse down. 14 SUBDIRS= conformance functional stress 15 16 MAKE_ENV= LOGFILE=`if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 17 18 BUILD_MAKE_ENV= "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" 19 BUILD_MAKE_ENV+= "LDLIBS=$(LDLIBS)" $(MAKE_ENV) 20 21 TEST_MAKE_ENV= $(MAKE_ENV) 22 23 BUILD_MAKE= env $(BUILD_MAKE_ENV) $(MAKE) 24 25 TEST_MAKE= env $(TEST_MAKE_ENV) $(MAKE) -k 26 27 top_srcdir?= . 28 29 prefix?= `$(top_srcdir)/scripts/print_prefix.sh` 30 31 datadir?= $(prefix)/share 32 33 exec_prefix?= $(prefix) 34 35 all: conformance-all functional-all stress-all tools-all 36 37 ifeq ($(shell uname -s), Linux) 38 include Makefile.linux 39 endif 40 41 clean: $(CRITICAL_MAKEFILE) 42 @rm -f $(LOGFILE)* 43 @for dir in $(SUBDIRS) tools; do \ 44 $(MAKE) -C $$dir clean >/dev/null; \ 45 done 46 47 distclean: distclean-makefiles 48 49 # Clean out all of the generated Makefiles. 50 distclean-makefiles: 51 @for dir in $(SUBDIRS); do \ 52 $(MAKE) -C $$dir $@; \ 53 done 54 55 generate-makefiles: distclean-makefiles 56 @env top_srcdir=$(top_srcdir) \ 57 $(top_srcdir)/scripts/generate-makefiles.sh 58 59 install: bin-install conformance-install functional-install stress-install 60 61 test: conformance-test functional-test stress-test 62 63 # Test build and execution targets. 64 conformance-all: $(CRITICAL_MAKEFILE) 65 @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 66 @$(BUILD_MAKE) -C conformance -j1 all 67 68 conformance-install: 69 @$(MAKE) -C conformance install 70 71 conformance-test: 72 @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 73 @$(TEST_MAKE) -C conformance test 74 75 functional-all: $(CRITICAL_MAKEFILE) 76 @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 77 @$(BUILD_MAKE) -C functional -j1 all 78 79 functional-install: 80 @$(MAKE) -C functional install 81 82 functional-test: 83 @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 84 @$(TEST_MAKE) -C functional test 85 86 stress-all: $(CRITICAL_MAKEFILE) 87 @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 88 @$(BUILD_MAKE) -C stress -j1 all 89 90 stress-install: 91 @$(MAKE) -C stress install 92 93 stress-test: 94 @rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@ 95 @$(TEST_MAKE) -C stress test 96 97 # Tools build and install targets. 98 bin-install: 99 @$(MAKE) -C bin install 100 101 tools-all: 102 @$(MAKE) -C tools all 103 104 $(CRITICAL_MAKEFILE): \ 105 $(top_srcdir)/scripts/generate-makefiles.sh \ 106 $(top_srcdir)/CFLAGS \ 107 $(top_srcdir)/LDFLAGS \ 108 $(top_srcdir)/LDLIBS 109 @$(MAKE) generate-makefiles 110