• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
9CRITICAL_MAKEFILE=	conformance/interfaces/timer_settime/Makefile
10
11# The default logfile for the tests.
12LOGFILE?=		logfile
13# Subdirectories to traverse down.
14SUBDIRS=		conformance functional stress
15
16MAKE_ENV=		LOGFILE=`if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
17
18BUILD_MAKE_ENV=		"CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)"
19BUILD_MAKE_ENV+=	"LDLIBS=$(LDLIBS)" $(MAKE_ENV)
20
21TEST_MAKE_ENV=		$(MAKE_ENV)
22
23BUILD_MAKE=		env $(BUILD_MAKE_ENV) $(MAKE)
24
25TEST_MAKE=		env $(TEST_MAKE_ENV) $(MAKE) -k
26
27top_srcdir?=		.
28
29prefix?=		`$(top_srcdir)/scripts/print_prefix.sh`
30
31datadir?=		$(prefix)/share
32
33exec_prefix?=		$(prefix)
34
35all: conformance-all functional-all stress-all tools-all
36
37ifeq ($(shell uname -s), Linux)
38include Makefile.linux
39endif
40
41clean: $(CRITICAL_MAKEFILE)
42	@rm -f $(LOGFILE)*
43	@for dir in $(SUBDIRS) tools; do \
44	    $(MAKE) -C $$dir clean >/dev/null; \
45	done
46
47distclean: distclean-makefiles
48
49# Clean out all of the generated Makefiles.
50distclean-makefiles:
51	@for dir in $(SUBDIRS); do \
52		$(MAKE) -C $$dir $@; \
53	done
54
55generate-makefiles: distclean-makefiles
56	@env top_srcdir=$(top_srcdir) \
57	    $(top_srcdir)/scripts/generate-makefiles.sh
58
59install: bin-install conformance-install functional-install stress-install
60
61test: conformance-test functional-test stress-test
62
63# Test build and execution targets.
64conformance-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
68conformance-install:
69	@$(MAKE) -C conformance install
70
71conformance-test:
72	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
73	@$(TEST_MAKE) -C conformance test
74
75functional-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
79functional-install:
80	@$(MAKE) -C functional install
81
82functional-test:
83	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
84	@$(TEST_MAKE) -C functional test
85
86stress-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
90stress-install:
91	@$(MAKE) -C stress install
92
93stress-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.
98bin-install:
99	@$(MAKE) -C bin install
100
101tools-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