39 lines
942 B
Makefile
Raw Normal View History

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