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