2015-07-21 21:49:01 +00:00
|
|
|
#The build configuration
|
|
|
|
CONFIG := release
|
|
|
|
|
2015-07-16 18:34:42 +00:00
|
|
|
EXTENSION := pg_libphonenumber
|
2015-07-16 19:03:05 +00:00
|
|
|
version := 1.0
|
|
|
|
extension_script := $(EXTENSION)--$(version).sql
|
|
|
|
DATA_built := $(extension_script)
|
2015-07-30 18:19:20 +00:00
|
|
|
REGRESS := regression
|
2015-07-16 18:34:42 +00:00
|
|
|
|
2015-07-30 18:19:20 +00:00
|
|
|
#Build options
|
2015-07-22 17:44:00 +00:00
|
|
|
cpp_files := $(wildcard *.cpp)
|
|
|
|
|
2015-07-16 18:34:42 +00:00
|
|
|
MODULE_big := pg_libphonenumber
|
2015-07-30 18:19:20 +00:00
|
|
|
|
2015-07-22 17:44:00 +00:00
|
|
|
OBJS := $(patsubst %.cpp,%.o,$(cpp_files))
|
2015-07-21 21:49:01 +00:00
|
|
|
PG_CPPFLAGS := -fPIC -std=c++11
|
|
|
|
ifeq ($(CONFIG),debug)
|
2015-07-21 21:51:52 +00:00
|
|
|
PG_CPPFLAGS += -g -Og
|
|
|
|
else
|
|
|
|
PG_CPPFLAGS += -O3
|
2015-07-21 21:49:01 +00:00
|
|
|
endif
|
2015-07-10 20:58:40 +00:00
|
|
|
SHLIB_LINK := -lphonenumber -lstdc++
|
|
|
|
|
2015-07-30 18:19:20 +00:00
|
|
|
#Clean options
|
2015-07-22 20:14:05 +00:00
|
|
|
EXTRA_CLEAN := $(extension_script) tools/get_sizeof_phone_number
|
2015-07-16 19:03:05 +00:00
|
|
|
|
2015-07-30 18:19:20 +00:00
|
|
|
#Load PGXS.
|
2015-07-10 20:58:40 +00:00
|
|
|
PG_CONFIG := pg_config
|
|
|
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
|
|
|
include $(PGXS)
|
2015-07-16 19:03:05 +00:00
|
|
|
|
2015-07-30 18:19:20 +00:00
|
|
|
#How to build the extension script:
|
2015-07-22 20:14:05 +00:00
|
|
|
$(extension_script): $(EXTENSION).sql.template tools/get_sizeof_phone_number
|
|
|
|
sed "s/SIZEOF_PHONE_NUMBER/$(shell tools/get_sizeof_phone_number)/" $< > $@
|
2015-07-16 19:03:05 +00:00
|
|
|
|
2015-07-23 21:13:12 +00:00
|
|
|
tools/get_sizeof_phone_number: tools/get_sizeof_phone_number.cpp short_phone_number.h
|
2015-07-21 17:32:30 +00:00
|
|
|
$(CXX) -std=c++11 $< -o $@
|
2015-07-22 17:44:00 +00:00
|
|
|
|