diff options
Diffstat (limited to 'src/backend/Makefile')
-rw-r--r-- | src/backend/Makefile | 408 |
1 files changed, 217 insertions, 191 deletions
diff --git a/src/backend/Makefile b/src/backend/Makefile index c39363841ba..8ce20d097e4 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -5,188 +5,236 @@ # # Copyright (c) 1994, Regents of the University of California # +# 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. +# # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.9 1996/10/12 07:44:39 bryanh Exp $ +# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.10 1996/10/27 09:45:39 bryanh Exp $ # #------------------------------------------------------------------------- -# -# The following turns on intermediate linking of partial objects to speed -# the link cycle during development. (To turn this off, put "BIGOBJS=false" -# in your custom makefile, ../Makefile.custom.) -BIGOBJS= true - -PROG= postgres global1.bki.source local1_template1.bki.source - -MKDIR= ../mk -include $(MKDIR)/postgres.mk - -include $(CURDIR)/access/Makefile.inc -include $(CURDIR)/bootstrap/Makefile.inc -include $(CURDIR)/catalog/Makefile.inc -include $(CURDIR)/commands/Makefile.inc -include $(CURDIR)/executor/Makefile.inc -include $(CURDIR)/include/Makefile.inc -include $(CURDIR)/lib/Makefile.inc -include $(CURDIR)/libpq/Makefile.inc -include $(CURDIR)/main/Makefile.inc -include $(CURDIR)/nodes/Makefile.inc -include $(CURDIR)/optimizer/Makefile.inc -include $(CURDIR)/parser/Makefile.inc -include $(CURDIR)/port/Makefile.inc -include $(CURDIR)/postmaster/Makefile.inc -include $(CURDIR)/regex/Makefile.inc -include $(CURDIR)/rewrite/Makefile.inc -include $(CURDIR)/storage/Makefile.inc -include $(CURDIR)/tcop/Makefile.inc -include $(CURDIR)/tioga/Makefile.inc -include $(CURDIR)/utils/Makefile.inc - -SRCS:= ${SRCS_ACCESS} ${SRCS_BOOTSTRAP} $(SRCS_CATALOG) ${SRCS_COMMANDS} \ - ${SRCS_EXECUTOR} $(SRCS_LIB) $(SRCS_LIBPQ) ${SRCS_MAIN} \ - ${SRCS_NODES} ${SRCS_OPTIMIZER} ${SRCS_PARSER} ${SRCS_PORT} \ - $(SRCS_POSTMASTER) ${SRCS_REGEX} ${SRCS_REWRITE} ${SRCS_STORAGE} \ - ${SRCS_TCOP} ${SRCS_UTILS} - -ifeq ($(BIGOBJS), true) -OBJS= ACCESS.o BOOTSTRAP.o COMMANDS.o EXECUTOR.o MAIN.o MISC.o NODES.o \ - PARSER.o OPTIMIZER.o REGEX.o REWRITE.o STORAGE.o TCOP.o UTILS.o -CLEANFILES+= $(subst .s,.o,$(SRCS:.c=.o)) $(OBJS) -else -OBJS:= $(subst .s,.o,$(SRCS:%.c=$(objdir)/%.o)) -CLEANFILES+= $(notdir $(OBJS)) -endif +SRCDIR = .. +include ../Makefile.global -############################################################################# -# -# TIOGA stuff +########################################################################## +# Determine linker flags for this platform (mainly, the libraries with +# which to link). +########################################################################## + +# All systems except NEXTSTEP require the math library. +# Loader flags for system-dependent libraries are appended in +# src/backend/port/$(PORTNAME)/Makefile.inc # -ifdef TIOGA -SRCS+= $(SRCS_TIOGA) - ifeq ($(BIGOBJS), true) -TIOGA.o: $(SRCS_TIOGA:%.c=$(objdir)/%.o) - $(make_partial) -OBJS+= TIOGA.o -CLEANFILES+= $(SRCS_TIOGA:%.c=%.o) TIOGA.o - else -OBJS+= $(SRCS_TIOGA:%.c=$(objdir)/%.o) - endif +ifneq ($(PORTNAME), next) +LDADD+= -lm endif +ifeq ($(PORTNAME), aix) +LDADD+= -ll -lld +endif -############################################################################# -# -# Compiling the postgres backend. -# -CFLAGS+= -DPOSTGRESDIR='"$(POSTGRESDIR)"' \ - -DPGDATADIR='"$(DATADIR)"' \ - -I$(CURDIR)/$(objdir) \ - -I$(CURDIR)/include \ - -I$(CURDIR)/port/$(PORTNAME) \ - -I../include - -# turn this on if you prefer European style dates instead of American -# style dates -ifdef EUROPEAN_DATES -CFLAGS += -DEUROPEAN_STYLE +ifeq ($(PORTNAME), alpha) +LDADD+= -lln endif -# host based access flags -ifdef HBA -CFLAGS+= $(HBAFLAGS) +ifeq ($(PORTNAME), bsdi) +LDADD+= -ldld -lipc endif - -# -# All systems except NEXTSTEP require the math library. -# Loader flags for system-dependent libraries are appended in -# src/backend/port/$(PORTNAME)/Makefile.inc + +ifeq ($(PORTNAME), bsdi_2_1) +LDADD+= -ldl -lipc +endif + +ifeq ($(PORTNAME), hpux) +# HP-UX needs: +# -W l,-E export symbols for linking with the shared libraries +# dynamic loader +# -W p,-H400000 expand cpp #define table size so the Nodes files don't +# break it # -ifneq ($(PORTNAME), next) -LDADD+= -lm +# -W p,-H400000 +ifeq ($(CC), cc) +CFLAGS+= -W l,-E +LDFLAGS+= -W l,-E +LDADD+= -ll -ldld +else +ifeq ($(CC), gcc) +LDADD+= -ll /usr/lib/libdld.sl +endif +endif endif -# kerberos flags -ifdef KRBVERS -CFLAGS+= $(KRBFLAGS) -LDADD+= $(KRBLIBS) +ifeq ($(PORTNAME), i386_solaris) +LDADD+= -ll -ldl +endif + +ifeq ($(PORTNAME), irix5) +LDADD+= -ll endif -# statically link in libc for linux ifeq ($(PORTNAME), linux) -LDADD+= -lc +ifdef LINUX_ELF +LDADD+= -ldl +else +LDADD+= -ldld +endif +endif + +ifeq ($(PORTNAME), sparc) +LDADD+= -lln -ldl +endif + +ifeq ($(PORTNAME), sparc_solaris) +LDADD+= -ll -ldl endif -# the following is special for Reliant UNIX SVR4 (formerly SINIX) ifeq ($(PORTNAME), svr4) +LDADD+= -ll -ldl +# the following is special for Reliant UNIX SVR4 (formerly SINIX) LDFLAGS+= -LD-Blargedynsym endif -postgres: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS) - $(CC) $(LDFLAGS) -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD) +ifeq ($(PORTNAME), ultrix4) +LDADD+= -ldl -lln +endif + +############################################################################# + +OBJS = access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o \ + commands/SUBSYS.o executor/SUBSYS.o \ + lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o nodes/SUBSYS.o \ + optimizer/SUBSYS.o parser/SUBSYS.o port/SUBSYS.o \ + postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o \ + storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o + +ifdef TIOGA +OBJS += tioga/SUBSYS.o +endif + +all: postgres global1.bki.source local1_template1.bki.source + +postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4 + $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD) + +postgres_group1: + $(MAKE) -C access SUBSYS.o + $(MAKE) -C bootstrap SUBSYS.o + $(MAKE) -C catalog SUBSYS.o + $(MAKE) -C commands SUBSYS.o +postgres_group2: + $(MAKE) -C executor SUBSYS.o + $(MAKE) -C lib SUBSYS.o + $(MAKE) -C libpq SUBSYS.o + $(MAKE) -C main SUBSYS.o + $(MAKE) -C nodes SUBSYS.o +postgres_group3: + $(MAKE) -C optimizer SUBSYS.o + $(MAKE) -C parser SUBSYS.o + $(MAKE) -C port SUBSYS.o PORTNAME=$(PORTNAME) + $(MAKE) -C postmaster SUBSYS.o + $(MAKE) -C regex SUBSYS.o +postgres_group4: + $(MAKE) -C rewrite SUBSYS.o + $(MAKE) -C storage SUBSYS.o + $(MAKE) -C tcop SUBSYS.o + $(MAKE) -C utils SUBSYS.o +ifdef TIOGA + $(MAKE) -C tioga SUBSYS.o +endif + +global1.bki.source local1_template1.bki.source: + $(MAKE) -C catalog $@ + cp catalog/$@ . + + +############################################################################ +# The following targets are specified in make commands that appear in the +# make files in our subdirectories. -# Make this target first if you are doing a parallel make. -# The targets in 'first' need to be made sequentially because of dependencies. -# Then, you can make 'all' with parallelism turned on. -first: $(POSTGRES_DEPEND) +parse.h: + $(MAKE) -C parser parse.h + cp parser/parse.h . +fmgr.h: + $(MAKE) -C utils fmgr.h + cp utils/fmgr.h . ############################################################################# -# -# Partial objects for platforms with slow linkers. -# -ifeq ($(BIGOBJS), true) - -OBJS_ACCESS:= $(SRCS_ACCESS:%.c=$(objdir)/%.o) -OBJS_BOOTSTRAP:= $(SRCS_BOOTSTRAP:%.c=$(objdir)/%.o) -OBJS_CATALOG:= $(SRCS_CATALOG:%.c=$(objdir)/%.o) -OBJS_COMMANDS:= $(SRCS_COMMANDS:%.c=$(objdir)/%.o) -OBJS_EXECUTOR:= $(SRCS_EXECUTOR:%.c=$(objdir)/%.o) -OBJS_MAIN:= $(SRCS_MAIN:%.c=$(objdir)/%.o) -OBJS_POSTMASTER:= $(SRCS_POSTMASTER:%.c=$(objdir)/%.o) -OBJS_LIB:= $(SRCS_LIB:%.c=$(objdir)/%.o) -OBJS_LIBPQ:= $(SRCS_LIBPQ:%.c=$(objdir)/%.o) -OBJS_PORT:= $(addprefix $(objdir)/,$(subst .s,.o,$(SRCS_PORT:.c=.o))) -OBJS_NODES:= $(SRCS_NODES:%.c=$(objdir)/%.o) -OBJS_PARSER:= $(SRCS_PARSER:%.c=$(objdir)/%.o) -OBJS_OPTIMIZER:= $(SRCS_OPTIMIZER:%.c=$(objdir)/%.o) -OBJS_REGEX:= $(SRCS_REGEX:%.c=$(objdir)/%.o) -OBJS_REWRITE:= $(SRCS_REWRITE:%.c=$(objdir)/%.o) -OBJS_STORAGE:= $(SRCS_STORAGE:%.c=$(objdir)/%.o) -OBJS_TCOP:= $(SRCS_TCOP:%.c=$(objdir)/%.o) -OBJS_UTILS:= $(SRCS_UTILS:%.c=$(objdir)/%.o) - -ACCESS.o: $(OBJS_ACCESS) - $(make_partial) -BOOTSTRAP.o: $(OBJS_BOOTSTRAP) - $(make_partial) -COMMANDS.o: $(OBJS_COMMANDS) - $(make_partial) -EXECUTOR.o: $(OBJS_EXECUTOR) - $(make_partial) -MAIN.o: $(OBJS_MAIN) $(OBJS_POSTMASTER) - $(make_partial) -MISC.o: $(OBJS_CATALOG) $(OBJS_LIB) $(OBJS_LIBPQ) $(OBJS_PORT) - $(make_partial) -NODES.o: $(OBJS_NODES) - $(make_partial) -PARSER.o: $(OBJS_PARSER) - $(make_partial) -OPTIMIZER.o: $(OBJS_OPTIMIZER) - $(make_partial) -REGEX.o: $(OBJS_REGEX) - $(make_partial) -REWRITE.o: $(OBJS_REWRITE) - $(make_partial) -STORAGE.o: $(OBJS_STORAGE) - $(make_partial) -TCOP.o: $(OBJS_TCOP) - $(make_partial) -UTILS.o: $(OBJS_UTILS) - $(make_partial) +clean: + rm -f postgres fmgr.h parse.h \ + global1.bki.source local1_template1.bki.source + $(MAKE) -C access clean + $(MAKE) -C bootstrap clean + $(MAKE) -C catalog clean + $(MAKE) -C commands clean + $(MAKE) -C executor clean + $(MAKE) -C lib clean + $(MAKE) -C libpq clean + $(MAKE) -C main clean + $(MAKE) -C nodes clean + $(MAKE) -C optimizer clean + $(MAKE) -C parser clean + $(MAKE) -C port clean PORTNAME=$(PORTNAME) + $(MAKE) -C postmaster clean + $(MAKE) -C regex clean + $(MAKE) -C rewrite clean + $(MAKE) -C storage clean + $(MAKE) -C tcop clean + $(MAKE) -C utils clean +ifdef TIOGA + $(MAKE) -C tioga clean +endif + +.DEFAULT: + $(MAKE) -C access $@ + $(MAKE) -C bootstrap $@ + $(MAKE) -C catalog $@ + $(MAKE) -C commands $@ + $(MAKE) -C executor $@ + $(MAKE) -C lib $@ + $(MAKE) -C libpq $@ + $(MAKE) -C main $@ + $(MAKE) -C nodes $@ + $(MAKE) -C optimizer $@ + $(MAKE) -C parser $@ + $(MAKE) -C port $@ PORTNAME=$(PORTNAME) + $(MAKE) -C postmaster $@ + $(MAKE) -C regex $@ + $(MAKE) -C rewrite $@ + $(MAKE) -C storage $@ + $(MAKE) -C tcop $@ + $(MAKE) -C utils $@ +ifdef TIOGA + $(MAKE) -C tioga $@ endif + ############################################################################# # # Installation. @@ -203,33 +251,26 @@ endif # and (2) the parameters of a database system should be set at initdb time, # not at postgres build time. -install: beforeinstall postgres fmgr.h\ +D_LIBDIR = $(DESTDIR)$(LIBDIR) +D_BINDIR = $(DESTDIR)$(BINDIR) + +install: $(D_LIBDIR) $(D_BINDIR) $(HEADERDIR) postgres fmgr.h\ global1.bki.source local1_template1.bki.source \ libpq/pg_hba.conf.sample - $(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/postgres \ - $(DESTDIR)$(BINDIR)/postgres - @rm -f $(DESTDIR)$(BINDIR)/postmaster - cd $(DESTDIR)$(BINDIR); ln -s postgres postmaster - $(INSTALL) $(INSTLOPTS) $(objdir)/fmgr.h $(HEADERDIR)/fmgr.h - $(INSTALL) $(INSTLOPTS) $(objdir)/global1.bki.source \ - $(DESTDIR)$(LIBDIR)/global1.bki.source - $(INSTALL) $(INSTLOPTS) $(objdir)/local1_template1.bki.source \ - $(DESTDIR)$(LIBDIR)/local1_template1.bki.source + $(INSTALL) $(INSTL_EXE_OPTS) postgres $(D_BINDIR)/postgres + @rm -f $(D_BINDIR)/postmaster + cd $(D_BINDIR); ln -s postgres postmaster + $(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h + $(INSTALL) $(INSTLOPTS) global1.bki.source \ + $(D_LIBDIR)/global1.bki.source + $(INSTALL) $(INSTLOPTS) local1_template1.bki.source \ + $(D_LIBDIR)/local1_template1.bki.source $(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \ - $(DESTDIR)$(LIBDIR)/pg_hba.conf.sample - -# so we can get the UID of the postgres owner (w/o moving pg_id to -# src/tools). We just want the vanilla LDFLAGS for pg_id -IDLDFLAGS:= $(LDFLAGS) -ifeq ($(PORTNAME), hpux) -ifeq ($(CC), cc) -IDLDFLAGS+= -Aa -D_HPUX_SOURCE -endif -endif - -CLEANFILES+= postgres pg_id fmgr.h + $(D_LIBDIR)/pg_hba.conf.sample +$(D_BINDIR) $(D_LIBDIR) $(HEADERDIR): + mkdir $@ ############################################################################# # @@ -242,30 +283,15 @@ CLEANFILES+= postgres pg_id fmgr.h IDFILE= ID .PHONY: $(IDFILE) $(IDFILE): - $(CURDIR)/makeID $(PORTNAME) + ./makeID $(PORTNAME) # # 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 -# bmake foo.C +# make foo.C # %.cpp: %.c - $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' > $(objdir)/$(@F) - -cppall: $(SRCS:.c=.cpp) - -# -# To use Purify (SunOS only), define PURIFY to be the path (and -# options) with which to invoke the Purify loader. Only the executable -# needs to be loaded with Purify. -# -# PURIFY = /usr/sww/bin/purify -cache-dir=/usr/local/postgres/src/backend/purify-cache -#.if defined(PURIFY) -#${PROG}: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS) -# ${PURIFY} ${CC} ${LDFLAGS} -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD) -# -#CLEANFILES+= .purify* .pure .lock.*.o *_pure_*.o *.pure_*link* -#.endif - + $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \ + > $(@F) |