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