# fdw/Makefile

MODULE_big = steampipe_postgres_fdw
OBJS = fdw.o

SHLIB_LINK = steampipe_postgres_fdw.a

EXTENSION = steampipe_postgres_fdw
DATA = steampipe_postgres_fdw--1.0.sql

REGRESS = steampipe_postgres-fdw

EXTRA_CLEAN = steampipe_postgres_fdw.a fdw.h

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
SERVER_LIB = $(shell $(PG_CONFIG) --includedir-server)
INTERNAL_LIB = $(shell $(PG_CONFIG) --includedir)/internal

PG_CFLAGS = -I${SERVER_LIB} -I${INTERNAL_LIB}

include $(PGXS)

go: ../fdw.go
	# we are building with the net package from go
	# this has the caveat that, since we are not binding to lresolv, DNS resolution may 
	# have some subtle differences from system DNS resolution 
	CGO_ENABLED=1 go build -o steampipe_postgres_fdw.a -tags "$(BUILD_TAGS)" -ldflags="-s -w" -buildmode=c-archive ../*.go
