# pgauditlogtofile/Makefile
EXTENSION = pgauditlogtofile
MODULE_big = pgauditlogtofile
PGFILEDESC = "pgAuditLogToFile - An addon for pgAudit logging extension for PostgreSQL"

OBJS = pgauditlogtofile.o logtofile.o logtofile_bgw.o logtofile_connect.o logtofile_guc.o logtofile_log.o logtofile_shmem.o logtofile_autoclose.o logtofile_vars.o logtofile_filename.o logtofile_json.o logtofile_csv.o logtofile_string_format.o logtofile_execution_memory.o logtofile_execution_time.o logtofile_execution_hook.o logtofile_urgentclose.o logtofile_signal_handler.o logtofile_errordata.o

DATA = pgauditlogtofile--1.0.sql pgauditlogtofile--1.0--1.2.sql pgauditlogtofile--1.2--1.3.sql pgauditlogtofile--1.3--1.4.sql pgauditlogtofile--1.4--1.5.sql pgauditlogtofile--1.5--1.6.sql pgauditlogtofile--1.6--1.7.sql pgauditlogtofile--1.7--1.8.sql

REGRESS_OPTS = --inputdir=test --outputdir=test --load-extension=pgaudit --load-extension=pgauditlogtofile --user=postgres
REGRESS = extension_exists guc_defaults audit_file_exists audit_file_content audit_file_mode
#REGRESS = extension_exists guc_defaults audit_file_exists audit_file_content rotation connections execution_data file_mode error_conditions disconnection_rotation_1_setup disconnection_rotation_2_check

GCC_VERSION := $(shell gcc -dumpversion | cut -f1 -d.)

ifeq ($(shell [ $(GCC_VERSION) -ge 10 ] && echo true),true)
PG_CFLAGS += -fanalyzer -Wall -Wdiscarded-qualifiers -lz -llz4 -lzstd
else
PG_CFLAGS += -Wall -Wdiscarded-qualifiers -lz -llz4 -lzstd
endif

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
