File: Makefile

package info (click to toggle)
pgfincore 1.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 172 kB
  • ctags: 82
  • sloc: ansic: 610; sql: 263; makefile: 93; sh: 2
file content (105 lines) | stat: -rw-r--r-- 3,094 bytes parent folder | download
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
EXTENSION    = pgfincore
EXTVERSION   = 1.1.2
EXTCOMMENT   = examine and manage the os buffer cache

MODULES      = $(EXTENSION)
MODULEDIR    = $(EXTENSION)
DOCS         = README.rst
DATA_built   = $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION)--unpackaged--$(EXTVERSION).sql
REGRESS      = $(EXTENSION).ext
EXTRA_CLEAN  = $(EXTENSION).control

PG_CONFIG    = pg_config

BUILD_EXTENSION = $(shell $(PG_CONFIG) --version | grep -qE "8\.|9\.0" && echo no || echo yes)

ifeq ($(BUILD_EXTENSION),no)
DATA_built  =
DATA        = $(EXTENSION).sql uninstall_$(EXTENSION).sql
REGRESS     = $(EXTENSION)
EXTRA_CLEAN =
endif

PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

# Build some more files for extension support:
ifeq ($(BUILD_EXTENSION),yes)
# pgxs is included after variable definition and before targets, so the
# PostgreSQL default target is used (all:)

# build the extension--unpackaged--version.sql from uninstall_extension.sql
# this assumes that the extension was installed via sql script instead of
# CREATE EXTENSION.
# This won't upgrade from a previous version to the current one.
$(EXTENSION)--unpackaged--$(EXTVERSION).sql: uninstall_$(EXTENSION).sql
	sed 's/DROP /ALTER EXTENSION $(EXTENSION) ADD /' $< > $@

# this copy the extension.sql to extension--version.sql
$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql
	cp $< $@

# this build extension.control from extension.control.in
$(EXTENSION).control: $(EXTENSION).control.in
	sed 's/EXTVERSION/$(EXTVERSION)/;s/EXTENSION/$(EXTENSION)/;s/EXTCOMMENT/$(EXTCOMMENT)/' $< > $@
endif

# Here we override targets
# Recent PostgreSQL got a bugfix about that, here we just abuse the upstream fix in the mean-time
# FIX HERE before PostgreSQL got the backpatch and push the latest minor, can remove this part when done
ifeq ($(BUILD_EXTENSION),yes)

install: all installcontrol installdata installdocs installscripts | installdirs
ifdef MODULES
	$(INSTALL_SHLIB) $(addsuffix $(DLSUFFIX), $(MODULES)) '$(DESTDIR)$(pkglibdir)/'
endif # MODULES

installcontrol: $(addsuffix .control, $(EXTENSION))
ifneq (,$(EXTENSION))
	$(INSTALL_DATA) $^ '$(DESTDIR)$(datadir)/extension/'
endif

installdata: $(DATA) $(DATA_built)
ifneq (,$(DATA)$(DATA_built))
	$(INSTALL_DATA) $^ '$(DESTDIR)$(datadir)/$(datamoduledir)/'
endif

installdocs: $(DOCS)
ifdef DOCS
ifdef docdir
	$(INSTALL_DATA) $^ '$(DESTDIR)$(docdir)/$(docmoduledir)/'
endif # docdir
endif # DOCS

installscripts: $(SCRIPTS) $(SCRIPTS_built)
ifdef SCRIPTS
	$(INSTALL_SCRIPT) $^ '$(DESTDIR)$(bindir)/'
endif # SCRIPTS

installdirs:
ifneq (,$(EXTENSION))
	$(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
endif
ifneq (,$(DATA)$(DATA_built))
	$(MKDIR_P) '$(DESTDIR)$(datadir)/$(datamoduledir)'
endif
ifneq (,$(MODULES))
	$(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
endif
ifdef DOCS
ifdef docdir
	$(MKDIR_P) '$(DESTDIR)$(docdir)/$(docmoduledir)'
endif # docdir
endif # DOCS

endif

dist:
	git archive --prefix=$(EXTENSION)-$(EXTVERSION)/ -o ../$(EXTENSION)_$(EXTVERSION).orig.tar.gz HEAD

deb:
	make clean
	make -f debian/rules debian/control
	dh clean
	make -f debian/rules orig
	debuild -us -uc -sa