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