# srcgen.mk: rules for source-file generation.
# this file is covered by COPYING.BAUTOMAKE.
AM_AUTOM4TE = autom4te
AM_AUTOCONF = autoconf
AM_SHELL = /bin/sh
M4_GEN_SRCS = m4/amversion.m4
M4_CONFIGURE_INPUT = Generated via variable substitution from $(subst $(SOURCE_DIR)/m4/,,$<).
M4_SUBST_RULES = \
-e 's!@configure_input@!$(M4_CONFIGURE_INPUT)!g' \
-e 's!@VERSION@!$(AUTOMAKE_VER)!g' \
-e 's!@APIVERSION@!$(AUTOMAKE_VER)!g'
BIN_GEN_SRCS = bin/aclocal-$(AUTOMAKE_VER) bin/automake-$(AUTOMAKE_VER)
BIN_CONFIGURE_INPUT = Generated via variable substitution from $(subst $(SOURCE_DIR)/bin/,,$<).
BIN_SUBST_RULES = \
-e 's!@configure_input@!$(BIN_CONFIGURE_INPUT)!g' \
-e 's!@PACKAGE@!$(PACKAGE)!g' \
-e 's!@VERSION@!$(AUTOMAKE_VER)!g' \
-e 's!@APIVERSION@!$(AUTOMAKE_VER)!g' \
-e 's!@RELEASE_YEAR@!$(AUTOMAKE_YEAR)!g' \
-e 's!@PACKAGE_BUGREPORT@!$(PKGBUGS)!g' \
-e 's!@PACKAGE_URL@!$(PKGHOME)!g' \
-e 's!@PERL@!$(HOST_PERL)!g' \
-e 's!@SHELL@!$(AM_SHELL)!g' \
-e 's!@am_AUTOCONF@!$(AM_AUTOCONF)!g' \
-e 's!@am_AUTOM4TE@!$(AM_AUTOM4TE)!g' \
-e 's!@datadir@!$(DATADIR)!g'
SRCINFO_SUBST_RULES = \
-e 's!@program@!$(PROGRAM)!g' \
-e 's!@srcsite@!$(SRCSITE)!g' \
-e 's!@package@!$(PACKAGE)!g' \
-e 's,@pgprkey@,$(PGPRKEY),g' \
-e 's,@pgpskey@,$(PGPSKEY),g' \
-e 's!@pkgver@!$(AUTOMAKE_VER)!g' \
-e 's!@srcball_sha256@!$(SRCBALL_SHA256)!g'
LIB_GEN_SRCS = lib/Automake/Config.pm
LIB_CONFIGURE_INPUT = Generated via variable substitution from $(subst $(SOURCE_DIR)/lib/Automake/,,$<).
LIB_SUBST_RULES = \
-e 's!@configure_input@!$(LIB_CONFIGURE_INPUT)!g' \
$(BIN_SUBST_RULES)
MAN_GEN_SRCS = man/aclocal.1 man/aclocal-$(AUTOMAKE_VER).1 \
man/automake.1 man/automake-$(AUTOMAKE_VER).1
ALL_GEN_SRCS = $(M4_GEN_SRCS) $(BIN_GEN_SRCS) $(LIB_GEN_SRCS) $(MAN_GEN_SRCS)
m4/amversion.m4: $(SOURCE_DIR)/m4/amversion.in tree.tag
sed $(M4_SUBST_RULES) $< > $@
bin/aclocal-$(AUTOMAKE_VER): PROGRAM=aclocal
bin/aclocal-$(AUTOMAKE_VER): $(SOURCE_DIR)/bin/aclocal.in tree.tag
sed -e '/$$PACKAGE) $$VERSION/,$$d' $(BIN_SUBST_RULES) \
$< > $@.tmp \
&& sed $(SRCINFO_SUBST_RULES) \
$(SRCINFO) >> $@.tmp \
&& sed -e '/$$PACKAGE) $$VERSION/p' \
-e '1,/$$PACKAGE) $$VERSION/d' $(BIN_SUBST_RULES) \
$< >> $@.tmp \
&& chmod +x $@.tmp \
&& mv $@.tmp $@
bin/automake-$(AUTOMAKE_VER): PROGRAM=automake
bin/automake-$(AUTOMAKE_VER): $(SOURCE_DIR)/bin/automake.in tree.tag
sed -e '/$$PACKAGE) $$VERSION/,$$d' $(BIN_SUBST_RULES) \
$< > $@.tmp \
&& sed $(SRCINFO_SUBST_RULES) \
$(SRCINFO) >> $@.tmp \
&& sed -e '/$$PACKAGE) $$VERSION/p' \
-e '1,/$$PACKAGE) $$VERSION/d' $(BIN_SUBST_RULES) \
$< >> $@.tmp \
&& chmod +x $@.tmp \
&& mv $@.tmp $@
lib/Automake/Config.pm: $(SOURCE_DIR)/lib/Automake/Config.in tree.tag
sed $(LIB_SUBST_RULES) $< > $@
man/aclocal.1: tree.tag
printf '.so man1/aclocal-%s.1\n' $(AUTOMAKE_VER) > $@
man/automake.1: tree.tag
printf '.so man1/automake-%s.1\n' $(AUTOMAKE_VER) > $@
man/aclocal-$(AUTOMAKE_VER).1: $(BIN_GEN_SRCS) $(LIB_GEN_SRCS) tree.tag
PERL5LIB=$(SOURCE_DIR)/lib:./lib PATH=./bin:$(PATH) \
perl $(SOURCE_DIR)/doc/help2man --output=$@ aclocal-$(AUTOMAKE_VER)
man/automake-$(AUTOMAKE_VER).1: $(BIN_GEN_SRCS) $(LIB_GEN_SRCS) tree.tag
PERL5LIB=$(SOURCE_DIR)/lib:./lib PATH=./bin/:$(PATH) \
perl $(SOURCE_DIR)/doc/help2man --output=$@ automake-$(AUTOMAKE_VER)
srcgen: $(ALL_GEN_SRCS)
srcgen-clean:
rm -f $(ALL_GEN_SRCS)
all: srcgen
clean: srcgen-clean
.PHONY: srcgen srcgen-clean