[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [FYI] [ng] refactor: handle 'all', 'check' and 'install' t
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [FYI] [ng] refactor: handle 'all', 'check' and 'install' target in on '.am' file |
Date: |
Mon, 30 Jul 2012 17:56:35 +0200 |
* lib/am/common-targets.am: New file, superseding and encompassing ...
* lib/am/check-target.am, all-target.am, lib/am/install.am: ... these
ones.
* Makefile.am (dist_am_DATA): Adjust.
* automake.in (handle_all_and_check): Remove.
(generate_makefile): Adjust: include 'common-targets.am' "almost
verbatim".
Signed-off-by: Stefano Lattarini <address@hidden>
---
Makefile.am | 4 +-
automake.in | 13 ++----
lib/am/all-target.am | 42 ------------------
lib/am/check-target.am | 33 --------------
lib/am/{install.am => common-targets.am} | 74 ++++++++++++++++++++++++++++----
5 files changed, 70 insertions(+), 96 deletions(-)
delete mode 100644 lib/am/all-target.am
delete mode 100644 lib/am/check-target.am
rename lib/am/{install.am => common-targets.am} (59%)
diff --git a/Makefile.am b/Makefile.am
index 2cca5d5..58ff9e6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -186,8 +186,7 @@ EXTRA_DIST += lib/Automake/Config.in
dist_am_DATA = \
lib/am/am-dir.am \
- lib/am/all-target.am \
- lib/am/check-target.am \
+ lib/am/common-targets.am \
lib/am/serial-tests.am \
lib/am/parallel-tests.am \
lib/am/check-typos.am \
@@ -202,7 +201,6 @@ dist_am_DATA = \
lib/am/footer.am \
lib/am/header-vars.am \
lib/am/header.am \
- lib/am/install.am \
lib/am/inst-vars.am \
lib/am/java.am \
lib/am/lang-compile.am \
diff --git a/automake.in b/automake.in
index bbdd130..e3e96a7 100644
--- a/automake.in
+++ b/automake.in
@@ -3884,13 +3884,6 @@ sub handle_footer
$output_trailer .= file_contents ('footer', new Automake::Location);
}
-# Generate "make all" and "make check" rules.
-sub handle_all_and_check ()
-{
- almost_verbatim ('all-target');
- almost_verbatim ('check-target');
-}
-
# Generate helper targets for user recursion, where needed.
sub handle_user_recursion ()
{
@@ -6892,10 +6885,10 @@ sub generate_makefile ($$)
handle_dist;
handle_footer;
- # Special targets "all" and "check".
- handle_all_and_check;
+ # Special targets 'all', 'check' and 'install', handling of
+ # $(BUILT_SOURCES), and related stuff.
+ almost_verbatim ('common-targets');
- almost_verbatim ('install');
handle_clean ($makefile);
handle_factored_dependencies;
diff --git a/lib/am/all-target.am b/lib/am/all-target.am
deleted file mode 100644
index c14ff17..0000000
--- a/lib/am/all-target.am
+++ /dev/null
@@ -1,42 +0,0 @@
-## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2012 Free Software Foundation, 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, 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, see <http://www.gnu.org/licenses/>.
-
-## The 'all' target.
-
-.PHONY: all all-am all-local
-ifdef SUBDIRS
-.PHONY: all-recursive
-endif
-
-# We need to make sure $(BUILT_SOURCES) files are built before
-# any "ordinary" target (all, check, install, ...) is run.
-# Ditto for config.h (or files specified in AC_CONFIG_HEADERS).
-# But of course, we shouldn't attempt to build any of them when
-# running in dry mode.
-am.built-early = $(am.config-hdr.local) $(BUILT_SOURCES)
-ifeq ($(am.make.dry-run),true)
-# A trick to make the "make -n" output more useful, albeit not
-# completely accurate.
-all check install: | $(am.built-early)
-else
-$(foreach x,$(am.built-early),$(eval -include .am/built-sources/$(x)))
-.am/built-sources/%: | %
- @$(am__ensure_target_dir_exists)
- @touch $@
-endif
-
-all-am: all-local $(am.all.targets)
-all: $(if $(SUBDIRS),all-recursive,all-am)
diff --git a/lib/am/check-target.am b/lib/am/check-target.am
deleted file mode 100644
index 29d73ac..0000000
--- a/lib/am/check-target.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2012 Free Software Foundation, 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, 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, see <http://www.gnu.org/licenses/>.
-
-## The 'check' target.
-
-.PHONY: check check-am check-local
-ifdef SUBDIRS
-.PHONY: check-recursive
-endif
-
-# The check target must depend on the local equivalent of 'all', to
-# ensure all the primary targets are built; then it must build the
-# local check dependencies, and finally run the actual tests (as given
-# by $(TESTS), by DejaGNU, and by the 'check-local' target).
-am.test-suite.check-targets = check-DEJAGNU check-TESTS check-local
-.PHONY: $(am.test-suite.check-targets)
-check-am: $(am.test-suite.check-targets)
-$(am.test-suite.check-targets): all-am $(am.test-suite.deps)
-
-check: $(if $(SUBDIRS),check-recursive,check-am)
diff --git a/lib/am/install.am b/lib/am/common-targets.am
similarity index 59%
rename from lib/am/install.am
rename to lib/am/common-targets.am
index a87e172..772c340 100644
--- a/lib/am/install.am
+++ b/lib/am/common-targets.am
@@ -14,6 +14,43 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
+## Handle our "flagship" targets 'all', 'install' and 'check', as
+## well as timely creation of config headers and $(BUILT_SOURCES).
+
+# ------------------- #
+# The 'all' target. #
+# ------------------- #
+
+.PHONY: all all-am all-local
+ifdef SUBDIRS
+.PHONY: all-recursive
+endif
+
+all-am: all-local $(am.all.targets)
+all: $(if $(SUBDIRS),all-recursive,all-am)
+
+# --------------------- #
+# The 'check' target. #
+# --------------------- #
+
+.PHONY: check check-am check-local
+ifdef SUBDIRS
+.PHONY: check-recursive
+endif
+
+# The check target must depend on the local equivalent of 'all', to
+# ensure all the primary targets are built; then it must build the
+# local check dependencies, and finally run the actual tests (as given
+# by $(TESTS), by DejaGNU, and by the 'check-local' target).
+am.test-suite.check-targets = check-DEJAGNU check-TESTS check-local
+.PHONY: $(am.test-suite.check-targets)
+check-am: $(am.test-suite.check-targets)
+$(am.test-suite.check-targets): all-am $(am.test-suite.deps)
+
+check: $(if $(SUBDIRS),check-recursive,check-am)
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+
## ----------------------------------------- ##
## installdirs -- Creating the installdirs. ##
## ----------------------------------------- ##
@@ -27,19 +64,19 @@ endif
$(if $(SUBDIRS),installdirs-am,installdirs): installdirs-local
ifdef am__installdirs
-## The reason we loop over $(am__installdirs), instead of simply running
-## "$(MKDIR_P) $(am__installdirs), is that directories variable such as
-## "$(DESTDIR)$(mydir)" can potentially expand to "" if $(mydir) is
-## conditionally defined. BTW, those directories are quoted in order
-## to support installation paths with spaces.
+# The reason we loop over $(am__installdirs), instead of simply running
+# "$(MKDIR_P) $(am__installdirs), is that directories variable such as
+# "$(DESTDIR)$(mydir)" can potentially expand to "" if $(mydir) is
+# conditionally defined. BTW, directories in $(am__installdirs) are
+# already quoted in order to support installation paths with spaces.
for dir in $(am__installdirs); do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
endif
-## ----------------- ##
-## Install targets. ##
-## ----------------- ##
+# ------------------ #
+# Install targets. #
+# ------------------ #
.PHONY: install install-exec install-data uninstall
.PHONY: install-exec-am install-data-am uninstall-am
@@ -108,3 +145,24 @@ ifdef bin_PROGRAMS
install-binPROGRAMS: install-nobase_libLTLIBRARIES
endif
endif
+
+# -------------------------------------- #
+# $(BUILT_SOURCES) and config headers. #
+# -------------------------------------- #
+
+# We need to make sure $(BUILT_SOURCES) files are built before
+# any "ordinary" target (all, check, install, ...) is run.
+# Ditto for config.h (or files specified in AC_CONFIG_HEADERS).
+# But of course, we shouldn't attempt to build any of them when
+# running in dry mode.
+am.built-early = $(am.config-hdr.local) $(BUILT_SOURCES)
+ifeq ($(am.make.dry-run),true)
+# A trick to make the "make -n" output more useful, albeit not
+# completely accurate.
+all check install: | $(am.built-early)
+else
+$(foreach x,$(am.built-early),$(eval -include .am/built-sources/$(x)))
+.am/built-sources/%: | %
+ @$(am__ensure_target_dir_exists)
+ @touch $@
+endif
--
1.7.12.rc0
- [Automake-NG] [FYI] [ng] refactor: handle 'all', 'check' and 'install' target in on '.am' file,
Stefano Lattarini <=