• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#    Autotools include Makefile.
3#
4#    Copyright (C) 2009, Cisco Systems Inc.
5#
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.
10#
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.
15#
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.
19#
20# Ngie Cooper, July 2009
21#
22
23# Override these variables to use non-system available tools.
24ACLOCAL		?= aclocal
25AUTOCONF	?= autoconf
26AUTOHEADER	?= autoheader
27AUTOMAKE	?= automake
28
29AUTOCONFED_SUBDIRS	= \
30			testcases/realtime \
31			testcases/open_posix_testsuite
32
33# We want to run this every single time to ensure that all of the prereq files
34# are there.
35.PHONY: testcases/realtime/configure
36testcases/realtime/configure:
37	$(MAKE) -C $(@D) autotools
38
39.PHONY: testcases/open_posix_testsuite/configure
40testcases/open_posix_testsuite/configure:
41	$(MAKE) -C $(@D) autotools
42
43.PHONY: autotools
44autotools: aclocal autoconf autoheader automake $(addsuffix /configure,$(AUTOCONFED_SUBDIRS))
45
46.PHONY: aclocal
47aclocal: aclocal.m4
48
49aclocal.m4: $(wildcard m4/*.m4) m4/ltp-version.m4
50	$(ACLOCAL) -I m4
51
52.PHONY: autoconf
53autoconf: configure
54
55configure: configure.ac aclocal.m4
56	$(AUTOCONF)
57
58.PHONY: autoheader
59autoheader: configure.ac $(wildcard m4/*.m4) m4/ltp-version.m4 aclocal.m4
60	$(AUTOHEADER)
61
62include:
63	mkdir -p "$@"
64
65m4/ltp-version.m4: VERSION
66	sed -n '1{s:LTP-:m4_define([LTP_VERSION],[:;s:$$:]):;p;q}' $< > $@
67
68.PHONY: automake
69AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1
70automake: aclocal $(AUTOMAKE_FILES)
71$(AUTOMAKE_FILES): m4/Makefile.in
72m4/Makefile.in: m4/Makefile.am aclocal.m4
73	$(AUTOMAKE) -c -a
74
75.PHONY: ac-clean ac-distclean ac-maintainer-clean
76ac-clean::
77	$(RM) -rf autom4te.cache
78	$(RM) -f config.log config.status
79	$(RM) -f include/config.h include/stamp-h1
80	$(RM) -f m4/Makefile m4/ltp-version.m4
81	for d in $(AUTOCONFED_SUBDIRS); do \
82	    $(MAKE) -C "$(top_srcdir)/$$d" $@; \
83	done
84
85ac-distclean:: ac-clean
86ac-maintainer-clean:: ac-distclean
87	for d in $(AUTOCONFED_SUBDIRS); do \
88	    $(MAKE) -C "$(top_srcdir)/$$d" $@; \
89	done
90	$(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in
91	$(RM) -f include/*config.h.in
92
93# Don't include config.h, or make will (rightfully) whine about overriding
94# rules.
95#
96# This list should match the files in configure.ac.
97#
98AUTOGENERATED_FILES	= \
99			include/mk/config.mk	\
100			include/mk/features.mk	\
101			lib/ltp.pc		\
102			m4/Makefile		\
103			execltp
104
105distclean:: %: clean ac-distclean
106	for d in $(AUTOCONFED_SUBDIRS); do \
107	    $(MAKE) -C "$(top_srcdir)/$$d" $@; \
108	done
109	$(RM) -f $(AUTOGENERATED_FILES)
110
111maintainer-clean:: distclean ac-maintainer-clean
112
113$(AUTOGENERATED_FILES): $(top_builddir)/config.status
114	$(SHELL) $^
115
116# This variable is automatically changed from help to all once someone has
117# run configure, or the equivalent steps manually, as described in INSTALL.
118$(abs_top_builddir)/include/mk/config.mk \
119$(abs_top_builddir)/include/mk/features.mk:
120	$(MAKE) -C $(top_srcdir) help; false
121