pg-libphonenumber/Makefile

44 lines
1.2 KiB
Makefile
Raw Normal View History

2017-02-18 17:46:11 +00:00
# The build configuration (debug or release)
2015-07-21 21:49:01 +00:00
CONFIG := release
2017-02-18 17:46:11 +00:00
# Extension packaging options
EXTENSION := pg_libphonenumber
2017-02-18 17:46:11 +00:00
version := 0.1.0
extension_script := $(EXTENSION)--$(version).sql
DATA_built := $(extension_script)
2015-07-30 18:19:20 +00:00
REGRESS := regression
2017-02-18 17:46:11 +00:00
# Build options
cpp_files := $(wildcard src/*.cpp)
2015-07-22 17:44:00 +00:00
2017-02-18 17:46:11 +00:00
# The native module to build
MODULE_big := pg_libphonenumber
2017-02-18 17:46:11 +00:00
# The object files that go into the module
2015-07-22 17:44:00 +00:00
OBJS := $(patsubst %.cpp,%.o,$(cpp_files))
2017-02-18 17:46:11 +00:00
# C flags
PG_CPPFLAGS := -fPIC -std=c++11 -Isrc/
2015-07-21 21:49:01 +00:00
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
2017-02-18 17:46:11 +00:00
# Extra libraries to link
2015-07-10 20:58:40 +00:00
SHLIB_LINK := -lphonenumber -lstdc++
2017-02-18 17:46:11 +00:00
# Clean options
EXTRA_CLEAN := $(extension_script) tools/get_sizeof_phone_number
2017-02-18 17:46:11 +00:00
# Load PGXS.
2015-07-10 20:58:40 +00:00
PG_CONFIG := pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
2017-02-18 17:46:11 +00:00
# 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)/" $< > $@
2017-02-18 17:46:11 +00:00
# Gets the size of a ShortPhoneNumber (which corresponds to the phone_number type in SQL)
tools/get_sizeof_phone_number: tools/get_sizeof_phone_number.cpp src/short_phone_number.h
$(CXX) $(PG_CPPFLAGS) $< -o $@