###############################################################################
# Copyright (C) 2015-present Jonathan Barronville <jonathan@belairlabs.com>   #
#                                                                             #
# This program is free software: you can redistribute it and/or modify        #
# it under the terms of the GNU Affero General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or           #
# (at your option) any later version.                                         #
#                                                                             #
# This program is distributed in the hope that it will be useful,             #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU Affero General Public License for more details.                         #
#                                                                             #
# You should have received a copy of the GNU Affero General Public License    #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
###############################################################################

CURRENT_DIR = $(shell pwd)



DATA = \
	glia--0.0.1.sql \

EXTENSION = glia

MODULE_big = glia
OBJS = \
	src/glia/main.o \

PG_CPPFLAGS = \
	-I$(CURRENT_DIR)/src \
	-pedantic \
	-pedantic-errors \
	-pthread \
	-std=c99 \
	-v \
	-Wall \
	-Werror \
	-Wextra \


ifeq ($(DEBUG),true)
else ifeq ($(enable_debug),yes)
else
	PG_CPPFLAGS += -flto
endif

REGRESS = $(patsubst $(CURRENT_DIR)/regress/sql/%.sql,%,$(wildcard $(CURRENT_DIR)/regress/sql/*.sql))
REGRESS_OPTS = \
	--inputdir=regress \
	--load-extension=$(EXTENSION) \
	--load-language=plpgsql \
	--outputdir=regress \

SHLIB_LINK = \
	-lc \
	-lm \




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