summaryrefslogtreecommitdiff
path: root/ltp_framework/include/mk/automake.mk
blob: e5a4fe047a0381f30a6e1a0c9755bf5352708929 (plain)
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
#
#    Autotools include Makefile.
#
#    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
#

# Override these variables to use non-system available tools.
ACLOCAL		?= aclocal
AUTOCONF	?= autoconf
AUTOHEADER	?= autoheader
AUTOMAKE	?= automake

AUTOCONFED_SUBDIRS	= \
			testcases/realtime

# We want to run this every single time to ensure that all of the prereq files
# are there.
.PHONY: testcases/realtime/configure
testcases/realtime/configure:
	$(MAKE) -C $(@D) autotools

.PHONY: autotools
autotools: aclocal autoconf autoheader automake $(addsuffix /configure,$(AUTOCONFED_SUBDIRS))

.PHONY: aclocal
aclocal: aclocal.m4

aclocal.m4: $(wildcard m4/*.m4) m4/ltp-version.m4
	$(ACLOCAL) -I m4

.PHONY: autoconf
autoconf: configure

configure: configure.ac aclocal.m4
	$(AUTOCONF)

.PHONY: autoheader
autoheader: configure.ac $(wildcard m4/*.m4) m4/ltp-version.m4 aclocal.m4
	$(AUTOHEADER)

include:
	mkdir -p "$@"

m4/ltp-version.m4: ChangeLog
	sed -n '1{s:LTP-:m4_define([LTP_VERSION],[:;s:$$:]):;p;q}' $< > $@

.PHONY: automake
AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1
automake: aclocal $(AUTOMAKE_FILES)
$(AUTOMAKE_FILES): m4/Makefile.in
m4/Makefile.in: m4/Makefile.am aclocal.m4
	$(AUTOMAKE) -c -a

.PHONY: ac-clean ac-distclean ac-maintainer-clean
ac-clean::
	$(RM) -rf autom4te.cache
	$(RM) -f config.log config.status
	$(RM) -f include/config.h include/stamp-h1
	$(RM) -f m4/Makefile m4/ltp-version.m4
	for d in $(AUTOCONFED_SUBDIRS); do \
	    $(MAKE) -C "$(top_srcdir)/$$d" $@; \
	done

ac-distclean:: ac-clean
ac-maintainer-clean:: ac-distclean
	for d in $(AUTOCONFED_SUBDIRS); do \
	    $(MAKE) -C "$(top_srcdir)/$$d" $@; \
	done
	$(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in
	$(RM) -f include/*config.h.in

# Don't include config.h, or make will (rightfully) whine about overriding
# rules.
#
# This list should match the files in configure.ac.
#
AUTOGENERATED_FILES	= \
			include/mk/config.mk	\
			include/mk/features.mk	\
			lib/ltp.pc		\
			m4/Makefile		\
			ltp-devel.spec		\
			execltp			\
			README.ltp-devel

distclean:: %: clean ac-distclean
	for d in $(AUTOCONFED_SUBDIRS); do \
	    $(MAKE) -C "$(top_srcdir)/$$d" $@; \
	done
	$(RM) -f $(AUTOGENERATED_FILES)

maintainer-clean:: distclean ac-maintainer-clean

$(AUTOGENERATED_FILES): $(top_builddir)/config.status
	$(SHELL) $^

# This variable is automatically changed from help to all once someone has
# run configure, or the equivalent steps manually, as described in INSTALL.
$(abs_top_builddir)/include/mk/config.mk \
$(abs_top_builddir)/include/mk/features.mk:
	$(MAKE) -C $(top_srcdir) help; false