From bcacee12834e211179a6feb85666b8a511393790 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Fri, 14 Oct 2016 11:23:57 +0200 Subject: [PATCH] Get cflags/ldflags/bindir from pg_config and add install rule --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f0d4c24..7894a49 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,15 @@ # note this must match version macros in pg_filedump.h FD_VERSION=9.6.0 -CFLAGS=-g -O -Wall -Wmissing-prototypes -Wmissing-declarations - # If working with a PG source directory, point PGSQL_INCLUDE_DIR to its # src/include subdirectory. If working with an installed tree, point to # the server include subdirectory, eg /usr/local/include/postgresql/server PG_CONFIG=pg_config +PGSQL_CFLAGS=$(shell $(PG_CONFIG) --cflags) PGSQL_INCLUDE_DIR=$(shell $(PG_CONFIG) --includedir-server) +PGSQL_LDFLAGS=$(shell $(PG_CONFIG) --ldflags) PGSQL_LIB_DIR=$(shell $(PG_CONFIG) --libdir) - +PGSQL_BIN_DIR=$(shell $(PG_CONFIG) --bindir) DISTFILES= README.pg_filedump Makefile Makefile.contrib \ pg_filedump.h pg_filedump.c @@ -19,10 +19,10 @@ DISTFILES= README.pg_filedump Makefile Makefile.contrib \ all: pg_filedump pg_filedump: pg_filedump.o - ${CC} ${LDFLAGS} -o pg_filedump pg_filedump.o -L${PGSQL_LIB_DIR} -lpgport + ${CC} ${PGSQL_LDFLAGS} ${LDFLAGS} -o pg_filedump pg_filedump.o -L${PGSQL_LIB_DIR} -lpgport pg_filedump.o: pg_filedump.c - ${CC} ${CFLAGS} -I${PGSQL_INCLUDE_DIR} pg_filedump.c -c + ${CC} ${PGSQL_CFLAGS} ${CFLAGS} -I${PGSQL_INCLUDE_DIR} pg_filedump.c -c dist: rm -rf pg_filedump-${FD_VERSION} pg_filedump-${FD_VERSION}.tar.gz @@ -31,5 +31,9 @@ dist: tar cfz pg_filedump-${FD_VERSION}.tar.gz pg_filedump-${FD_VERSION} rm -rf pg_filedump-${FD_VERSION} +install: pg_filedump + mkdir -p $(DESTDIR)$(PGSQL_BIN_DIR) + install pg_filedump $(DESTDIR)$(PGSQL_BIN_DIR) + clean: rm -f *.o pg_filedump