Blame project/srcgen.mk

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