1 #-------------------------------------------------------------------------
4 # Makefile for the postgres backend (and the postmaster)
6 # Copyright (c) 1994, Regents of the University of California
12 # This make file is set up so that you can do a parallel make (with
13 # the --jobs option of make) and make multiple subdirectories at
16 # However, the subdirectory make files are not so careful.
17 # Normally, the --jobs option would get passed down to those
18 # subdirectory makes, like any other make option, and they would
19 # fail. But there's a trick: Put a value (max number of
20 # processes) on the --jobs option, e.g. --jobs=4. Now, due to a
21 # special feature of make, the --jobs option will not get passed
22 # to the subdirectory makes. (make does this because if you only
23 # want 4 tasks running, then splitting the subdirectory makes into
24 # multiple tasks would violate your wishes).
28 # Implementation notes:
30 # We don't use $(LD) for linking. We use $(CC) instead. This is because
31 # the $(CC) program apparently can do linking too, and it has certain
32 # thinks like default options and search paths for libraries set up for
33 # it that the more primitive $(LD) doesn't have.
37 # $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.11 1996/10/31 07:25:15 scrappy Exp $
39 #-------------------------------------------------------------------------
42 include ../Makefile.global
45 ##########################################################################
46 # Determine linker flags for this platform (mainly, the libraries with
48 ##########################################################################
50 # All systems except NEXTSTEP require the math library.
51 # Loader flags for system-dependent libraries are appended in
52 # src/backend/port/$(PORTNAME)/Makefile.inc
54 ifneq ($(PORTNAME), next)
58 ifeq ($(PORTNAME), aix)
62 ifeq ($(PORTNAME), alpha)
66 ifeq ($(PORTNAME), bsdi)
70 ifeq ($(PORTNAME), bsdi_2_1)
74 ifeq ($(PORTNAME), hpux)
76 # -W l,-E export symbols for linking with the shared libraries
78 # -W p,-H400000 expand cpp #define table size so the Nodes files don't
88 LDADD+= -ll /usr/lib/libdld.sl
93 ifeq ($(PORTNAME), i386_solaris)
97 ifeq ($(PORTNAME), irix5)
101 ifeq ($(PORTNAME), linux)
109 ifeq ($(PORTNAME), sparc)
113 ifeq ($(PORTNAME), sparc_solaris)
117 ifeq ($(PORTNAME), svr4)
119 # the following is special for Reliant UNIX SVR4 (formerly SINIX)
120 LDFLAGS+= -LD-Blargedynsym
123 ifeq ($(PORTNAME), ultrix4)
127 #############################################################################
129 OBJS = access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o \
130 commands/SUBSYS.o executor/SUBSYS.o \
131 lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o nodes/SUBSYS.o \
132 optimizer/SUBSYS.o parser/SUBSYS.o port/SUBSYS.o \
133 postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o \
134 storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o
137 OBJS += tioga/SUBSYS.o
140 all: postgres global1.bki.source local1_template1.bki.source
142 postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
143 $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
146 $(MAKE) -C access SUBSYS.o
147 $(MAKE) -C bootstrap SUBSYS.o
148 $(MAKE) -C catalog SUBSYS.o
149 $(MAKE) -C commands SUBSYS.o
151 $(MAKE) -C executor SUBSYS.o
152 $(MAKE) -C lib SUBSYS.o
153 $(MAKE) -C libpq SUBSYS.o
154 $(MAKE) -C main SUBSYS.o
155 $(MAKE) -C nodes SUBSYS.o
157 $(MAKE) -C optimizer SUBSYS.o
158 $(MAKE) -C parser SUBSYS.o
159 $(MAKE) -C port SUBSYS.o PORTNAME=$(PORTNAME)
160 $(MAKE) -C postmaster SUBSYS.o
161 $(MAKE) -C regex SUBSYS.o
163 $(MAKE) -C rewrite SUBSYS.o
164 $(MAKE) -C storage SUBSYS.o
165 $(MAKE) -C tcop SUBSYS.o
166 $(MAKE) -C utils SUBSYS.o
168 $(MAKE) -C tioga SUBSYS.o
171 global1.bki.source local1_template1.bki.source:
172 $(MAKE) -C catalog $@
173 cp catalog/$@ ../include
176 ############################################################################
177 # The following targets are specified in make commands that appear in the
178 # make files in our subdirectories.
181 $(MAKE) -C parser parse.h
182 cp parser/parse.h ../include
185 $(MAKE) -C utils fmgr.h
186 cp utils/fmgr.h ../include
188 #############################################################################
190 rm -f postgres fmgr.h parse.h \
191 global1.bki.source local1_template1.bki.source
192 $(MAKE) -C access clean
193 $(MAKE) -C bootstrap clean
194 $(MAKE) -C catalog clean
195 $(MAKE) -C commands clean
196 $(MAKE) -C executor clean
198 $(MAKE) -C libpq clean
199 $(MAKE) -C main clean
200 $(MAKE) -C nodes clean
201 $(MAKE) -C optimizer clean
202 $(MAKE) -C parser clean
203 $(MAKE) -C port clean PORTNAME=$(PORTNAME)
204 $(MAKE) -C postmaster clean
205 $(MAKE) -C regex clean
206 $(MAKE) -C rewrite clean
207 $(MAKE) -C storage clean
208 $(MAKE) -C tcop clean
209 $(MAKE) -C utils clean
211 $(MAKE) -C tioga clean
216 $(MAKE) -C bootstrap $@
217 $(MAKE) -C catalog $@
218 $(MAKE) -C commands $@
219 $(MAKE) -C executor $@
224 $(MAKE) -C optimizer $@
226 $(MAKE) -C port $@ PORTNAME=$(PORTNAME)
227 $(MAKE) -C postmaster $@
229 $(MAKE) -C rewrite $@
230 $(MAKE) -C storage $@
238 #############################################################################
242 # Install the backend program (postgres) to the binary directory and
243 # make a link as "postmaster". Install the bki files templates and sample
244 # files to the library directory.
246 # (History: Before Release 2, make install generated a bki.source file
247 # and then used build parameters to convert it to a bki file, then installed
248 # that bki file in the /files subdirectory of the default data directory.
249 # Initdb then used the bki file to generate the database catalog classes.
250 # That had to change because (1) there can be more than one database system,
251 # and (2) the parameters of a database system should be set at initdb time,
252 # not at postgres build time.
254 D_LIBDIR = $(DESTDIR)$(LIBDIR)
255 D_BINDIR = $(DESTDIR)$(BINDIR)
257 install: $(D_LIBDIR) $(D_BINDIR) $(HEADERDIR) postgres fmgr.h\
258 global1.bki.source local1_template1.bki.source \
259 libpq/pg_hba.conf.sample
261 $(INSTALL) $(INSTL_EXE_OPTS) postgres $(D_BINDIR)/postgres
262 @rm -f $(D_BINDIR)/postmaster
263 cd $(D_BINDIR); ln -s postgres postmaster
264 $(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
265 $(INSTALL) $(INSTLOPTS) global1.bki.source \
266 $(D_LIBDIR)/global1.bki.source
267 $(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
268 $(D_LIBDIR)/local1_template1.bki.source
269 $(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
270 $(D_LIBDIR)/pg_hba.conf.sample
272 $(D_BINDIR) $(D_LIBDIR) $(HEADERDIR):
275 #############################################################################
277 # Support for code development.
281 # Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
289 # Special rule to generate cpp'd version of a .c file. This is
290 # especially useful given all the hellish macro processing going on.
291 # The cpp'd version has a .C suffix. To create foo.C from foo.c, just
296 $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \