summaryrefslogtreecommitdiff
path: root/contrib/miscutil/Makefile
blob: 88372da0f7a33ada550efd64d299fc2c7c79b1dd (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
#-------------------------------------------------------------------------
#
# Makefile --
#
#    Makefile for the misc_util module.
#
#-------------------------------------------------------------------------

PGDIR = ../..
SRCDIR = $(PGDIR)/src

include $(SRCDIR)/Makefile.global

INCLUDE_OPT =	-I ./ \
		-I $(SRCDIR)/ \
		-I $(SRCDIR)/include \
		-I $(SRCDIR)/port/$(PORTNAME)

CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)

MODNAME =	misc_utils

SQLDEFS =	$(MODNAME).sql

MODULE =	$(MODNAME)$(DLSUFFIX)

MODDIR =	$(LIBDIR)/modules

SQLDIR =	$(LIBDIR)/sql

all:		module sql

module:		$(MODULE)

sql:		$(SQLDEFS)

install:	$(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
		cp -p $(MODULE) $(MODDIR)/
		strip $(MODDIR)/$(MODULE)
		cp -p $(SQLDEFS) $(SQLDIR)/

$(MODDIR):
		mkdir -p $@

$(SQLDIR):
		mkdir -p $@

%.sql: %.sql.in
		sed "s|MODULE_PATHNAME|$(MODDIR)/$(MODULE)|" < $< > $@

.SUFFIXES: $(DLSUFFIX)

%$(DLSUFFIX): %.c
		$(CC) $(CFLAGS) -shared -o $@ $<

depend dep:
		$(CC) -MM $(INCLUDE_OPT) *.c >depend

clean:
		rm -f *~ $(MODULE) $(MODNAME).sql

ifeq (depend,$(wildcard depend))
include depend
endif