EXTENSION = pg_bikram_sambat MODULE_big = pg_bikram_sambat DISTVERSION = 0.1.0 DATA_built = pg_bikram_sambat--$(DISTVERSION).sql OBJS = pg_bikram_sambat.o \ src/date_converter.o \ src/utils.o \ src/dataset.o \ src/consts.o \ extension/casts.o \ extension/functions.o \ extension/io.o \ extension/operators.o \ extension/utils.o SOURCE_DIR = src # directory containing the C implementation functions EXTENSION_DIR = extension # directory containing the PostgreSQL C wrapper functions # pg_regress options REGRESS_OPTS = --inputdir=tests/pg_regress --outputdir=tests/pg_regress REGRESS = \ 001_lifecycle \ 002_sanity_check \ 003_functions \ 004_operators \ 005_table_operations \ 006_expected_failures \ 007_index_and_operator_class # use -O0 for debugging, -O2 for production (optimization levels) DEBUG_FLAGS = -g -O0 PG_CPPFLAGS = -I$(includedir_server) -I$(SOURCE_DIR) -I$(EXTENSION_DIR) -DPG_EXTENSION $(DEBUG_FLAGS) EXTRA_CLEAN = $(DATA_built) testable SHLIB_LINK = PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) # generate the main 'pg_bikram_sambat--.sql' file by concatenating all the sql files # the order of sql files here matters # wouldn't wanna have operators before the type definition, and so on SQL_FILES = sql/types.sql sql/casts.sql sql/operators.sql sql/functions.sql $(DATA_built): $(SQL_FILES) cat $^ > $@ # creates a symlink named 'pg_bin' to the postgres binary # this symlink is currently used in the attach debug configuration (Attach to PostgreSQL Backend) # through the "Setup Postgres Binary Symlink" task as a preLaunchTask .PHONY: pgbin-symlink pgbin-symlink: ln -sf $(shell $(PG_CONFIG) --bindir)/postgres pg_bin # custom target for buidling standalone test binary from the C implementation files # [NOTE: This does not include PostgreSQl wrapper implementation C files] .PHONY: testable testable: src/consts.c src/dataset.c src/date_converter.c src/main.c src/utils.c $(CC) -g $^ -o testable # target for PGXN distribution DISTNAME = pg_bikram_sambat--$(DISTVERSION) # Make sure to git tag before creating the distribution # git tag -a v$(DISTVERSION) -m "Release version $(DISTVERSION)" # [Replace v$(DISTVERSION) with HEAD in the archive command to create archive from latest commit instead] # [NOTE: if you have uncommited changes, HEAD will not include those for obvious reason] .PHONY: dist dist: git archive --format zip --prefix=$(DISTNAME)/ -o $(DISTNAME).zip v$(DISTVERSION)