1 #-------------------------------------------------------------------------
4 # Makefile for the postgres backend (and the postmaster)
6 # Copyright (c) 1994, Regents of the University of California
10 # $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.7 1996/09/23 08:21:52 scrappy Exp $
12 #-------------------------------------------------------------------------
15 # The following turns on intermediate linking of partial objects to speed
16 # the link cycle during development. (To turn this off, put "BIGOBJS=false"
17 # in your custom makefile, ../Makefile.custom.)
20 PROG= postgres global1.bki.source local1_template1.bki.source
23 include $(MKDIR)/postgres.mk
25 include $(CURDIR)/access/Makefile.inc
26 include $(CURDIR)/bootstrap/Makefile.inc
27 include $(CURDIR)/catalog/Makefile.inc
28 include $(CURDIR)/commands/Makefile.inc
29 include $(CURDIR)/executor/Makefile.inc
30 include $(CURDIR)/include/Makefile.inc
31 include $(CURDIR)/lib/Makefile.inc
32 include $(CURDIR)/libpq/Makefile.inc
33 include $(CURDIR)/main/Makefile.inc
34 include $(CURDIR)/nodes/Makefile.inc
35 include $(CURDIR)/optimizer/Makefile.inc
36 include $(CURDIR)/parser/Makefile.inc
37 include $(CURDIR)/port/Makefile.inc
38 include $(CURDIR)/postmaster/Makefile.inc
39 include $(CURDIR)/regex/Makefile.inc
40 include $(CURDIR)/rewrite/Makefile.inc
41 include $(CURDIR)/storage/Makefile.inc
42 include $(CURDIR)/tcop/Makefile.inc
43 include $(CURDIR)/tioga/Makefile.inc
44 include $(CURDIR)/utils/Makefile.inc
46 SRCS:= ${SRCS_ACCESS} ${SRCS_BOOTSTRAP} $(SRCS_CATALOG) ${SRCS_COMMANDS} \
47 ${SRCS_EXECUTOR} $(SRCS_LIB) $(SRCS_LIBPQ) ${SRCS_MAIN} \
48 ${SRCS_NODES} ${SRCS_OPTIMIZER} ${SRCS_PARSER} ${SRCS_PORT} \
49 $(SRCS_POSTMASTER) ${SRCS_REGEX} ${SRCS_REWRITE} ${SRCS_STORAGE} \
50 ${SRCS_TCOP} ${SRCS_UTILS}
52 ifeq ($(BIGOBJS), true)
53 OBJS= ACCESS.o BOOTSTRAP.o COMMANDS.o EXECUTOR.o MAIN.o MISC.o NODES.o \
54 PARSER.o OPTIMIZER.o REGEX.o REWRITE.o STORAGE.o TCOP.o UTILS.o
55 CLEANFILES+= $(subst .s,.o,$(SRCS:.c=.o)) $(OBJS)
57 OBJS:= $(subst .s,.o,$(SRCS:%.c=$(objdir)/%.o))
58 CLEANFILES+= $(notdir $(OBJS))
62 #############################################################################
68 ifeq ($(BIGOBJS), true)
69 TIOGA.o: $(SRCS_TIOGA:%.c=$(objdir)/%.o)
72 CLEANFILES+= $(SRCS_TIOGA:%.c=%.o) TIOGA.o
74 OBJS+= $(SRCS_TIOGA:%.c=$(objdir)/%.o)
79 #############################################################################
81 # Compiling the postgres backend.
83 CFLAGS+= -DPOSTGRESDIR='"$(POSTGRESDIR)"' \
84 -DPGDATADIR='"$(DATADIR)"' \
85 -I$(CURDIR)/$(objdir) \
87 -I$(CURDIR)/port/$(PORTNAME) \
90 # turn this on if you prefer European style dates instead of American
93 CFLAGS += -DEUROPEAN_STYLE
96 # host based access flags
102 # All systems except NEXTSTEP require the math library.
103 # Loader flags for system-dependent libraries are appended in
104 # src/backend/port/$(PORTNAME)/Makefile.inc
106 ifneq ($(PORTNAME), next)
116 # statically link in libc for linux
117 ifeq ($(PORTNAME), linux)
121 # the following is special for Reliant UNIX SVR4 (formerly SINIX)
122 ifeq ($(PORTNAME), svr4)
123 LDFLAGS+= -LD-Blargedynsym
126 postgres: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS)
127 $(CC) $(LDFLAGS) -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD)
129 # Make this target first if you are doing a parallel make.
130 # The targets in 'first' need to be made sequentially because of dependencies.
131 # Then, you can make 'all' with parallelism turned on.
132 first: $(POSTGRES_DEPEND)
135 #############################################################################
137 # Partial objects for platforms with slow linkers.
139 ifeq ($(BIGOBJS), true)
141 OBJS_ACCESS:= $(SRCS_ACCESS:%.c=$(objdir)/%.o)
142 OBJS_BOOTSTRAP:= $(SRCS_BOOTSTRAP:%.c=$(objdir)/%.o)
143 OBJS_CATALOG:= $(SRCS_CATALOG:%.c=$(objdir)/%.o)
144 OBJS_COMMANDS:= $(SRCS_COMMANDS:%.c=$(objdir)/%.o)
145 OBJS_EXECUTOR:= $(SRCS_EXECUTOR:%.c=$(objdir)/%.o)
146 OBJS_MAIN:= $(SRCS_MAIN:%.c=$(objdir)/%.o)
147 OBJS_POSTMASTER:= $(SRCS_POSTMASTER:%.c=$(objdir)/%.o)
148 OBJS_LIB:= $(SRCS_LIB:%.c=$(objdir)/%.o)
149 OBJS_LIBPQ:= $(SRCS_LIBPQ:%.c=$(objdir)/%.o)
150 OBJS_PORT:= $(addprefix $(objdir)/,$(subst .s,.o,$(SRCS_PORT:.c=.o)))
151 OBJS_NODES:= $(SRCS_NODES:%.c=$(objdir)/%.o)
152 OBJS_PARSER:= $(SRCS_PARSER:%.c=$(objdir)/%.o)
153 OBJS_OPTIMIZER:= $(SRCS_OPTIMIZER:%.c=$(objdir)/%.o)
154 OBJS_REGEX:= $(SRCS_REGEX:%.c=$(objdir)/%.o)
155 OBJS_REWRITE:= $(SRCS_REWRITE:%.c=$(objdir)/%.o)
156 OBJS_STORAGE:= $(SRCS_STORAGE:%.c=$(objdir)/%.o)
157 OBJS_TCOP:= $(SRCS_TCOP:%.c=$(objdir)/%.o)
158 OBJS_UTILS:= $(SRCS_UTILS:%.c=$(objdir)/%.o)
160 ACCESS.o: $(OBJS_ACCESS)
162 BOOTSTRAP.o: $(OBJS_BOOTSTRAP)
164 COMMANDS.o: $(OBJS_COMMANDS)
166 EXECUTOR.o: $(OBJS_EXECUTOR)
168 MAIN.o: $(OBJS_MAIN) $(OBJS_POSTMASTER)
170 MISC.o: $(OBJS_CATALOG) $(OBJS_LIB) $(OBJS_LIBPQ) $(OBJS_PORT)
172 NODES.o: $(OBJS_NODES)
174 PARSER.o: $(OBJS_PARSER)
176 OPTIMIZER.o: $(OBJS_OPTIMIZER)
178 REGEX.o: $(OBJS_REGEX)
180 REWRITE.o: $(OBJS_REWRITE)
182 STORAGE.o: $(OBJS_STORAGE)
186 UTILS.o: $(OBJS_UTILS)
190 #############################################################################
194 # Install the backend program (postgres) to the binary directory and
195 # make a link as "postmaster". Install the bki files templates and sample
196 # files to the library directory.
198 # (History: Before Release 2, make install generated a bki.source file
199 # and then used build parameters to convert it to a bki file, then installed
200 # that bki file in the /files subdirectory of the default data directory.
201 # Initdb then used the bki file to generate the database catalog classes.
202 # That had to change because (1) there can be more than one database system,
203 # and (2) the parameters of a database system should be set at initdb time,
204 # not at postgres build time.
206 install: beforeinstall postgres fmgr.h\
207 global1.bki.source local1_template1.bki.source \
210 $(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/postgres \
211 $(DESTDIR)$(BINDIR)/postgres
212 @rm -f $(DESTDIR)$(BINDIR)/postmaster
213 cd $(DESTDIR)$(BINDIR); ln -s postgres postmaster
214 $(INSTALL) $(INSTLOPTS) $(objdir)/fmgr.h $(HEADERDIR)/fmgr.h
215 $(INSTALL) $(INSTLOPTS) $(objdir)/global1.bki.source \
216 $(DESTDIR)$(LIBDIR)/global1.bki.source
217 $(INSTALL) $(INSTLOPTS) $(objdir)/local1_template1.bki.source \
218 $(DESTDIR)$(LIBDIR)/local1_template1.bki.source
219 $(INSTALL) $(INSTLOPTS) libpq/pg_hba.sample \
220 $(DESTDIR)$(LIBDIR)/pg_hba.sample
222 # so we can get the UID of the postgres owner (w/o moving pg_id to
223 # src/tools). We just want the vanilla LDFLAGS for pg_id
224 IDLDFLAGS:= $(LDFLAGS)
225 ifeq ($(PORTNAME), hpux)
227 IDLDFLAGS+= -Aa -D_HPUX_SOURCE
231 CLEANFILES+= postgres
234 #############################################################################
236 # Support for code development.
240 # Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
245 $(CURDIR)/makeID $(PORTNAME)
248 # Special rule to generate cpp'd version of a .c file. This is
249 # especially useful given all the hellish macro processing going on.
250 # The cpp'd version has a .C suffix. To create foo.C from foo.c, just
255 $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' > $(objdir)/$(@F)
257 cppall: $(SRCS:.c=.cpp)
260 # To use Purify (SunOS only), define PURIFY to be the path (and
261 # options) with which to invoke the Purify loader. Only the executable
262 # needs to be loaded with Purify.
264 # PURIFY = /usr/sww/bin/purify -cache-dir=/usr/local/postgres/src/backend/purify-cache
266 #${PROG}: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS)
267 # ${PURIFY} ${CC} ${LDFLAGS} -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD)
269 #CLEANFILES+= .purify* .pure .lock.*.o *_pure_*.o *.pure_*link*