File: Makefile

package info (click to toggle)
ltp 20091231%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 55,344 kB
  • ctags: 42,033
  • sloc: ansic: 428,545; sh: 80,565; xml: 8,269; java: 4,742; perl: 4,182; cpp: 4,105; makefile: 3,801; python: 2,151; exp: 1,150; php: 626; lex: 575; pascal: 441; csh: 59; awk: 16; tcl: 11
file content (219 lines) | stat: -rw-r--r-- 7,158 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#
#    Top-level Makefile for LTP. See INSTALL for more info.
#
#    Copyright (C) 2009, Cisco Systems Inc.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License along
#    with this program; if not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Garrett Cooper, July 2009
#

# Force IDcheck.sh to fix any issues found with $(DESTDIR)/etc/group and
# $(DESTDIR)/etc/passwd automatically when after running the top-level
# install target.
CREATE_ENTRIES		?= 0

top_srcdir		?= $(CURDIR)

include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/include/mk/automake.mk

# This variable is automatically changed from help to all once someone has
# run configure, or the equivalent steps manually, as described in INSTALL.
ifeq ($(wildcard $(top_builddir)/include/config.h),)
.DEFAULT_GOAL		:= help
else
.DEFAULT_GOAL		:= all
endif

.SUFFIXES:
.SUFFIXES: .am .default .h .in .m4 .mk

vpath %.am		$(top_srcdir)/m4
vpath %.default		$(top_srcdir)/include
vpath %.h		$(top_srcdir)/include:$(top_builddir)/include
vpath %.in		$(top_srcdir)/include
vpath %.m4		$(top_srcdir)/m4
vpath %.mk		$(top_srcdir)/mk:$(top_srcdir)/mk/include

# Skip running IDcheck.sh at the end of install?
SKIP_IDCHECK		?= 0

# User wants uclinux binaries?
UCLINUX			?= 0

# User wants uclinux binaries. Do this for backwards compatibility, but
# print out a warning.
ifneq ($(filter uclinux%,$(MAKECMDGOALS)),)
$(warning uclinux* targets will be deprecated in the future.)
$(warning Please specify UCLINUX=1 on the command line to achieve the same)
$(warning functionality.)
UCLINUX			:= 1
endif

export UCLINUX

# CLEAN_TARGETS:	Targets which exist solely in clean.
# COMMON_TARGETS:	Targets which exist in all, clean, and install.
# INSTALL_TARGETS:	Targets which exist in clean and install (contains
# 			COMMON_TARGETS).
# BOOTSTRAP_TARGETS:	Directories required to bootstrap out-of-build-tree
# 			support.

# We're not using uclinux based targets (default).
ifneq ($(UCLINUX),1)
COMMON_TARGETS		:= pan utils
INSTALL_TARGETS		:= doc
endif

define target_to_dir_dep_mapping
ifeq ($$(filter %-clean,$(1)),) # not *-clean
$(1): | $$(abs_top_builddir)/$$(basename $$(subst -,.,$(1)))
else				# clean
$(1):: | $$(abs_top_builddir)/$$(basename $$(subst -,.,$(1)))
endif
endef

COMMON_TARGETS		+= testcases tools
INSTALL_TARGETS		+= $(COMMON_TARGETS) runtest testscripts
CLEAN_TARGETS		+= $(COMMON_TARGETS) lib include runtest testscripts
BOOTSTRAP_TARGETS	:= $(sort $(COMMON_TARGETS) $(CLEAN_TARGETS)\
				  $(INSTALL_TARGETS))

CLEAN_TARGETS		:= $(addsuffix -clean,$(CLEAN_TARGETS))
INSTALL_TARGETS		:= $(addsuffix -install,$(INSTALL_TARGETS))
MAKE_TARGETS		:= $(addsuffix -all,$(filter-out lib,$(COMMON_TARGETS)))

# There's no reason why we should run `all' twice. Otherwise we're just wasting
# 3+ mins of useful CPU cycles on a modern machine, and even more time on an
# overtaxed one, or one where -j => 1 was specified.
all: $(addsuffix -all,$(COMMON_TARGETS))

$(MAKE_TARGETS): lib-install

.PHONY: include-all include-install
include-install: $(top_builddir)/include/config.h include/mk/config.mk include-all

INSTALL_DIR		:= $(DESTDIR)/$(prefix)

# build tree bootstrap targets and $(INSTALL_DIR) target.
$(sort $(addprefix $(abs_top_builddir)/,$(BOOTSTRAP_TARGETS)) $(INSTALL_DIR) $(DESTDIR)/$(bindir)):
	mkdir -m 00755 -p "$@"

## Pattern based subtarget rules.
lib-all: include-install

