1996-07-09 08:22:35 +02:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Makefile--
|
1996-09-21 08:27:11 +02:00
|
|
|
# Makefile for the postgres backend (and the postmaster)
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
|
|
|
# Copyright (c) 1994, Regents of the University of California
|
|
|
|
#
|
1996-10-27 10:55:05 +01:00
|
|
|
# Functional notes:
|
|
|
|
#
|
|
|
|
# Parallel make:
|
|
|
|
#
|
|
|
|
# This make file is set up so that you can do a parallel make (with
|
|
|
|
# the --jobs option of make) and make multiple subdirectories at
|
|
|
|
# once.
|
|
|
|
#
|
|
|
|
# However, the subdirectory make files are not so careful.
|
|
|
|
# Normally, the --jobs option would get passed down to those
|
|
|
|
# subdirectory makes, like any other make option, and they would
|
|
|
|
# fail. But there's a trick: Put a value (max number of
|
|
|
|
# processes) on the --jobs option, e.g. --jobs=4. Now, due to a
|
|
|
|
# special feature of make, the --jobs option will not get passed
|
|
|
|
# to the subdirectory makes. (make does this because if you only
|
|
|
|
# want 4 tasks running, then splitting the subdirectory makes into
|
|
|
|
# multiple tasks would violate your wishes).
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Implementation notes:
|
|
|
|
#
|
|
|
|
# We don't use $(LD) for linking. We use $(CC) instead. This is because
|
|
|
|
# the $(CC) program apparently can do linking too, and it has certain
|
|
|
|
# thinks like default options and search paths for libraries set up for
|
|
|
|
# it that the more primitive $(LD) doesn't have.
|
|
|
|
#
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
|
|
|
# IDENTIFICATION
|
2000-03-08 02:58:46 +01:00
|
|
|
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.44 2000/03/08 01:58:16 momjian Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
1996-10-27 10:55:05 +01:00
|
|
|
SRCDIR = ..
|
2000-02-27 02:26:12 +01:00
|
|
|
include $(SRCDIR)/Makefile.global
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1997-03-12 21:44:57 +01:00
|
|
|
DIRS = access bootstrap catalog commands executor lib libpq \
|
1999-02-23 08:24:08 +01:00
|
|
|
main parser nodes optimizer port postmaster regex rewrite \
|
1997-03-12 21:44:57 +01:00
|
|
|
storage tcop utils
|
1996-10-27 10:55:05 +01:00
|
|
|
|
|
|
|
ifdef TIOGA
|
1997-03-12 21:44:57 +01:00
|
|
|
DIRS += tioga
|
1996-10-27 10:55:05 +01:00
|
|
|
endif
|
|
|
|
|
1997-03-12 21:44:57 +01:00
|
|
|
OBJS = $(DIRS:%=%/SUBSYS.o)
|
1999-12-16 02:25:23 +01:00
|
|
|
ifeq ($(PORTNAME), qnx4)
|
|
|
|
# This file chrashes wlink and is therefore not in bootstrap/SUBSYS.o.
|
|
|
|
OBJS1 = bootstrap/bootstrap.o
|
|
|
|
endif
|
1997-03-12 21:44:57 +01:00
|
|
|
|
2000-02-27 02:26:12 +01:00
|
|
|
VERSIONOBJ = $(SRCDIR)/utils/version.o
|
|
|
|
|
1998-01-04 20:13:04 +01:00
|
|
|
# kerberos flags
|
|
|
|
|
|
|
|
ifdef KRBVERS
|
|
|
|
CFLAGS+= $(KRBFLAGS)
|
|
|
|
LDFLAGS+= $(KRBLIBS)
|
|
|
|
endif
|
|
|
|
|
1999-01-17 07:20:06 +01:00
|
|
|
ifeq ($(MAKE_DLL), true)
|
2000-02-27 02:26:12 +01:00
|
|
|
DLLOBJS= $(OBJS) $(VERSIONOBJ)
|
1999-01-17 07:20:06 +01:00
|
|
|
DLLLIBS= -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
|
|
|
|
|
|
|
|
postgres.def: $(DLLOBJS)
|
|
|
|
$(DLLTOOL) --export-all --output-def $@ $(DLLOBJS)
|
|
|
|
|
2000-02-27 02:26:12 +01:00
|
|
|
libpostgres.a: $(DLLOBJS) $(SRCDIR)/utils/dllinit.o postgres.def
|
1999-01-17 07:20:06 +01:00
|
|
|
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
|
|
|
|
endif
|
1998-01-04 20:13:04 +01:00
|
|
|
|
1997-11-13 04:23:18 +01:00
|
|
|
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source \
|
|
|
|
global1.description local1_template1.description
|
1996-10-27 10:55:05 +01:00
|
|
|
|
1999-01-17 07:20:06 +01:00
|
|
|
ifneq ($(PORTNAME), win)
|
2000-02-27 02:26:12 +01:00
|
|
|
postgres: fmgr.h $(OBJS) $(VERSIONOBJ)
|
|
|
|
$(CC) -o postgres $(OBJS) $(OBJS1) $(VERSIONOBJ) $(LDFLAGS)
|
1999-01-17 07:20:06 +01:00
|
|
|
else
|
2000-02-27 02:26:12 +01:00
|
|
|
postgres: $(DLLOBJS) $(SRCDIR)/utils/dllinit.o postgres.def libpostgres.a
|
1999-01-17 07:20:06 +01:00
|
|
|
dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
|
|
|
|
gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(DLLOBJS) $(DLLLIBS)
|
|
|
|
dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
|
|
|
|
gcc -g -o $@$(X) $@.exp $(DLLOBJS) $(DLLLIBS)
|
|
|
|
rm $@.exp $@.base
|
|
|
|
endif
|
|
|
|
|
|
|
|
#.PHONY: postgres
|
1997-03-12 21:44:57 +01:00
|
|
|
|
|
|
|
$(OBJS): $(DIRS:%=%.dir)
|
|
|
|
|
|
|
|
$(DIRS:%=%.dir):
|
1997-12-17 05:59:16 +01:00
|
|
|
$(MAKE) -C $(subst .dir,,$@) all
|
1997-03-12 21:44:57 +01:00
|
|
|
|
2000-02-27 02:26:12 +01:00
|
|
|
$(VERSIONOBJ): $(SRCDIR)/utils/version.c $(SRCDIR)/include/version.h
|
|
|
|
$(MAKE) -C $(SRCDIR)/utils version.o
|
1999-01-17 07:20:06 +01:00
|
|
|
|
2000-02-27 02:26:12 +01:00
|
|
|
$(SRCDIR)/utils/dllinit.o: $(SRCDIR)/utils/dllinit.c
|
|
|
|
$(MAKE) -C $(SRCDIR)/utils dllinit.o
|
1996-10-27 10:55:05 +01:00
|
|
|
|
1997-11-13 04:23:18 +01:00
|
|
|
global1.bki.source local1_template1.bki.source \
|
|
|
|
global1.description local1_template1.description: catalog/$@
|
1996-11-03 10:05:30 +01:00
|
|
|
cp catalog/$@ .
|
1996-10-27 10:55:05 +01:00
|
|
|
|
1997-11-13 04:23:18 +01:00
|
|
|
catalog/global1.bki.source catalog/local1_template1.bki.source \
|
|
|
|
catalog/global1.description catalog/local1_template1.description:
|
1997-03-12 21:44:57 +01:00
|
|
|
$(MAKE) -C catalog $@
|
|
|
|
|
1996-11-23 10:51:57 +01:00
|
|
|
# The postgres.o target is needed by the rule in Makefile.global that
|
|
|
|
# creates the exports file when MAKE_EXPORTS = true.
|
|
|
|
postgres.o: $(OBJS)
|
1999-12-16 02:25:23 +01:00
|
|
|
$(CC) $(LDREL) $(LDOUT) postgres.o $(OBJS) $(OBJS1) $(LDFLAGS)
|
1996-11-23 10:51:57 +01:00
|
|
|
|
1996-10-27 10:55:05 +01:00
|
|
|
############################################################################
|
|
|
|
# The following targets are specified in make commands that appear in the
|
|
|
|
# make files in our subdirectories.
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1999-02-23 08:24:08 +01:00
|
|
|
parse.h: parser/parse.h
|
1996-11-03 10:05:30 +01:00
|
|
|
cp parser/parse.h .
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1999-11-14 18:12:42 +01:00
|
|
|
parser/parse.h:
|
|
|
|
$(MAKE) -C parser parse.h
|
|
|
|
|
|
|
|
fmgr.h: utils/fmgr.h
|
1996-11-03 10:05:30 +01:00
|
|
|
cp utils/fmgr.h .
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1999-11-14 18:12:42 +01:00
|
|
|
utils/fmgr.h:
|
|
|
|
$(MAKE) -C utils fmgr.h
|
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
#############################################################################
|
1996-10-27 10:55:05 +01:00
|
|
|
clean:
|
1999-01-17 07:20:06 +01:00
|
|
|
rm -f postgres$(X) $(POSTGRES_IMP) fmgr.h parse.h \
|
1997-11-13 04:23:18 +01:00
|
|
|
global1.bki.source local1_template1.bki.source \
|
|
|
|
global1.description local1_template1.description
|
1999-01-17 07:20:06 +01:00
|
|
|
ifeq ($(PORTNAME), win)
|
|
|
|
ifeq ($(MAKE_DLL), true)
|
|
|
|
rm -f postgres.dll postgres.def libpostgres.a
|
|
|
|
endif
|
|
|
|
endif
|
1997-12-17 05:59:16 +01:00
|
|
|
for i in $(DIRS); do $(MAKE) -C $$i clean; done
|
1996-10-27 10:55:05 +01:00
|
|
|
|
|
|
|
.DEFAULT:
|
1997-12-17 05:59:16 +01:00
|
|
|
for i in $(DIRS); do $(MAKE) -C $$i $@; done
|
1996-10-27 10:55:05 +01:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
#############################################################################
|
|
|
|
#
|
|
|
|
# Installation.
|
|
|
|
#
|
1996-09-23 10:24:13 +02:00
|
|
|
# Install the backend program (postgres) to the binary directory and
|
1999-03-08 00:05:57 +01:00
|
|
|
# make a link as "postmaster". Install the bki files, templates, and sample
|
|
|
|
# files to the library directory. Install exported headers to the include
|
|
|
|
# directory (these headers are the minimal ones needed to build loadable
|
|
|
|
# backend extensions).
|
1996-09-23 10:24:13 +02:00
|
|
|
#
|
|
|
|
# (History: Before Release 2, make install generated a bki.source file
|
|
|
|
# and then used build parameters to convert it to a bki file, then installed
|
|
|
|
# that bki file in the /files subdirectory of the default data directory.
|
|
|
|
# Initdb then used the bki file to generate the database catalog classes.
|
|
|
|
# That had to change because (1) there can be more than one database system,
|
|
|
|
# and (2) the parameters of a database system should be set at initdb time,
|
|
|
|
# not at postgres build time.
|
|
|
|
|
2000-03-08 02:58:46 +01:00
|
|
|
.PHONY: install install-bin install-templates install-headers
|
1999-03-08 00:05:57 +01:00
|
|
|
|
2000-03-08 02:58:46 +01:00
|
|
|
install: $(LIBDIR) $(BINDIR) $(HEADERDIR) $(TEMPLATEDIR) \
|
|
|
|
postgres $(POSTGRES_IMP) \
|
|
|
|
install-bin install-templates install-headers
|
1999-03-08 00:05:57 +01:00
|
|
|
|
|
|
|
install-bin: $(BINDIR) postgres$(X) $(POSTGRES_IMP)
|
1999-01-17 07:20:06 +01:00
|
|
|
$(INSTALL) $(INSTL_EXE_OPTS) postgres$(X) $(BINDIR)/postgres$(X)
|
1999-03-08 00:05:57 +01:00
|
|
|
@rm -f $(BINDIR)/postmaster
|
|
|
|
ln -s postgres$(X) $(BINDIR)/postmaster
|
1996-11-23 10:51:57 +01:00
|
|
|
ifeq ($(MAKE_EXPORTS), true)
|
1998-04-06 18:53:15 +02:00
|
|
|
$(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
|
1996-11-23 10:51:57 +01:00
|
|
|
endif
|
1999-01-17 07:20:06 +01:00
|
|
|
ifeq ($(PORTNAME), win)
|
|
|
|
ifeq ($(MAKE_DLL), true)
|
|
|
|
# $(INSTALL) $(INSTLOPTS) postgres.dll $(BINDIR)/postgres.dll
|
|
|
|
$(INSTALL) $(INSTLOPTS) libpostgres.a $(LIBDIR)/libpostgres.a
|
|
|
|
endif
|
|
|
|
endif
|
1999-03-08 00:05:57 +01:00
|
|
|
|
2000-03-08 02:58:46 +01:00
|
|
|
install-templates: $(TEMPLATEDIR) \
|
1999-03-08 00:05:57 +01:00
|
|
|
global1.bki.source local1_template1.bki.source \
|
|
|
|
global1.description local1_template1.description \
|
|
|
|
libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
|
1996-10-27 10:55:05 +01:00
|
|
|
$(INSTALL) $(INSTLOPTS) global1.bki.source \
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR)/global1.bki.source
|
1997-11-13 04:23:18 +01:00
|
|
|
$(INSTALL) $(INSTLOPTS) global1.description \
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR)/global1.description
|
1996-10-27 10:55:05 +01:00
|
|
|
$(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR)/local1_template1.bki.source
|
1997-11-13 04:23:18 +01:00
|
|
|
$(INSTALL) $(INSTLOPTS) local1_template1.description \
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR)/local1_template1.description
|
1996-10-12 09:44:39 +02:00
|
|
|
$(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR)/pg_hba.conf.sample
|
1997-02-19 14:09:34 +01:00
|
|
|
$(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR)/pg_geqo.sample
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1999-03-08 00:05:57 +01:00
|
|
|
install-headers: fmgr.h $(SRCDIR)/include/config.h
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
|
|
|
|
-@if [ ! -d $(HEADERDIR)/port ]; then mkdir $(HEADERDIR)/port; fi
|
|
|
|
-@if [ ! -d $(HEADERDIR)/port/$(PORTNAME) ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/port/$(PORTNAME); fi
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR)/lib ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/lib; fi
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR)/libpq ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/libpq; fi
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR)/utils ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/utils; fi
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR)/access ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/access; fi
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR)/executor ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/executor; fi
|
1999-12-16 02:25:23 +01:00
|
|
|
-@if [ ! -d $(HEADERDIR)/commands ]; \
|
1999-03-08 00:05:57 +01:00
|
|
|
then mkdir $(HEADERDIR)/commands; fi
|
|
|
|
$(INSTALL) $(INSTLOPTS) fmgr.h \
|
|
|
|
$(HEADERDIR)/fmgr.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/os.h \
|
|
|
|
$(HEADERDIR)/os.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/config.h \
|
|
|
|
$(HEADERDIR)/config.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/c.h \
|
|
|
|
$(HEADERDIR)/c.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/postgres.h \
|
|
|
|
$(HEADERDIR)/postgres.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/postgres_ext.h \
|
|
|
|
$(HEADERDIR)/postgres_ext.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/libpq/pqcomm.h \
|
|
|
|
$(HEADERDIR)/libpq/pqcomm.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/libpq/libpq-fs.h \
|
|
|
|
$(HEADERDIR)/libpq/libpq-fs.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/lib/dllist.h \
|
|
|
|
$(HEADERDIR)/lib/dllist.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/geo_decls.h \
|
|
|
|
$(HEADERDIR)/utils/geo_decls.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/elog.h \
|
|
|
|
$(HEADERDIR)/utils/elog.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/palloc.h \
|
|
|
|
$(HEADERDIR)/utils/palloc.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/mcxt.h \
|
|
|
|
$(HEADERDIR)/utils/mcxt.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/access/attnum.h \
|
|
|
|
$(HEADERDIR)/access/attnum.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/executor/spi.h \
|
|
|
|
$(HEADERDIR)/executor/spi.h
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/commands/trigger.h \
|
|
|
|
$(HEADERDIR)/commands/trigger.h
|
|
|
|
ifeq ($(PORTNAME), hpux)
|
|
|
|
# is this still necessary?
|
|
|
|
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/backend/port/hpux/fixade.h \
|
|
|
|
$(HEADERDIR)/port/hpux/fixade.h
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
1999-01-17 07:20:06 +01:00
|
|
|
$(BINDIR):
|
|
|
|
mkdir $@
|
|
|
|
$(LIBDIR):
|
|
|
|
mkdir $@
|
|
|
|
$(HEADERDIR):
|
1996-10-27 10:55:05 +01:00
|
|
|
mkdir $@
|
2000-03-08 02:58:46 +01:00
|
|
|
$(TEMPLATEDIR):
|
|
|
|
mkdir $@
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
#
|
|
|
|
# Support for code development.
|
|
|
|
#
|
1996-11-03 10:05:30 +01:00
|
|
|
# Use target "quick" to build "postgres" when you know all the subsystems
|
|
|
|
# are up to date. It saves the time of doing all the submakes.
|
|
|
|
.PHONY: quick
|
|
|
|
quick: $(OBJS)
|
1999-12-16 02:25:23 +01:00
|
|
|
$(CC) -o postgres $(OBJS) $(OBJS1) $(LDFLAGS)
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
|
|
|
|
#
|
|
|
|
IDFILE= ID
|
|
|
|
.PHONY: $(IDFILE)
|
|
|
|
$(IDFILE):
|
1997-12-20 01:29:35 +01:00
|
|
|
./makeID
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Special rule to generate cpp'd version of a .c file. This is
|
|
|
|
# especially useful given all the hellish macro processing going on.
|
|
|
|
# The cpp'd version has a .C suffix. To create foo.C from foo.c, just
|
|
|
|
# type
|
1996-10-27 10:55:05 +01:00
|
|
|
# make foo.C
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
|
|
|
%.cpp: %.c
|
1996-10-27 10:55:05 +01:00
|
|
|
$(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \
|
|
|
|
> $(@F)
|