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
36 ifeq ($(wildcard $(top_builddir
)/include/config.h
),)
43 .SUFFIXES
: .am .default .h .in .m4 .mk
45 vpath
%.am
$(top_srcdir
)/m4
46 vpath
%.default
$(top_srcdir
)/include
47 vpath
%.h
$(top_srcdir
)/include:$(top_builddir
)/include
48 vpath
%.in
$(top_srcdir
)/include
49 vpath
%.m4
$(top_srcdir
)/m4
50 vpath
%.mk
$(top_srcdir
)/mk
:$(top_srcdir
)/mk
/include
52 # Skip running IDcheck.sh at the end of install?
55 # User wants uclinux binaries?
58 # User wants uclinux binaries. Do this for backwards compatibility, but
59 # print out a warning.
60 ifneq ($(filter uclinux
%,$(MAKECMDGOALS
)),)
61 $(warning uclinux
* targets will be deprecated in the future.
)
62 $(warning Please specify UCLINUX
=1 on the command line to achieve the same
)
63 $(warning functionality.
)
69 # CLEAN_TARGETS: Targets which exist solely in clean.
70 # COMMON_TARGETS: Targets which exist in all, clean, and install.
71 # INSTALL_TARGETS: Targets which exist in clean and install (contains
73 # BOOTSTRAP_TARGETS: Directories required to bootstrap out-of-build-tree
76 # We're not using uclinux based targets (default).
78 COMMON_TARGETS
:= pan utils
79 INSTALL_TARGETS
:= doc
82 COMMON_TARGETS
+= testcases tools
83 INSTALL_TARGETS
+= $(COMMON_TARGETS
) runtest
84 CLEAN_TARGETS
+= $(COMMON_TARGETS
) lib
include runtest
85 BOOTSTRAP_TARGETS
:= $(sort $(COMMON_TARGETS
) $(CLEAN_TARGETS
)\
88 CLEAN_TARGETS
:= $(addsuffix -clean,$(CLEAN_TARGETS
))
89 INSTALL_TARGETS
:= $(addsuffix -install,$(INSTALL_TARGETS
))
90 MAKE_TARGETS
:= $(addsuffix -all,$(filter-out lib
,$(COMMON_TARGETS
)))
92 # There's no reason why we should run `all' twice. Otherwise we're just wasting
93 # 3+ mins of useful CPU cycles on a modern machine, and even more time on an
94 # overtaxed one, or one where -j => 1 was specified.
95 all: $(addsuffix -all,$(COMMON_TARGETS
))
97 $(MAKE_TARGETS
): lib-install
99 .PHONY
: include-all include-install
100 include-install
: include/config.h
include/mk
/config.mk include-all
102 INSTALL_DIR
:= $(DESTDIR
)/$(prefix)
104 # build tree bootstrap targets and $(INSTALL_DIR) target.
105 $(addprefix $(abs_top_builddir
)/,$(BOOTSTRAP_TARGETS
)) $(INSTALL_DIR
):
106 mkdir
-m
00755 -p
"$@"
108 ## Pattern based subtarget rules.
109 lib-all
: include-install
114 $(MAKE_TARGETS
) include-all lib-all
: %-all: $(abs_top_builddir
)/$$*
115 $(MAKE
) -C
$* -f
"$(abs_top_srcdir)/$*/Makefile" all
117 # Let's not conflict with ac-clean, maintainer-clean, etc, so.
119 $(filter-out include-clean
,$(CLEAN_TARGETS
)):: %-clean: $(abs_top_builddir
)/$$*
120 -$(MAKE
) -C
$* -f
"$(abs_top_srcdir)/$*/Makefile" clean
122 # Just like everything depends on include-all / -install, we need to get rid
123 # of include last to ensure that things won't be monkey screwed up. Only do
124 # this if we're invoking clean or a subclean directly though.
125 ifneq ($(filter clean,$(MAKECMDGOALS
)),)
126 INCLUDE_CLEAN_RDEP_SUBJECT
:= $(CLEAN_TARGETS
)
128 ifneq ($(filter %clean,$(MAKECMDGOALS
)),)
129 INCLUDE_CLEAN_RDEP_SUBJECT
:= $(MAKECMDGOALS
)
133 # Remove potential for circular dependencies.
134 INCLUDE_CLEAN_RDEPS
:= $(filter-out include-clean
,\
135 $(INCLUDE_CLEAN_RDEP_SUBJECT
))
137 include-clean
:: $(INCLUDE_CLEAN_RDEPS
) $(abs_top_builddir
)/include
138 -$(MAKE
) -C
include -f
"$(abs_top_srcdir)/include/Makefile" clean
140 # include-install is separate to avoid creating a circular dependency below in
141 # the install target.
143 $(INSTALL_TARGETS
) include-install lib-install
: %-install: $(abs_top_builddir
)/$$*
144 $(MAKE
) -C
$* -f
"$(abs_top_srcdir)/$*/Makefile" install
146 # Just in case configure hasn't been run yet, let's not overambitiously remove
147 # the $(INSTALL_DIR).
148 clean:: $(CLEAN_TARGETS
)
150 $(if
$(DESTDIR
)$(prefix),-$(RM
) -Rf
"$(INSTALL_DIR)")
152 SRCDIR_INSTALL_SCRIPTS
:= IDcheck.sh runltp runltplite.sh ver_linux
153 SRCDIR_INSTALL_READONLY
:= Version
154 SRCDIR_INSTALL_TARGETS
:= $(SRCDIR_INSTALL_SCRIPTS
) $(SRCDIR_INSTALL_READONLY
)
156 # Save space. We only need the first line in ChangeLog for runltp*.
157 Version
: $(top_srcdir
)/ChangeLog
158 head
-n
1 "$^" > "$@"
160 $(INSTALL_DIR
)/Version
: Version
161 install -m
00644 "$(top_builddir)/$(@F)" "$@"
163 $(addprefix $(DESTDIR
)/$(bindir)/,$(BINDIR_INSTALL_SCRIPTS
)) \
164 $(addprefix $(INSTALL_DIR
)/,$(SRCDIR_INSTALL_SCRIPTS
)): %:
165 install -m
00755 "$(top_srcdir)/$(@F)" "$@"
167 INSTALL_TARGETS
+= $(addprefix $(INSTALL_DIR
)/,\
168 $(SRCDIR_INSTALL_TARGETS
))
170 $(INSTALL_TARGETS
): $(INSTALL_DIR
)
173 install: $(INSTALL_TARGETS
)
174 ifeq ($(SKIP_IDCHECK
),0)
175 @CREATE_ENTRIES
=$(CREATE_ENTRIES
) \
176 DESTDIR
="$(DESTDIR)" \
177 "$(top_srcdir)/IDcheck.sh"
179 @echo
"*******************************************************"
180 @echo
"** Will not run IDcheck.sh (SKIP_IDCHECK set to 1). **"
181 @echo
"*******************************************************"
189 @echo
"Please read the Configuration section in $(top_srcdir)/INSTALL"
194 @
$(SHELL
) "$(top_srcdir)/ltpmenu"
198 @
$(RPMBUILD
) -ba ltp-devel.spec