build: break up monolithic Makefile.am in subdir-specific fragments
[platform/upstream/automake.git] / Makefile.am
1 ## Process this file with automake to create Makefile.in
2
3 ## Makefile for Automake.
4
5 # Copyright (C) 1995-2013 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 ## Might be updated later.
21 CLEANFILES =
22 DISTCLEANFILES =
23 MAINTAINERCLEANFILES =
24 EXTRA_DIST =
25 TAGS_FILES =
26 dist_noinst_DATA =
27 nodist_noinst_DATA =
28 dist_noinst_SCRIPTS =
29 nodist_noinst_SCRIPTS =
30
31 ## ------------ ##
32 ##  Top level.  ##
33 ## ------------ ##
34
35 # We want a handful of substitutions to be fully-expanded by make;
36 # then use config.status to substitute the remainder where a single
37 # expansion is sufficient.  We use a funny notation here to avoid
38 # configure substitutions in our text.
39 do_subst = ( sed \
40   -e "s,[@]configure_input[@],Generated from $$in; do not edit by hand.,g" \
41   -e 's,[@]datadir[@],$(datadir),g' \
42   -e 's,[@]amdir[@],$(amdir),g' \
43   -e 's,[@]bindir[@],$(bindir),g' \
44   -e 's,[@]docdir[@],$(docdir),g' \
45   -e 's,[@]pkgvdatadir[@],$(pkgvdatadir),g' \
46   -e 's,[@]scriptdir[@],$(scriptdir),g' \
47   -e 's,[@]automake_acdir[@],$(automake_acdir),g' \
48   -e 's,[@]system_acdir[@],$(system_acdir),g' \
49 ## Hack to avoid a spurious substitution in the Automake script (part 1).
50   -e 's,[@]am__isrc[@],!!@!!am__isrc!!@!!,g' \
51   | $(SHELL) ./config.status --file=- \
52 ## Hack to avoid a spurious substitution in the Automake script (part 2).
53   | sed -e 's,!!@!!am__isrc!!@!!,@''am__isrc@,g' \
54   )
55
56 # Generated  files shouldn't contain unexpanded '@substitutions@', and
57 # should be made read-only, to prevent them from being edited by mistake
58 # instead of the file the are generated from.
59 generated_file_finalize = $(AM_V_at) \
60   if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' $@-t; then \
61     echo "$@ contains unexpanded substitution (see lines above)"; \
62     exit 1; \
63   fi; \
64   chmod a-w $@-t && mv -f $@-t $@
65
66 bin_SCRIPTS = automake aclocal
67
68 CLEANFILES += $(bin_SCRIPTS)
69 AUTOMAKESOURCES = automake.in aclocal.in
70
71 TAGS_FILES += $(AUTOMAKESOURCES)
72
73 EXTRA_DIST += \
74   $(AUTOMAKESOURCES) \
75   bootstrap.sh \
76   GNUmakefile \
77   HACKING \
78   PLANS
79
80 # For some tests or targets, we need to have the just-build automake and
81 # aclocal scripts avaiable on PATH.
82 extend_PATH = \
83   { PATH='$(abs_builddir)/t/wrap'$(PATH_SEPARATOR)$$PATH && export PATH; }
84
85 # Make versioned links.  We only run the transform on the root name;
86 # then we make a versioned link with the transformed base name.  This
87 # seemed like the most reasonable approach.
88 install-exec-hook:
89         @$(POST_INSTALL)
90         @for p in $(bin_SCRIPTS); do \
91           f=`echo $$p | sed '$(transform)'`; \
92           fv="$$f-$(APIVERSION)"; \
93           rm -f "$(DESTDIR)$(bindir)/$$fv"; \
94           echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
95           $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
96         done
97
98 uninstall-hook:
99         @for p in $(bin_SCRIPTS); do \
100           f=`echo $$p | sed '$(transform)'`; \
101           fv="$$f-$(APIVERSION)"; \
102           rm -f "$(DESTDIR)$(bindir)/$$fv"; \
103         done
104
105 # These files depend on Makefile so they are rebuilt if $(VERSION),
106 # $(datadir) or other do_subst'ituted variables change.
107 automake: automake.in
108 aclocal: aclocal.in
109 automake aclocal: Makefile lib/gen-perl-protos
110         $(AM_V_GEN)rm -f $@ $@-t $@-t2 \
111 ## Common substitutions.
112           && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
113 ## Auto-compute prototypes of perl subroutines.
114           && $(PERL) -w $(srcdir)/lib/gen-perl-protos $@-t > $@-t2 \
115           && mv -f $@-t2 $@-t \
116 ## We can't use '$(generated_file_finalize)' here, because currently
117 ## Automake contains occurrences of unexpanded @substitutions@ in
118 ## comments, and that is perfectly legit.
119           && chmod a+x,a-w $@-t && mv -f $@-t $@
120 EXTRA_DIST += lib/gen-perl-protos
121
122 # The master location for INSTALL is lib/INSTALL.
123 # This is where "make fetch" will install new versions.
124 # Make sure we also update this copy.
125 INSTALL: lib/INSTALL
126         $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
127
128 # We don't use the default name for the autom4te cache directory,
129 # so we need this.
130 maintainer-clean-local:
131         rm -rf .autom4te.cache
132
133 # So that automake won't complain about the missing ChangeLog.
134 # The real rule for ChangeLog generation is now in maintainer/maint.mk
135 # (as it is maintainer-specific).
136 ChangeLog:
137
138 # Third-party, obsolescent or experimental stuff.
139 EXTRA_DIST += \
140   contrib/check-html.am \
141   contrib/multilib/README \
142   contrib/multilib/config-ml.in \
143   contrib/multilib/symlink-tree \
144   contrib/multilib/multilib.am \
145   contrib/multilib/multi.m4 \
146   contrib/README
147
148 # Older files, kept mostly for historical interest.
149 EXTRA_DIST += \
150   old/ChangeLog-tests \
151   old/ChangeLog.96 \
152   old/ChangeLog.98 \
153   old/ChangeLog.00 \
154   old/ChangeLog.01 \
155   old/ChangeLog.02 \
156   old/ChangeLog.03 \
157   old/ChangeLog.04 \
158   old/ChangeLog.09 \
159   old/ChangeLog.11 \
160   old/TODO
161
162 # Maintainer-specific files and scripts.
163 EXTRA_DIST += \
164   maintainer/am-ft \
165   maintainer/am-xft \
166   maintainer/rename-tests \
167   maintainer/maint.mk \
168   maintainer/syntax-checks.mk
169
170 # Most work delegated to sub-dir makefile fragments.
171 include $(srcdir)/doc/Makefile.inc
172 include $(srcdir)/lib/Makefile.inc
173 include $(srcdir)/lib/Automake/Makefile.inc
174 include $(srcdir)/lib/am/Makefile.inc
175 include $(srcdir)/m4/Makefile.inc
176 include $(srcdir)/t/Makefile.inc
177
178 # vim: ft=automake noet