40 lines
877 B
Makefile
Raw Normal View History

2017-02-18 17:46:11 +00:00
# The build configuration (debug or release)
2015-07-21 16:49:01 -05: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
2017-03-13 19:04:26 +00:00
# TODO: include scripts for all versions.
extension_script := sql/$(EXTENSION)--$(version).sql
DATA := $(extension_script)
2015-07-30 13:19:20 -05:00
REGRESS := regression
2017-02-18 17:46:11 +00:00
# Build options
cpp_files := $(wildcard src/*.cpp)
2015-07-22 12:44:00 -05: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 12:44:00 -05:00
OBJS := $(patsubst %.cpp,%.o,$(cpp_files))
2017-02-18 17:46:11 +00:00
# C flags
2017-03-13 19:04:26 +00:00
PG_CPPFLAGS := -fPIC -std=c++11 -Isrc/ -I/usr/include
2015-07-21 16:49:01 -05:00
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
2017-02-18 17:46:11 +00:00
# Extra libraries to link
2015-07-10 15:58:40 -05:00
SHLIB_LINK := -lphonenumber -lstdc++
2017-02-18 17:46:11 +00:00
# Load PGXS.
2015-07-10 15:58:40 -05:00
PG_CONFIG := pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
2017-03-13 19:04:26 +00:00
# Docker stuff
.PHONY: docker-image
2017-03-13 19:04:26 +00:00
docker-image: clean
docker build -t pg_libphonenumber .