summaryrefslogtreecommitdiff
path: root/project/srcgen.mk
blob: d1ab778aec3abc85548fa75f79c95dd16e1ce903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 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'

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):   $(SOURCE_DIR)/bin/aclocal.in tree.tag
	sed $(BIN_SUBST_RULES) $< > $@ && chmod +x $@

bin/automake-$(AUTOMAKE_VER):   $(SOURCE_DIR)/bin/automake.in tree.tag
	sed $(BIN_SUBST_RULES) $< > $@ && chmod +x $@

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