1f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later
2f08c3bdfSopenharmony_ci# Ngie Cooper, June 2010
3f08c3bdfSopenharmony_ci
4f08c3bdfSopenharmony_ci# Makefiles that are considered critical to execution; if they don't exist
5f08c3bdfSopenharmony_ci# all of the Makefiles will be rebuilt by default.
6f08c3bdfSopenharmony_ciCRITICAL_MAKEFILE=	conformance/interfaces/timer_settime/Makefile
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_citop_srcdir?=		.
9f08c3bdfSopenharmony_ci
10f08c3bdfSopenharmony_ciinclude include/mk/env.mk
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_ci# The default logfile for the tests.
13f08c3bdfSopenharmony_ciLOGFILE?=		logfile
14f08c3bdfSopenharmony_ci# Subdirectories to traverse down.
15f08c3bdfSopenharmony_ciSUBDIRS=		conformance functional stress
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ciMAKE_ENV=		LOGFILE=`if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_ciBUILD_MAKE_ENV=		"CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)"
20f08c3bdfSopenharmony_ciBUILD_MAKE_ENV+=	"LDLIBS=$(LDLIBS)" $(MAKE_ENV)
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_ciTEST_MAKE_ENV=		$(MAKE_ENV)
23f08c3bdfSopenharmony_ci
24f08c3bdfSopenharmony_ciBUILD_MAKE=		env $(BUILD_MAKE_ENV) $(MAKE)
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ciTEST_MAKE=		env $(TEST_MAKE_ENV) $(MAKE) -k
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_ciall: conformance-all functional-all stress-all tools-all
29f08c3bdfSopenharmony_ci
30f08c3bdfSopenharmony_ciAUTOGENERATED_FILES = include/mk/config.mk
31f08c3bdfSopenharmony_ci
32f08c3bdfSopenharmony_ci.PHONY: ac-clean
33f08c3bdfSopenharmony_ciac-clean: clean
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_ci.PHONY: clean
36f08c3bdfSopenharmony_ciclean:
37f08c3bdfSopenharmony_ci	$(RM) -f $(LOGFILE)*
38f08c3bdfSopenharmony_ci	$(RM) -f config.log config.status
39f08c3bdfSopenharmony_ci	@for dir in $(SUBDIRS) tools; do \
40f08c3bdfSopenharmony_ci		$(MAKE) -C $$dir clean >/dev/null; \
41f08c3bdfSopenharmony_ci	done
42f08c3bdfSopenharmony_ci
43f08c3bdfSopenharmony_ci.PHONY: distclean
44f08c3bdfSopenharmony_cidistclean: clean distclean-makefiles
45f08c3bdfSopenharmony_ci	@rm -f $(AUTOGENERATED_FILES)
46f08c3bdfSopenharmony_ci
47f08c3bdfSopenharmony_ci# Clean out all of the generated Makefiles.
48f08c3bdfSopenharmony_ci.PHONY: distclean-makefiles
49f08c3bdfSopenharmony_cidistclean-makefiles:
50f08c3bdfSopenharmony_ci	@for dir in $(SUBDIRS); do \
51f08c3bdfSopenharmony_ci		$(MAKE) -C $$dir $@; \
52f08c3bdfSopenharmony_ci	done
53f08c3bdfSopenharmony_ci
54f08c3bdfSopenharmony_ci$(AUTOGENERATED_FILES): $(top_builddir)/config.status
55f08c3bdfSopenharmony_ci	$(SHELL) $^
56f08c3bdfSopenharmony_ci
57f08c3bdfSopenharmony_ci.PHONY: autotools
58f08c3bdfSopenharmony_ciautotools: configure
59f08c3bdfSopenharmony_ci
60f08c3bdfSopenharmony_ciconfigure: configure.ac
61f08c3bdfSopenharmony_ci	autoconf
62f08c3bdfSopenharmony_ci
63f08c3bdfSopenharmony_ci.PHONY: generate-makefiles
64f08c3bdfSopenharmony_cigenerate-makefiles: distclean-makefiles
65f08c3bdfSopenharmony_ci	@env top_srcdir=$(top_srcdir) \
66f08c3bdfSopenharmony_ci		$(top_srcdir)/scripts/generate-makefiles.sh
67f08c3bdfSopenharmony_ci
68f08c3bdfSopenharmony_ci.PHONY: install
69f08c3bdfSopenharmony_ciinstall: bin-install conformance-install functional-install stress-install
70f08c3bdfSopenharmony_ci
71f08c3bdfSopenharmony_ci.PHONY: test
72f08c3bdfSopenharmony_citest: conformance-test functional-test stress-test
73f08c3bdfSopenharmony_ci
74f08c3bdfSopenharmony_ci# Test build and execution targets.
75f08c3bdfSopenharmony_ci.PHONY: conformance-all conformance-install conformance-test
76f08c3bdfSopenharmony_ciconformance-all: $(CRITICAL_MAKEFILE)
77f08c3bdfSopenharmony_ci	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
78f08c3bdfSopenharmony_ci	@$(BUILD_MAKE) -C conformance -j1 all
79f08c3bdfSopenharmony_ci
80f08c3bdfSopenharmony_ciconformance-install:
81f08c3bdfSopenharmony_ci	@$(MAKE) -C conformance install
82f08c3bdfSopenharmony_ci
83f08c3bdfSopenharmony_ciconformance-test:
84f08c3bdfSopenharmony_ci	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
85f08c3bdfSopenharmony_ci	@$(TEST_MAKE) -C conformance test
86f08c3bdfSopenharmony_ci
87f08c3bdfSopenharmony_ci.PHONY: functional-all functional-install functional-test
88f08c3bdfSopenharmony_cifunctional-all: $(CRITICAL_MAKEFILE)
89f08c3bdfSopenharmony_ci	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
90f08c3bdfSopenharmony_ci	@$(BUILD_MAKE) -C functional -j1 all
91f08c3bdfSopenharmony_ci
92f08c3bdfSopenharmony_cifunctional-install:
93f08c3bdfSopenharmony_ci	@$(MAKE) -C functional install
94f08c3bdfSopenharmony_ci
95f08c3bdfSopenharmony_cifunctional-test:
96f08c3bdfSopenharmony_ci	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
97f08c3bdfSopenharmony_ci	@$(TEST_MAKE) -C functional test
98f08c3bdfSopenharmony_ci
99f08c3bdfSopenharmony_ci.PHONY: stress-all stress-install stress-test
100f08c3bdfSopenharmony_cistress-all: $(CRITICAL_MAKEFILE)
101f08c3bdfSopenharmony_ci	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
102f08c3bdfSopenharmony_ci	@$(BUILD_MAKE) -C stress -j1 all
103f08c3bdfSopenharmony_ci
104f08c3bdfSopenharmony_cistress-install:
105f08c3bdfSopenharmony_ci	@$(MAKE) -C stress install
106f08c3bdfSopenharmony_ci
107f08c3bdfSopenharmony_cistress-test:
108f08c3bdfSopenharmony_ci	@rm -f `if echo "$(LOGFILE)" | grep -q '^/'; then echo "$(LOGFILE)"; else echo "\`pwd\`/$(LOGFILE)"; fi`.$@
109f08c3bdfSopenharmony_ci	@$(TEST_MAKE) -C stress test
110f08c3bdfSopenharmony_ci
111f08c3bdfSopenharmony_ci# Tools build and install targets.
112f08c3bdfSopenharmony_ci.PHONY: bin-install
113f08c3bdfSopenharmony_cibin-install:
114f08c3bdfSopenharmony_ci	@$(MAKE) -C bin install
115f08c3bdfSopenharmony_ci
116f08c3bdfSopenharmony_ci.PHONY: tools-all
117f08c3bdfSopenharmony_citools-all:
118f08c3bdfSopenharmony_ci	@$(MAKE) -C tools all
119f08c3bdfSopenharmony_ci
120f08c3bdfSopenharmony_ci$(CRITICAL_MAKEFILE): $(top_srcdir)/scripts/generate-makefiles.sh
121f08c3bdfSopenharmony_ci	@$(MAKE) generate-makefiles
122f08c3bdfSopenharmony_ci
123f08c3bdfSopenharmony_ci.PHONY: check
124f08c3bdfSopenharmony_cicheck:
125f08c3bdfSopenharmony_ci	@echo "Checker not yet supported by Open POSIX testsuite"
126