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