summaryrefslogtreecommitdiffstats
path: root/build-aux/subst.am
blob: 5515930d0853fcac17624b639e4f9b90c56e9fe8 (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.

do_shell_subst = $(AM_V_GEN) $(SED) \
	-e "s:^ADMINDIR=.*$$:ADMINDIR='$(admindir)':" \
	-e "s:^BACKUPSDIR=.*$$:BACKUPSDIR='$(backupsdir)':" \
	-e "s:^PKGDATADIR_DEFAULT=.*$$:PKGDATADIR_DEFAULT='$(pkgdatadir)':" \
	-e "s:^version=['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":" \
	-e "s:^TAR=.*$$:TAR='$(TAR)':" \
	# EOL

SUFFIXES += .sh

.sh: Makefile
	@test -d `dirname $@` || $(MKDIR_P) `dirname $@`
	$(do_shell_subst) <$< >$@
	$(AM_V_at) chmod +x $@

# Perl support.

do_perl_subst = $(AM_V_GEN) $(SED) \
	-e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
	-e "s:our \$$CONFDIR = .*;:our \$$CONFDIR = '$(pkgconfdir)';:" \
	-e "s:our \$$ADMINDIR = .*;:our \$$ADMINDIR = '$(admindir)';:" \
	-e "s:our \$$LIBDIR = .*;:our \$$LIBDIR = '$(pkglibexecdir)';:" \
	-e "s:our \$$DATADIR = .*;:our \$$DATADIR = '$(pkgdatadir)';:" \
	-e "s:our \$$PROGMAKE = .*;:our \$$PROGMAKE = '$(MAKE)';:" \
	-e "s:our \$$PROGTAR = .*;:our \$$PROGTAR = '$(TAR)';:" \
	-e "s:our \$$PROGPATCH = .*;:our \$$PROGPATCH = '$(PATCH)';:" \
	-e "s:our \$$PROGVERSION = .*;:our \$$PROGVERSION = '$(PACKAGE_VERSION)';:" \
	# EOL

SUFFIXES += .pl

.pl: Makefile
	@test -d `dirname $@` || $(MKDIR_P) `dirname $@`
	$(do_perl_subst) <$< >$@
	$(AM_V_at) chmod +x $@

# Makefile support.

do_make_subst = $(AM_V_GEN) $(SED) \
	-e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):" \
	# EOL