File: Makefile

package info (click to toggle)
ip4r 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,108 kB
  • sloc: ansic: 6,552; sql: 4,324; makefile: 88; sed: 21; sh: 7
file content (104 lines) | stat: -rw-r--r-- 2,673 bytes parent folder | download | duplicates (2)
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

MODULE_big = ip4r

ifndef NO_EXTENSION
EXTENSION= ip4r
SRC_SQL	= ip4r--2.4.sql \
	  ip4r--2.2--2.4.sql \
	  ip4r--2.1--2.2.sql \
	  ip4r--2.0--2.1.sql \
	  ip4r--unpackaged2.1--2.1.sql \
	  ip4r--unpackaged2.0--2.0.sql \
	  ip4r--unpackaged1--2.0.sql
DATA	= $(addprefix scripts/, $(SRC_SQL))
REGRESS = ip4r $(REGRESS_$(MAJORVERSION))
REGRESS_11 := ip4r-v11
REGRESS_12 := $(REGRESS_11)
else
DATA_built = ip4r.sql
EXTRA_CLEAN += ip4r.sql.in sql/ip4r-legacy.sql expected/ip4r-legacy.out
REGRESS = ip4r-legacy
endif

objdir	= src

#DOCS	= README.ip4r
OBJS_C	= ip4r_module.o ip4r.o ip6r.o ipaddr.o iprange.o raw_io.o
OBJS	= $(addprefix src/, $(OBJS_C))
INCS	= ipr.h ipr_internal.h

HEADERS = src/ipr.h

# if VPATH is not already set, but the makefile is not in the current
# dir, then assume a vpath build using the makefile's directory as
# source. PGXS will set $(srcdir) accordingly.
ifndef VPATH
ifneq ($(realpath $(CURDIR)),$(realpath $(dir $(firstword $(MAKEFILE_LIST)))))
VPATH := $(dir $(firstword $(MAKEFILE_LIST)))
endif
endif

ifndef NO_PGXS
PG_CONFIG ?= pg_config
PGXS = $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/ip4r
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

ifeq ($(filter-out 7.% 8.0 8.1 8.2 8.3, $(MAJORVERSION)),)
$(error unsupported PostgreSQL version)
endif

$(OBJS): $(addprefix $(srcdir)/src/, $(INCS))

# for a vpath build, we need src/ to exist in the build dir before
# building any objects.
ifdef VPATH
all: vpath-mkdirs
.PHONY: vpath-mkdirs
$(OBJS): | vpath-mkdirs

vpath-mkdirs:
	$(MKDIR_P) $(objdir)
endif # VPATH

ifndef EXTENSION

ifeq ($(filter-out 8.4, $(MAJORVERSION)),)

ip4r.sql.in: $(srcdir)/scripts/ip4r--2.4.sql $(srcdir)/tools/legacy.sed
	sed -f $(srcdir)/tools/legacy.sed $< | sed -e '/^DO /,/^[$$]/d' >$@

else

ip4r.sql.in: $(srcdir)/scripts/ip4r--2.4.sql $(srcdir)/tools/legacy.sed
	sed -f $(srcdir)/tools/legacy.sed $< >$@

endif

# regression test doesn't like the idea of having to build files in
# the sql/ subdir, and looks for that only in $(srcdir). So disable
# legacy regression tests in vpath build.
ifndef VPATH
sql/ip4r-legacy.sql: sql/ip4r.sql tools/legacy-r.sed
	sed -f tools/legacy-r.sed $< >$@

expected/ip4r-legacy.out: expected/ip4r.out tools/legacy-r.sed
	sed -f tools/legacy-r.sed $< | sed -e '/^\\i /,+1d' >$@

installcheck: sql/ip4r-legacy.sql expected/ip4r-legacy.out
else
installcheck:
	@echo regression tests are disabled in legacy vpath build
endif # VPATH

else
ifeq ($(filter-out 8.% 9.0, $(MAJORVERSION)),)
$(error extension build not supported in versions before 9.1, use NO_EXTENSION=1)
endif
endif