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
|
2015-07-16 18:34:42 +00:00
|
|
|
EXTENSION := pg_libphonenumber
|
2017-03-13 21:32:50 +00:00
|
|
|
DATA := sql/$(EXTENSION)--*.sql
|
2015-07-30 18:19:20 +00:00
|
|
|
REGRESS := regression
|
2015-07-16 18:34:42 +00:00
|
|
|
|
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
|
2015-07-16 18:34:42 +00:00
|
|
|
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
|
2017-12-09 23:42:41 +00:00
|
|
|
PG_CPPFLAGS := -fPIC -std=gnu++14
|
|
|
|
PG_CPPFLAGS += -Isrc/ -I/usr/include
|
|
|
|
PG_CPPFLAGS += -Wall -Wextra
|
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
|
|
|
# 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
|
|
|
|
2017-03-13 19:04:26 +00:00
|
|
|
# Docker stuff
|
|
|
|
.PHONY: docker-image
|
2015-07-16 19:03:05 +00:00
|
|
|
|
2017-03-13 19:04:26 +00:00
|
|
|
docker-image: clean
|
|
|
|
docker build -t pg_libphonenumber .
|