blob: 9c96e5ce0f3308ca55eb5e327d9497cf7a4592a8 (
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
|
#
# Build time variable substitution for generated files.
#
# Shell support.
subst_shell_rules = "\
s{^ADMINDIR=.*$$}{ADMINDIR='$(admindir)'}; \
s{^BACKUPSDIR=.*$$}{BACKUPSDIR='$(backupsdir)'}; \
s{^PKGDATADIR_DEFAULT=.*$$}{PKGDATADIR_DEFAULT='$(pkgdatadir)'}; \
s{^version=['\"][^'\"]*[\"']}{version=\"$(PACKAGE_VERSION)\"}; \
s{^TAR=.*$$}{TAR='$(TAR)'}; \
"
subst_shell_filter = $(PERL) -p -e $(subst_shell_rules)
subst_shell_file = $(PERL) -i -p -e $(shell_subst_rules)
SUFFIXES += .sh
.sh: Makefile
@test -d `dirname $@` || $(MKDIR_P) `dirname $@`
$(AM_V_GEN) $(subst_shell_filter) <$< >$@
$(AM_V_at) chmod +x $@
# Perl support.
subst_perl_rules = "\
s{^\#!\s*/usr/bin/perl}{\#!$(PERL)}; \
s{our \\\$$CONFDIR = .*;}{our \\\$$CONFDIR = '$(pkgconfdir)';}; \
s{our \\\$$ADMINDIR = .*;}{our \\\$$ADMINDIR = '$(admindir)';}; \
s{our \\\$$LIBDIR = .*;}{our \\\$$LIBDIR = '$(pkglibexecdir)';}; \
s{our \\\$$DATADIR = .*;}{our \\\$$DATADIR = '$(pkgdatadir)';}; \
s{our \\\$$PROGMAKE = .*;}{our \\\$$PROGMAKE = '$(MAKE)';}; \
s{our \\\$$PROGTAR = .*;}{our \\\$$PROGTAR = '$(TAR)';}; \
s{our \\\$$PROGPATCH = .*;}{our \\\$$PROGPATCH = '$(PATCH)';}; \
s{our \\\$$PROGVERSION = .*;}{our \\\$$PROGVERSION = '$(PACKAGE_VERSION)';}; \
"
subst_perl_filter = $(PERL) -p -e $(subst_perl_rules)
subst_perl_file = $(PERL) -i -p -e $(subst_perl_rules)
SUFFIXES += .pl
.pl: Makefile
@test -d `dirname $@` || $(MKDIR_P) `dirname $@`
$(AM_V_GEN) $(subst_perl_filter) <$< >$@
$(AM_V_at) chmod +x $@
|