2 # Top-level Makefile for LTP. See INSTALL for more info.
4 # Copyright (C) 2009, Cisco Systems Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 # Garrett Cooper, July 2009
23 # Force IDcheck.sh to fix any issues found with $(DESTDIR)/etc/group and
24 # $(DESTDIR)/etc/passwd automatically when after running the top-level
28 top_srcdir ?
= $(CURDIR
)
30 include $(top_srcdir
)/include/mk
/env_pre.mk
31 include $(top_srcdir
)/include/mk
/automake.mk
33 # This variable is automatically changed from help to all once someone has
34 # run configure, or the equivalent steps manually, as described in INSTALL.
35 ifeq ($(wildcard $(top_builddir
)/include/config.h
),)
42 .SUFFIXES
: .am .default .h .in .m4 .mk
44 vpath
%.am
$(top_srcdir
)/m4
45 vpath
%.default
$(top_srcdir
)/include
46 vpath
%.h
$(top_srcdir
)/include:$(top_builddir
)/include
47 vpath
%.in
$(top_srcdir
)/include
48 vpath
%.m4
$(top_srcdir
)/m4
49 vpath
%.mk
$(top_srcdir
)/mk
:$(top_srcdir
)/mk
/include
51 # Skip running IDcheck.sh at the end of install?
54 # User wants uclinux binaries?
57 # User wants uclinux binaries. Do this for backwards compatibility, but
58 # print out a warning.
59 ifneq ($(filter uclinux
%,$(MAKECMDGOALS
)),)
60 $(warning uclinux
* targets will be deprecated in the future.
)
61 $(warning Please specify UCLINUX
=1 on the command line to achieve the same
)
62 $(warning functionality.
)
68 # CLEAN_TARGETS: Targets which exist solely in clean.
69 # COMMON_TARGETS: Targets which exist in all, clean, and install.
70 # INSTALL_TARGETS: Targets which exist in clean and install (contains
72 # BOOTSTRAP_TARGETS: Directories required to bootstrap out-of-build-tree
75 # We're not using uclinux based targets (default).
77 COMMON_TARGETS
:= pan utils
78 INSTALL_TARGETS
:= doc
81 define target_to_dir_dep_mapping
82 ifeq ($$(filter %-clean,$(1)),) # not *-clean
83 $(1): |
$$(abs_top_builddir
)/$$(basename $$(subst -,.
,$(1)))
85 $(1):: |
$$(abs_top_builddir
)/$$(basename $$(subst -,.
,$(1)))
89 COMMON_TARGETS
+= testcases tools
90 INSTALL_TARGETS
+= $(COMMON_TARGETS
) runtest testscripts
91 CLEAN_TARGETS
+= $(COMMON_TARGETS
) lib
include runtest testscripts
92 BOOTSTRAP_TARGETS
:= $(sort $(COMMON_TARGETS
) $(CLEAN_TARGETS
)\
95 CLEAN_TARGETS
:= $(addsuffix -clean,$(CLEAN_TARGETS
))
96 INSTALL_TARGETS
:= $(addsuffix -install,$(INSTALL_TARGETS
))
97 MAKE_TARGETS
:= $(addsuffix -all,$(filter-out lib
,$(COMMON_TARGETS
)))
99 # There's no reason why we should run `all' twice. Otherwise we're just wasting
100 # 3+ mins of useful CPU cycles on a modern machine, and even more time on an
101 # overtaxed one, or one where -j => 1 was specified.
102 all: $(addsuffix -all,$(COMMON_TARGETS
))
104 $(MAKE_TARGETS
): lib-install
106 .PHONY
: include-all include-install
107 include-install
: $(top_builddir
)/include/config.h
include/mk
/config.mk include-all
109 INSTALL_DIR
:= $(DESTDIR
)/$(prefix)
111 # build tree bootstrap targets and $(INSTALL_DIR) target.
112 $(sort $(addprefix $(abs_top_builddir
)/,$(BOOTSTRAP_TARGETS
)) $(INSTALL_DIR
) $(DESTDIR
)/$(bindir)):
113 mkdir
-m
00755 -p
"$@"
115 ## Pattern based subtarget rules.
116 lib-all
: include-install
120 $(MAKE_TARGETS
) include-all lib-all
:
121 $(MAKE
) -C
"$(subst -all,,$@)" \
122 -f
"$(abs_top_srcdir)/$(subst -all,,$@)/Makefile" all
124 # Let's not conflict with ac-clean, maintainer-clean, etc, so.
125 $(filter-out include-clean
,$(CLEAN_TARGETS
))::
126 -$(MAKE
) -C
"$(subst -clean,,$@)" \
127 -f
"$(abs_top_srcdir)/$(subst -clean,,$@)/Makefile" clean
129 # Just like everything depends on include-all / -install, we need to get rid
130 # of include last to ensure that things won't be monkey screwed up. Only do
131 # this if we're invoking clean or a subclean directly though.
132 ifneq ($(filter clean,$(MAKECMDGOALS
)),)
133 INCLUDE_CLEAN_RDEP_SUBJECT
:= $(CLEAN_TARGETS
)
135 ifneq ($(filter %clean,$(MAKECMDGOALS
)),)
136 INCLUDE_CLEAN_RDEP_SUBJECT
:= $(MAKECMDGOALS
)
140 # Remove potential for circular dependencies.
141 INCLUDE_CLEAN_RDEPS
:= $(filter-out include-clean
,\
142 $(INCLUDE_CLEAN_RDEP_SUBJECT
))
144 include-clean
:: $(INCLUDE_CLEAN_RDEPS
) |
$(abs_top_builddir
)/include
145 -$(MAKE
) -C
include -f
"$(abs_top_srcdir)/include/Makefile" clean
147 # include-install is separate to avoid creating a circular dependency below in
148 # the install target.
149 $(INSTALL_TARGETS
) include-install lib-install
:
150 $(MAKE
) -C
"$(subst -install,,$@)" \
151 -f
"$(abs_top_srcdir)/$(subst -install,,$@)/Makefile" install
153 # Just in case configure hasn't been run yet, let's not overambitiously remove
154 # the $(INSTALL_DIR).
155 clean:: $(CLEAN_TARGETS
)
157 ifneq ($(INSTALL_IN_BUILD_TREE
),1)
158 -$(RM
) -Rf
"$(INSTALL_DIR)"
162 $(MAKE_TARGETS
) include-all lib-all
$(CLEAN_TARGETS
) \
163 $(INSTALL_TARGETS
) include-install lib-install
,\
164 $(eval
$(call target_to_dir_dep_mapping
,$(tgt
))))
166 BINDIR_INSTALL_SCRIPTS
:= execltp
167 SRCDIR_INSTALL_SCRIPTS
:= IDcheck.sh runalltests.sh runltp runltplite.sh ver_linux
168 SRCDIR_INSTALL_READONLY
:= Version
169 SRCDIR_INSTALL_TARGETS
:= $(SRCDIR_INSTALL_SCRIPTS
) $(SRCDIR_INSTALL_READONLY
)
171 # Save space. We only need the first line in ChangeLog for runltp*.
172 Version
: $(top_srcdir
)/ChangeLog
173 head
-n
1 "$^" > "$@"
175 $(INSTALL_DIR
)/Version
: Version
176 install -m
00644 "$(top_builddir)/$(@F)" "$@"
178 $(addprefix $(DESTDIR
)/$(bindir)/,$(BINDIR_INSTALL_SCRIPTS
)): %:
179 install -m
00755 "$(top_builddir)/$(@F)" "$@"
181 $(addprefix $(INSTALL_DIR
)/,$(SRCDIR_INSTALL_SCRIPTS
)): %:
182 install -m
00755 "$(top_srcdir)/$(@F)" "$@"
184 INSTALL_TARGETS
+= $(addprefix $(INSTALL_DIR
)/,\
185 $(SRCDIR_INSTALL_TARGETS
))\
186 $(addprefix $(DESTDIR
)/$(bindir)/,\
187 $(BINDIR_INSTALL_SCRIPTS
))
189 $(INSTALL_TARGETS
): $(INSTALL_DIR
) $(DESTDIR
)/$(bindir)
192 install: $(INSTALL_TARGETS
)
193 ifeq ($(SKIP_IDCHECK
),0)
194 -@CREATE_ENTRIES
=$(CREATE_ENTRIES
) \
195 DESTDIR
="$(DESTDIR)" \
196 "$(top_srcdir)/IDcheck.sh"
198 @echo
"*******************************************************"
199 @echo
"** Will not run IDcheck.sh (SKIP_IDCHECK set to 1). **"
200 @echo
"*******************************************************"
208 @echo
"Please read the Configuration section in $(top_srcdir)/INSTALL"
213 @
$(SHELL
) "$(top_srcdir)/ltpmenu"
217 @
$(RPMBUILD
) -ba ltp-devel.spec