xref: /aosp_15_r20/external/ltp/include/mk/env_post.mk (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#
2*49cdfc7eSAndroid Build Coastguard Worker#    Environment post-setup Makefile.
3*49cdfc7eSAndroid Build Coastguard Worker#
4*49cdfc7eSAndroid Build Coastguard Worker#    Copyright (c) Linux Test Project, 2009-2020
5*49cdfc7eSAndroid Build Coastguard Worker#    Copyright (c) Cisco Systems Inc., 2009
6*49cdfc7eSAndroid Build Coastguard Worker#
7*49cdfc7eSAndroid Build Coastguard Worker#    This program is free software; you can redistribute it and/or modify
8*49cdfc7eSAndroid Build Coastguard Worker#    it under the terms of the GNU General Public License as published by
9*49cdfc7eSAndroid Build Coastguard Worker#    the Free Software Foundation; either version 2 of the License, or
10*49cdfc7eSAndroid Build Coastguard Worker#    (at your option) any later version.
11*49cdfc7eSAndroid Build Coastguard Worker#
12*49cdfc7eSAndroid Build Coastguard Worker#    This program is distributed in the hope that it will be useful,
13*49cdfc7eSAndroid Build Coastguard Worker#    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*49cdfc7eSAndroid Build Coastguard Worker#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*49cdfc7eSAndroid Build Coastguard Worker#    GNU General Public License for more details.
16*49cdfc7eSAndroid Build Coastguard Worker#
17*49cdfc7eSAndroid Build Coastguard Worker#    You should have received a copy of the GNU General Public License along
18*49cdfc7eSAndroid Build Coastguard Worker#    with this program; if not, write to the Free Software Foundation, Inc.,
19*49cdfc7eSAndroid Build Coastguard Worker#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20*49cdfc7eSAndroid Build Coastguard Worker#
21*49cdfc7eSAndroid Build Coastguard Worker# Ngie Cooper, July 2009
22*49cdfc7eSAndroid Build Coastguard Worker#
23*49cdfc7eSAndroid Build Coastguard Worker
24*49cdfc7eSAndroid Build Coastguard WorkerENV_PRE_LOADED			?= $(error You must load env_pre.mk before including this file)
25*49cdfc7eSAndroid Build Coastguard Worker
26*49cdfc7eSAndroid Build Coastguard Workerinclude $(top_srcdir)/include/mk/functions.mk
27*49cdfc7eSAndroid Build Coastguard Worker
28*49cdfc7eSAndroid Build Coastguard Workerifndef ENV_POST_LOADED
29*49cdfc7eSAndroid Build Coastguard WorkerENV_POST_LOADED = 1
30*49cdfc7eSAndroid Build Coastguard Worker
31*49cdfc7eSAndroid Build Coastguard Worker# Default source search path. Modify as necessary, but I would call that
32*49cdfc7eSAndroid Build Coastguard Worker# poor software design if you need more than one search directory, and
33*49cdfc7eSAndroid Build Coastguard Worker# would suggest creating a general purpose static library to that end.
34*49cdfc7eSAndroid Build Coastguard Workervpath %.c $(abs_srcdir)
35*49cdfc7eSAndroid Build Coastguard Workervpath %.S $(abs_srcdir)
36*49cdfc7eSAndroid Build Coastguard Worker
37*49cdfc7eSAndroid Build Coastguard Worker# For config.h, et all.
38*49cdfc7eSAndroid Build Coastguard WorkerCPPFLAGS			+= -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/include/old/
39*49cdfc7eSAndroid Build Coastguard Worker
40*49cdfc7eSAndroid Build Coastguard WorkerLDFLAGS				+= -L$(top_builddir)/lib
41*49cdfc7eSAndroid Build Coastguard Worker
42*49cdfc7eSAndroid Build Coastguard Workerifeq ($(ANDROID),1)
43*49cdfc7eSAndroid Build Coastguard WorkerLDFLAGS				+= -L$(top_builddir)/lib/android_libpthread
44*49cdfc7eSAndroid Build Coastguard WorkerLDFLAGS				+= -L$(top_builddir)/lib/android_librt
45*49cdfc7eSAndroid Build Coastguard Workerendif
46*49cdfc7eSAndroid Build Coastguard Worker
47*49cdfc7eSAndroid Build Coastguard WorkerMAKE_TARGETS			?= $(notdir $(patsubst %.c,%,$(sort $(wildcard $(abs_srcdir)/*.c))))
48*49cdfc7eSAndroid Build Coastguard WorkerMAKE_TARGETS			:= $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS))
49*49cdfc7eSAndroid Build Coastguard Worker
50*49cdfc7eSAndroid Build Coastguard Worker# with only *.dwo, .[0-9]+.dwo can not be cleaned
51*49cdfc7eSAndroid Build Coastguard WorkerCLEAN_TARGETS			+= $(MAKE_TARGETS) $(HOST_MAKE_TARGETS) *.o *.pyc .cache.mk *.dwo .*.dwo
52*49cdfc7eSAndroid Build Coastguard Worker
53*49cdfc7eSAndroid Build Coastguard Worker# Majority of the files end up in testcases/bin...
54*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_DIR			?= testcases/bin
55*49cdfc7eSAndroid Build Coastguard Worker
56*49cdfc7eSAndroid Build Coastguard Workerifneq ($(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS))
57*49cdfc7eSAndroid Build Coastguard Worker
58*49cdfc7eSAndroid Build Coastguard Workerifeq ($(strip $(INSTALL_DIR)),)
59*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_DIR			:= $(error You must define INSTALL_DIR before including this file)
60*49cdfc7eSAndroid Build Coastguard Workerendif
61*49cdfc7eSAndroid Build Coastguard Worker
62*49cdfc7eSAndroid Build Coastguard Workerifneq ($(strip $(prefix)),)
63*49cdfc7eSAndroid Build Coastguard Worker# Value specified by INSTALL_DIR isn't an absolute path, so let's tack on $(prefix).
64*49cdfc7eSAndroid Build Coastguard Workerifneq ($(patsubst /%,,$(INSTALL_DIR)),)
65*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_DIR			:= $(prefix)/$(INSTALL_DIR)
66*49cdfc7eSAndroid Build Coastguard Workerendif
67*49cdfc7eSAndroid Build Coastguard Worker
68*49cdfc7eSAndroid Build Coastguard Worker# Glob any possible expressions, but make sure to zap the $(abs_srcdir)
69*49cdfc7eSAndroid Build Coastguard Worker# reference at the start of the filename instead of using $(notdir), so that
70*49cdfc7eSAndroid Build Coastguard Worker# way we don't accidentally nuke the relative path from $(abs_srcdir) that
71*49cdfc7eSAndroid Build Coastguard Worker# may have been set in the Makefile.
72*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_TARGETS			:= $(wildcard $(addprefix $(abs_srcdir)/,$(INSTALL_TARGETS)))
73*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_TARGETS			:= $(patsubst $(abs_srcdir)/%,%,$(INSTALL_TARGETS))
74*49cdfc7eSAndroid Build Coastguard Worker
75*49cdfc7eSAndroid Build Coastguard Worker# The large majority of the files that we install are going to be apps and
76*49cdfc7eSAndroid Build Coastguard Worker# scripts, so let's chmod them like that.
77*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_MODE			?= 00775
78*49cdfc7eSAndroid Build Coastguard Worker
79*49cdfc7eSAndroid Build Coastguard Worker$(abspath $(addprefix $(DESTDIR)/$(INSTALL_DIR)/,$(sort $(dir $(INSTALL_TARGETS) $(MAKE_TARGETS))))):
80*49cdfc7eSAndroid Build Coastguard Worker	mkdir -p "$@"
81*49cdfc7eSAndroid Build Coastguard Worker$(foreach install_target,$(INSTALL_TARGETS),$(eval $(call generate_install_rule,$(install_target),$(abs_srcdir),$(INSTALL_DIR))))
82*49cdfc7eSAndroid Build Coastguard Worker$(foreach make_target,$(MAKE_TARGETS),$(eval $(call generate_install_rule,$(make_target),$(abs_builddir),$(INSTALL_DIR))))
83*49cdfc7eSAndroid Build Coastguard Worker
84*49cdfc7eSAndroid Build Coastguard Workerelse  # else ! $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
85*49cdfc7eSAndroid Build Coastguard Worker$(error You must define $$(prefix) before executing install)
86*49cdfc7eSAndroid Build Coastguard Workerendif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
87*49cdfc7eSAndroid Build Coastguard Workerendif
88*49cdfc7eSAndroid Build Coastguard Worker
89*49cdfc7eSAndroid Build Coastguard WorkerCHECK_TARGETS			?= $(addprefix check-,$(notdir $(patsubst %.c,%,$(sort $(wildcard $(abs_srcdir)/*.c)))))
90*49cdfc7eSAndroid Build Coastguard WorkerCHECK_TARGETS			:= $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS)), $(CHECK_TARGETS))
91*49cdfc7eSAndroid Build Coastguard WorkerCHECK_HEADER_TARGETS		?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.h))))
92*49cdfc7eSAndroid Build Coastguard WorkerCHECK				?= $(abs_top_srcdir)/tools/sparse/sparse-ltp
93*49cdfc7eSAndroid Build Coastguard WorkerCHECK_NOFLAGS			?= $(abs_top_srcdir)/scripts/checkpatch.pl -f --no-tree --terse --no-summary --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING
94*49cdfc7eSAndroid Build Coastguard WorkerSHELL_CHECK			?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
95*49cdfc7eSAndroid Build Coastguard WorkerSHELL_CHECK_TARGETS		?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.sh))))
96*49cdfc7eSAndroid Build Coastguard Worker
97*49cdfc7eSAndroid Build Coastguard Workerifeq ($(CHECK),$(abs_top_srcdir)/tools/sparse/sparse-ltp)
98*49cdfc7eSAndroid Build Coastguard WorkerCHECK_DEPS			+= $(CHECK)
99*49cdfc7eSAndroid Build Coastguard Workerendif
100*49cdfc7eSAndroid Build Coastguard Worker
101*49cdfc7eSAndroid Build Coastguard Workerinclude $(top_srcdir)/include/mk/rules.mk
102*49cdfc7eSAndroid Build Coastguard Worker
103*49cdfc7eSAndroid Build Coastguard Workerendif
104