Makefile revision 81dc0f987f921dfeb814a22bf0bf3446f2ecef88
1#
2#    realtime test suite 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# Garrett Cooper, September 2009
21#
22
23top_srcdir		?= ../..
24
25# Override these variables to use non-system available tools.
26ACLOCAL			?= aclocal
27AUTOCONF		?= autoconf
28AUTOHEADER		?= autoheader
29AUTOMAKE		?= automake
30
31include $(top_srcdir)/include/mk/env_pre.mk
32# Ensure that this error / warning only applies for build targets.
33#
34# NOTE (garrcoop): this criterium should be in-sync with include/mk/env_pre.mk
35# (minus help as that's only invoked in the top-level Makefile).
36ifeq ($(filter autotools %clean .gitignore gitignore.%,$(MAKECMDGOALS)),)
37include $(abs_srcdir)/config.mk
38endif
39include $(top_srcdir)/include/mk/gitignore.mk
40
41LIBDIR			:= lib
42FILTER_OUT_DIRS		:= $(LIBDIR) m4
43LIB			:= $(LIBDIR)/librealtime.a
44
45# START autotools junk
46AUTOGENERATED_FILES	= \
47			m4/Makefile
48
49AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1
50
51.PHONY: autotools aclocal autoconf autoheader automake
52autotools: aclocal autoconf autoheader automake
53
54.PHONY: ac-clean ac-distclean ac-maintainer-clean
55ac-clean::
56	$(RM) -rf autom4te.cache
57	$(RM) -f aclocal.m4 config.log config.status
58	$(RM) -f include/realtime_config.h include/stamp-h1
59
60ac-distclean:: ac-clean
61ac-maintainer-clean:: ac-distclean
62	$(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in
63	$(RM) -f include/realtime_config.h.in
64
65aclocal.m4:
66	$(ACLOCAL) -I $(abs_srcdir)/m4
67
68autoconf: configure
69
70include/realtime_config.h.in: configure.ac $(wildcard m4/*.m4) aclocal.m4
71	$(AUTOHEADER)
72
73configure: configure.ac aclocal.m4
74	$(AUTOCONF)
75automake: $(AUTOMAKE_FILES)
76$(AUTOMAKE_FILES): m4/Makefile.in
77m4/Makefile.in: m4/Makefile.am aclocal.m4
78	$(AUTOMAKE) -c -a
79
80.PHONY: autoheader
81autoheader: include/realtime_config.h.in
82	$(AUTOHEADER)
83
84distclean:: %: clean ac-distclean
85	$(RM) -f $(AUTOGENERATED_FILES)
86
87maintainer-clean:: distclean ac-maintainer-clean
88
89$(AUTOGENERATED_FILES): $(top_builddir)/config.status
90	$(SHELL) $^
91
92# END autotools junk
93
94$(LIBDIR):
95	mkdir -p "$@"
96
97$(LIB): $(LIBDIR)
98	$(MAKE) -C $^ -f "$(abs_srcdir)/$(LIBDIR)/Makefile" all
99
100trunk-all: $(LIB)
101
102trunk-clean:: | lib-clean
103
104lib-clean:: $(LIBDIR)
105	$(MAKE) -C $^ -f "$(abs_srcdir)/$(LIBDIR)/Makefile" clean
106
107# Stub reference for config.mk
108$(abs_srcdir)/config.mk:
109	$(MAKE) -C $(top_srcdir) help; false
110
111include $(top_srcdir)/include/mk/generic_trunk_target.mk
112