lib-install: lib-all

$(MAKE_TARGETS) include-all lib-all:
	$(MAKE) -C "$(subst -all,,$@)" \
		-f "$(abs_top_srcdir)/$(subst -all,,$@)/Makefile" all

# Let's not conflict with ac-clean, maintainer-clean, etc, so.
$(filter-out include-clean,$(CLEAN_TARGETS))::
	-$(MAKE) -C "$(subst -clean,,$@)" \
		 -f "$(abs_top_srcdir)/$(subst -clean,,$@)/Makefile" clean 

# Just like everything depends on include-all / -install, we need to get rid
# of include last to ensure that things won't be monkey screwed up. Only do
# this if we're invoking clean or a subclean directly though.
ifneq ($(filter clean,$(MAKECMDGOALS)),)
INCLUDE_CLEAN_RDEP_SUBJECT	:= $(CLEAN_TARGETS)
else
ifneq ($(filter %clean,$(MAKECMDGOALS)),)
INCLUDE_CLEAN_RDEP_SUBJECT	:= $(MAKECMDGOALS)
endif
endif

# Remove potential for circular dependencies.
INCLUDE_CLEAN_RDEPS		:= $(filter-out include-clean,\
						$(INCLUDE_CLEAN_RDEP_SUBJECT))

include-clean:: $(INCLUDE_CLEAN_RDEPS) | $(abs_top_builddir)/include
	-$(MAKE) -C include -f "$(abs_top_srcdir)/include/Makefile" clean

# include-install is separate to avoid creating a circular dependency below in
# the install target.
$(INSTALL_TARGETS) include-install lib-install:
	$(MAKE) -C "$(subst -install,,$@)" \
		-f "$(abs_top_srcdir)/$(subst -install,,$@)/Makefile" install

# Just in case configure hasn't been run yet, let's not overambitiously remove
# the $(INSTALL_DIR).
clean:: $(CLEAN_TARGETS)
	$(RM) -f Version
ifneq ($(INSTALL_IN_BUILD_TREE),1)
	-$(RM) -Rf "$(INSTALL_DIR)"
endif

$(foreach tgt,\
	$(MAKE_TARGETS) include-all lib-all $(CLEAN_TARGETS) \
	$(INSTALL_TARGETS) include-install lib-install,\
	$(eval $(call target_to_dir_dep_mapping,$(tgt))))

BINDIR_INSTALL_SCRIPTS	:= execltp
SRCDIR_INSTALL_SCRIPTS	:= IDcheck.sh runalltests.sh runltp runltplite.sh ver_linux
SRCDIR_INSTALL_READONLY	:= Version
SRCDIR_INSTALL_TARGETS	:= $(SRCDIR_INSTALL_SCRIPTS) $(SRCDIR_INSTALL_READONLY)

# Save space. We only need the first line in ChangeLog for runltp*.
Version: $(top_srcdir)/ChangeLog
	head -n 1 "$^" > "$@"

$(INSTALL_DIR)/Version: Version
	install -m 00644 "$(top_builddir)/$(@F)" "$@"

$(addprefix $(DESTDIR)/$(bindir)/,$(BINDIR_INSTALL_SCRIPTS)): %:
	install -m 00755 "$(top_builddir)/$(@F)" "$@"

$(addprefix $(INSTALL_DIR)/,$(SRCDIR_INSTALL_SCRIPTS)): %:
	install -m 00755 "$(top_srcdir)/$(@F)" "$@"

INSTALL_TARGETS		+= $(addprefix $(INSTALL_DIR)/,\
				$(SRCDIR_INSTALL_TARGETS))\
			   $(addprefix $(DESTDIR)/$(bindir)/,\
				$(BINDIR_INSTALL_SCRIPTS))

$(INSTALL_TARGETS): $(INSTALL_DIR) $(DESTDIR)/$(bindir)

## Install
install: $(INSTALL_TARGETS)
ifeq ($(SKIP_IDCHECK),0)
	-@CREATE_ENTRIES=$(CREATE_ENTRIES) \
	 DESTDIR="$(DESTDIR)" \
	 "$(top_srcdir)/IDcheck.sh"
else
	@echo "*******************************************************"
	@echo "** Will not run IDcheck.sh (SKIP_IDCHECK set to 1).  **"
	@echo "*******************************************************"
endif

## Misc targets.

## Help
.PHONY: help
help:
	@echo "Please read the Configuration section in $(top_srcdir)/INSTALL"
	@exit 1

## Menuconfig
menuconfig:
	@$(SHELL) "$(top_srcdir)/ltpmenu"

## Package
package: 
	@$(RPMBUILD) -ba ltp-devel.spec

## End misc targets.