1## 2## Makefile for PostgreSQL extension module 3## 4 5# NOTICE: This requires GNU make as the PostgreSQL PGXS build 6# environment is based on GNU make features! 7# 8# NOTICE: Usually one would just use "PGXS := $(shell pg_config 9# --pgxs)" followed by "include $(PGXS)" as the template. The problem 10# just is that this way (at least still under PostgreSQL 8.1) one 11# cannot pass the "-L../.libs -luuid" to the command which links the 12# DSO. Hence we fiddle around with the Makefiles which "PGXS" uses 13# itself ourself. 14 15PG_CONFIG ?= pg_config 16PGXS := $(shell $(PG_CONFIG) --pgxs) 17POSTGRES := $(shell $(PG_CONFIG) --bindir)/postgres 18top_builddir := $(dir $(PGXS))../.. 19include $(top_builddir)/src/Makefile.global 20 21NAME = uuid 22OBJS = uuid.o 23SO_MAJOR_VERSION = 1 24SO_MINOR_VERSION = 0 25 26override CPPFLAGS := -I.. $(CPPFLAGS) 27SHLIB_LINK := -L../.libs -luuid 28SHLIB_LINK += $(shell test $(shell uname -s) = FreeBSD && echo "-Wl,-Bsymbolic") 29SHLIB_LINK += $(shell test $(shell uname -s) = Darwin && echo "-bundle_loader $(POSTGRES)") 30rpath := 31 32all: uuid.sql all-lib 33 34enable_shared = yes 35include $(top_builddir)/src/Makefile.shlib 36 37uuid.sql: uuid.sql.in 38 sed -e 's;MODULE_PATHNAME;$(DESTDIR)$(pkglibdir)/uuid$(DLSUFFIX);g' <uuid.sql.in >uuid.sql 39 40install: all 41 $(mkinstalldirs) $(DESTDIR)$(pkglibdir) 42 $(mkinstalldirs) $(DESTDIR)$(datadir) 43 $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/uuid$(DLSUFFIX) 44 $(INSTALL_DATA) uuid.sql $(DESTDIR)$(datadir)/uuid.sql 45 46uninstall: 47 -rm -f $(DESTDIR)$(pkglibdir)/uuid$(DLSUFFIX) 48 -rm -f $(DESTDIR)$(datadir)/uuid.sql 49 50clean distclean: clean-lib 51 rm -f $(OBJS) 52 rm -f uuid.sql 53 54realclean: distclean 55 56test: 57 58