mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Add support for VPATH builds, that is, building somewhere else than in the
source directory. This involves mostly makefiles using $(srcdir) when they might have used ".". (Regression tests don't work with this, yet.) Sort out usage of CPPFLAGS, CFLAGS (and CXXFLAGS). Add "override" keyword in most places, to preserve necessary flags even when the user overrode the flags.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.66 2000/10/07 18:43:22 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.67 2000/10/20 21:03:39 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -58,7 +58,7 @@ $(OBJS): $(DIRS:%=%-recursive)
|
||||
|
||||
.PHONY: $(DIRS:%=%-recursive)
|
||||
# Update the commonly used headers before building the subdirectories
|
||||
$(DIRS:%=%-recursive): $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
|
||||
$(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
|
||||
$(MAKE) -C $(subst -recursive,,$@) all
|
||||
|
||||
|
||||
@@ -98,8 +98,9 @@ utils/fmgroids.h: utils/Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc
|
||||
# up to date when we update the base file.
|
||||
|
||||
$(top_builddir)/src/include/parser/parse.h: $(srcdir)/parser/parse.h
|
||||
cd $(dir $@) && rm -f $(notdir $@) && \
|
||||
$(LN_S) ../../../$(subdir)/parser/parse.h .
|
||||
prereqdir=`cd $(dir $<) && pwd` && \
|
||||
cd $(dir $@) && rm -f $(notdir $@) && \
|
||||
$(LN_S) $$prereqdir/$(notdir $<) .
|
||||
|
||||
$(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
|
||||
cd $(dir $@) && rm -f $(notdir $@) && \
|
||||
@@ -123,9 +124,9 @@ ifeq ($(MAKE_DLL), true)
|
||||
endif
|
||||
endif
|
||||
$(MAKE) -C catalog install-bki
|
||||
$(INSTALL_DATA) libpq/pg_hba.conf.sample $(DESTDIR)$(datadir)/pg_hba.conf.sample
|
||||
$(INSTALL_DATA) libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
|
||||
$(INSTALL_DATA) utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
|
||||
$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample $(DESTDIR)$(datadir)/pg_hba.conf.sample
|
||||
$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
|
||||
$(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(datadir)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Makefile for the bootstrap module
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.25 2000/08/28 11:53:17 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.26 2000/10/20 21:03:41 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -11,7 +11,7 @@ top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
ifeq ($(GCC), yes)
|
||||
CFLAGS+= -Wno-error
|
||||
override CFLAGS+= -Wno-error
|
||||
endif
|
||||
|
||||
# qnx4's wlink currently crashes with bootstrap.o
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Makefile for catalog
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.27 2000/10/08 03:53:13 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.28 2000/10/20 21:03:42 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -34,12 +34,15 @@ TEMPLATE1_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
|
||||
pg_rewrite.h pg_listener.h pg_description.h indexing.h \
|
||||
)
|
||||
|
||||
pg_includes := $(sort -I$(top_srcdir)/src/include -I$(top_builddir)/src/include)
|
||||
|
||||
global.bki global.description: genbki.sh $(GLOBAL_BKI_SRCS) $(top_srcdir)/src/include/catalog/indexing.h
|
||||
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o global -I$(top_srcdir)/src/include $(GLOBAL_BKI_SRCS)
|
||||
global.bki global.description: genbki.sh $(GLOBAL_BKI_SRCS) $(top_srcdir)/src/include/catalog/indexing.h \
|
||||
$(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/config.h
|
||||
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o global $(pg_includes) $(GLOBAL_BKI_SRCS)
|
||||
|
||||
template1.bki template1.description: genbki.sh $(TEMPLATE1_BKI_SRCS)
|
||||
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o template1 -I$(top_srcdir)/src/include $(TEMPLATE1_BKI_SRCS)
|
||||
template1.bki template1.description: genbki.sh $(TEMPLATE1_BKI_SRCS) \
|
||||
$(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/config.h
|
||||
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o template1 $(pg_includes) $(TEMPLATE1_BKI_SRCS)
|
||||
|
||||
.PHONY: install-bki
|
||||
install-bki: $(BKIFILES) installdirs
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.16 2000/07/09 13:16:12 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.17 2000/10/20 21:03:42 petere Exp $
|
||||
#
|
||||
# NOTES
|
||||
# non-essential whitespace is removed from the generated file.
|
||||
@@ -25,7 +25,7 @@
|
||||
CMDNAME=`basename $0`
|
||||
|
||||
BKIOPTS=
|
||||
INCLUDE_DIR=
|
||||
INCLUDE_DIRS=
|
||||
OUTPUT_PREFIX=
|
||||
INFILES=
|
||||
|
||||
@@ -42,10 +42,11 @@ do
|
||||
BKIOPTS="$BKIOPTS $1"
|
||||
;;
|
||||
-I)
|
||||
INCLUDE_DIR="$2"
|
||||
INCLUDE_DIRS="$INCLUDE_DIRS $2"
|
||||
shift;;
|
||||
-I*)
|
||||
INCLUDE_DIR=`echo $1 | sed -e 's/^-I//'`
|
||||
arg=`echo $1 | sed -e 's/^-I//'`
|
||||
INCLUDE_DIRS="$INCLUDE_DIRS $arg"
|
||||
;;
|
||||
-o)
|
||||
OUTPUT_PREFIX="$2"
|
||||
@@ -91,7 +92,7 @@ if [ x"$OUTPUT_PREFIX" = x"" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$INCLUDE_DIR" = x"" ] ; then
|
||||
if [ x"$INCLUDE_DIRS" = x"" ] ; then
|
||||
echo "$CMDNAME: path to include directory unknown" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -113,17 +114,27 @@ trap "rm -f $TMPFILE" 0 1 2 3 15
|
||||
|
||||
|
||||
# Get NAMEDATALEN from postgres_ext.h
|
||||
NAMEDATALEN=`grep '#define[ ]*NAMEDATALEN' $INCLUDE_DIR/postgres_ext.h | awk '{ print $3 }'`
|
||||
for dir in $INCLUDE_DIRS; do
|
||||
if [ -f "$dir/postgres_ext.h" ]; then
|
||||
NAMEDATALEN=`grep '#define[ ]*NAMEDATALEN' $dir/postgres_ext.h | $AWK '{ print $3 }'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Get INDEX_MAX_KEYS from config.h (who needs consistency?)
|
||||
INDEXMAXKEYS=`grep '#define[ ]*INDEX_MAX_KEYS' $INCLUDE_DIR/config.h | awk '{ print $3 }'`
|
||||
for dir in $INCLUDE_DIRS; do
|
||||
if [ -f "$dir/config.h" ]; then
|
||||
INDEXMAXKEYS=`grep '#define[ ]*INDEX_MAX_KEYS' $dir/config.h | $AWK '{ print $3 }'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# NOTE: we assume here that FUNC_MAX_ARGS has the same value as INDEX_MAX_KEYS,
|
||||
# and don't read it separately from config.h. This is OK because both of them
|
||||
# must be equal to the length of oidvector.
|
||||
|
||||
INDEXMAXKEYS2=`expr $INDEXMAXKEYS '*' 2`
|
||||
INDEXMAXKEYS4=`expr $INDEXMAXKEYS '*' 4`
|
||||
INDEXMAXKEYS2=`expr $INDEXMAXKEYS '*' 2` || exit
|
||||
INDEXMAXKEYS4=`expr $INDEXMAXKEYS '*' 4` || exit
|
||||
|
||||
# ----------------
|
||||
# strip comments and trash from .h before we generate
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Makefile for parser
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.30 2000/09/12 21:07:00 tgl Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.31 2000/10/20 21:03:44 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -11,7 +11,7 @@ top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
ifeq ($(GCC), yes)
|
||||
CFLAGS+= -Wno-error
|
||||
override CFLAGS+= -Wno-error
|
||||
endif
|
||||
|
||||
OBJS= analyze.o gram.o keywords.o parser.o parse_agg.o parse_clause.o \
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# be converted to Method 2.
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.26 2000/10/09 16:42:53 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.27 2000/10/20 21:03:45 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -46,7 +46,7 @@ beos.dir:
|
||||
$(MAKE) -C beos all
|
||||
|
||||
tas.o: tas.s
|
||||
$(CC) $(CFLAGS) -c tas.s
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
distclean clean:
|
||||
rm -f SUBSYS.o $(OBJS)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Makefile for regex
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.14 2000/08/31 16:10:25 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.15 2000/10/20 21:03:46 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -12,7 +12,7 @@ subdir = src/backend/regex
|
||||
top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
CPPFLAGS += -DPOSIX_MISTAKE
|
||||
override CPPFLAGS += -DPOSIX_MISTAKE
|
||||
|
||||
DEBUGOBJ =
|
||||
|
||||
@@ -28,7 +28,7 @@ SUBSYS.o: $(OBJS)
|
||||
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
|
||||
|
||||
retest: retest.o SUBSYS.o $(DEBUGOBJ)
|
||||
$(CC) $(CFLAGS) -o retest retest.o SUBSYS.o $(DEBUGOBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(CFLAGS) *.c >depend
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile for storage/ipc
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.14 2000/09/29 17:17:33 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.15 2000/10/20 21:03:47 petere Exp $
|
||||
#
|
||||
|
||||
subdir = src/backend/storage/ipc
|
||||
@@ -11,7 +11,7 @@ include $(top_builddir)/src/Makefile.global
|
||||
# seems to be required 1999/07/22 bjm
|
||||
ifeq "$(findstring alpha,$(host_cpu))" "alpha"
|
||||
ifeq "$(GCC)" "yes"
|
||||
CFLAGS+= -fno-inline
|
||||
override CFLAGS+= -fno-inline
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Makefile for tioga
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/tioga/Attic/Makefile,v 1.8 2000/08/31 16:10:41 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/tioga/Attic/Makefile,v 1.9 2000/10/20 21:03:50 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -13,7 +13,7 @@ top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
OBJS = tgRecipe.o Varray.o
|
||||
CPPFLAGS += -I$(srcdir)
|
||||
override CPPFLAGS += -I$(srcdir)
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile for utils/adt
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.47 2000/09/29 17:17:33 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.48 2000/10/20 21:03:52 petere Exp $
|
||||
#
|
||||
|
||||
subdir = src/backend/utils/adt
|
||||
@@ -11,7 +11,7 @@ include $(top_builddir)/src/Makefile.global
|
||||
# seems to be required for some date/time stuff 1999/07/22 bjm
|
||||
ifeq "$(findstring alpha,$(host_cpu))" "alpha"
|
||||
ifeq "$(GCC)" "yes"
|
||||
CFLAGS+= -mieee
|
||||
override CFLAGS+= -mieee
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Makefile for utils/mb
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.11 2000/10/12 06:06:49 ishii Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.12 2000/10/20 21:03:53 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -20,48 +20,22 @@ all: SUBSYS.o
|
||||
SUBSYS.o: $(OBJS)
|
||||
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
|
||||
|
||||
palloc.o: palloc.c
|
||||
$(CC) -c $(CFLAGS) palloc.c
|
||||
|
||||
sjistest.o: sjistest.c
|
||||
$(CC) -c $(CFLAGS) sjistest.c
|
||||
|
||||
liketest.o: liketest.c
|
||||
$(CC) -c $(CFLAGS) liketest.c
|
||||
|
||||
uconv.o: uconv.c
|
||||
$(CC) -c $(CFLAGS) uconv.c
|
||||
|
||||
uconv2.o: uconv2.c
|
||||
$(CC) -c $(CFLAGS) uconv2.c
|
||||
|
||||
utftest.o: utftest.c conv.c wchar.c mbutils.c
|
||||
$(CC) -c $(CFLAGS) utftest.c
|
||||
|
||||
sjistest: $(OBJS) sjistest.o palloc.o
|
||||
$(CC) -o sjistest sjistest.o palloc.o \
|
||||
common.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o \
|
||||
big5.o $(LDFLAGS)
|
||||
sjistest: sjistest.o palloc.o common.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o big5.o
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
liketest: $(OBJS) liketest.o palloc.o
|
||||
$(CC) -o liketest liketest.o palloc.o conv.o \
|
||||
common.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o \
|
||||
big5.o $(LDFLAGS)
|
||||
liketest: liketest.o palloc.o $(OBJS)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
utftest: $(OBJS) utftest.o palloc.o
|
||||
$(CC) -o utftest utftest.o palloc.o \
|
||||
common.o wstrcmp.o wstrncmp.o variable.o \
|
||||
big5.o $(LDFLAGS)
|
||||
utftest: utftest.o palloc.o common.o wstrcmp.o wstrncmp.o variable.o big5.o
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
uconv: uconv.o palloc.o
|
||||
$(CC) -o uconv uconv.o palloc.o \
|
||||
common.o conv.o wchar.o \
|
||||
big5.o mbutils.o $(LDFLAGS)
|
||||
uconv: uconv.o palloc.o common.o conv.o wchar.o big5.o mbutils.o
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
uconv2: uconv2.o palloc.o
|
||||
$(CC) -o uconv2 uconv2.o palloc.o \
|
||||
common.o conv.o wchar.o \
|
||||
big5.o mbutils.o $(LDFLAGS)
|
||||
uconv2: uconv2.o palloc.o common.o conv.o wchar.o big5.o mbutils.o
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(CFLAGS) *.c >depend
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/misc/Makefile,v 1.18 2000/08/28 11:53:20 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/misc/Makefile,v 1.19 2000/10/20 21:03:55 petere Exp $
|
||||
|
||||
subdir = src/backend/utils/misc
|
||||
top_builddir = ../../../..
|
||||
@@ -9,7 +9,7 @@ OBJS = database.o superuser.o guc.o guc-file.o ps_status.o
|
||||
# This location might depend on the installation directories. Therefore
|
||||
# we can't subsitute it into config.h.
|
||||
ifdef krb_srvtab
|
||||
CPPFLAGS += -DPG_KRB_SRVTAB='"$(krb_srvtab)"'
|
||||
override CPPFLAGS += -DPG_KRB_SRVTAB='"$(krb_srvtab)"'
|
||||
endif
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ all: SUBSYS.o
|
||||
SUBSYS.o: $(OBJS)
|
||||
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
|
||||
|
||||
guc-file.c: guc-file.l
|
||||
$(srcdir)/guc-file.c: guc-file.l
|
||||
ifdef FLEX
|
||||
$(FLEX) $(FLEXFLAGS) $<
|
||||
sed -e 's/^yy/GUC_yy/g' -e 's/\([^a-zA-Z0-9_]\)yy/\1GUC_yy/g' lex.yy.c > $@
|
||||
|
||||
Reference in New Issue
Block a user