summaryrefslogtreecommitdiffstats
path: root/Makefile.am
blob: 8b5c52fbdf0aac612ec8dbc0bfd1ad73d2050b49 (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
SUBDIRS = . doc

bin_SCRIPTS = postgresql$(DISTSUFF)-setup

libexec_SCRIPTS = postgresql$(DISTSUFF)-ctl \
		  postgresql$(DISTSUFF)-check-db-dir

pkgsysconfdir = $(PKGCONFIG_DIR)
pkgsysconf_DATA = conf/postgresql$(DISTSUFF)

systemdunitsdir = $(prefix)/lib/systemd/system
nodist_systemdunits_DATA = postgresql$(DISTSUFF).service

nodist_pgdoc_DATA = README.rpm-dist

# Encouraged by autoconf documentation itself.  When we use config.status
# directly, e.g. libexecdir may result into '${exec_prefix}/libexec' -- but we
# need fully expanded strings there.
edit = $(SED) \
	-e 's|@DISTSUFF[@]|$(DISTSUFF)|g' \
	-e 's|@libdir[@]|$(libdir)|g' \
	-e 's|@libexecdir[@]|$(libexecdir)|g' \
	-e 's|@PG_CTL_BIN[@]|$(PG_CTL_BIN)|g' \
	-e 's|@PGDATADIR[@]|$(PGDATADIR)|g' \
	-e 's|@pgdocdir[@]|$(pgdocdir)|g' \
	-e 's|@PGENGINE[@]|$(PGENGINE)|g' \
	-e 's|@PGMAJORVERSION[@]|$(PGMAJORVERSION)|g' \
	-e 's|@PGVERSION[@]|$(PGVERSION)|g' \
	-e 's|@PKGCONFIG_DIR[@]|$(PKGCONFIG_DIR)|g' \
	-e 's|@POSTGRES_HOMEDIR[@]|$(POSTGRES_HOMEDIR)|g' \
	-e 's|@PREVMAJORVERSION[@]|$(PREVMAJORVERSION)|g' \
	-e 's|@PREVPGENGINE[@]|$(PREVPGENGINE)|g' \
	-e 's|@README_DIST[@]|$(README_DIST)|g' \
	-e 's|@SU[@]|$(SU)|g' \
	-e 's|@VERSION[@]|$(VERSION)|g' \
	$< > $@

c_s = $(top_srcdir)/config.status

c_s_gen = $(AM_V_GEN)$(edit)

c_s_script_gen = $(c_s_gen) && chmod +x $@

postgresql$(DISTSUFF)-ctl: postgresql-ctl.in $(c_s)
	$(c_s_script_gen)

postgresql$(DISTSUFF)-setup: postgresql-setup.in $(c_s)
	$(c_s_script_gen)

postgresql$(DISTSUFF)-check-db-dir: postgresql-check-db-dir.in $(c_s)
	$(c_s_script_gen)

conf/postgresql$(DISTSUFF): conf/postgresql.in $(c_s)
	$(c_s_gen)

postgresql$(DISTSUFF).service: postgresql.service.in $(c_s)
	$(c_s_gen)

README.rpm-dist: README.rpm-dist.in $(c_s)
	$(c_s_gen)

EXTRA_DIST = *.in conf/*.in

CLEANFILES = $(bin_SCRIPTS) \
	     $(libexec_SCRIPTS) \
	     $(nodist_pgdoc_DATA) \
	     $(pkgsysconf_DATA) \
	     $(nodist_systemdunits_DATA)

install-exec-hook:
	rm -rf $(DESTDIR)$(systemdunitsdir)/postgresql$(DISTSUFF)@.service
	ln $(DESTDIR)$(systemdunitsdir)/postgresql$(DISTSUFF).service \
	   $(DESTDIR)$(systemdunitsdir)/postgresql$(DISTSUFF)@.service