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.17 1996/11/23 09:51:57 bryanh Exp $
39 #-------------------------------------------------------------------------
42 include ../Makefile.global
44 OBJS = access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o \
45 commands/SUBSYS.o executor/SUBSYS.o \
46 lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o nodes/SUBSYS.o \
47 optimizer/SUBSYS.o parser/SUBSYS.o port/SUBSYS.o \
48 postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o \
49 storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o \
53 OBJS += tioga/SUBSYS.o
56 ifeq ($(MAKE_EXPORTS), true)
57 EXP = postgres$(EXPSUFF)
62 all: postgres $(EXP) global1.bki.source local1_template1.bki.source
64 postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
65 $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
69 $(MAKE) -C bootstrap all
70 $(MAKE) -C catalog SUBSYS.o
71 $(MAKE) -C commands all
73 $(MAKE) -C executor all
79 $(MAKE) -C optimizer all
81 $(MAKE) -C port all PORTNAME=$(PORTNAME)
82 $(MAKE) -C postmaster all
85 $(MAKE) -C rewrite all
86 $(MAKE) -C storage all
92 $(MAKE) -C ../utils version.o
94 global1.bki.source local1_template1.bki.source:
98 # The postgres.o target is needed by the rule in Makefile.global that
99 # creates the exports file when MAKE_EXPORTS = true.
101 $(CC) $(LDFLAGS) -r -o postgres.o $(OBJS) $(LDADD)
104 ############################################################################
105 # The following targets are specified in make commands that appear in the
106 # make files in our subdirectories.
109 $(MAKE) -C parser parse.h
113 $(MAKE) -C utils fmgr.h
116 #############################################################################
118 rm -f postgres fmgr.h parse.h \
119 global1.bki.source local1_template1.bki.source
120 $(MAKE) -C access clean
121 $(MAKE) -C bootstrap clean
122 $(MAKE) -C catalog clean
123 $(MAKE) -C commands clean
124 $(MAKE) -C executor clean
126 $(MAKE) -C libpq clean
127 $(MAKE) -C main clean
128 $(MAKE) -C nodes clean
129 $(MAKE) -C optimizer clean
130 $(MAKE) -C parser clean
131 $(MAKE) -C port clean PORTNAME=$(PORTNAME)
132 $(MAKE) -C postmaster clean
133 $(MAKE) -C regex clean
134 $(MAKE) -C rewrite clean
135 $(MAKE) -C storage clean
136 $(MAKE) -C tcop clean
137 $(MAKE) -C utils clean
139 $(MAKE) -C tioga clean
144 $(MAKE) -C bootstrap $@
145 $(MAKE) -C catalog $@
146 $(MAKE) -C commands $@
147 $(MAKE) -C executor $@
152 $(MAKE) -C optimizer $@
154 $(MAKE) -C port $@ PORTNAME=$(PORTNAME)
155 $(MAKE) -C postmaster $@
157 $(MAKE) -C rewrite $@
158 $(MAKE) -C storage $@
166 #############################################################################
170 # Install the backend program (postgres) to the binary directory and
171 # make a link as "postmaster". Install the bki files templates and sample
172 # files to the library directory.
174 # (History: Before Release 2, make install generated a bki.source file
175 # and then used build parameters to convert it to a bki file, then installed
176 # that bki file in the /files subdirectory of the default data directory.
177 # Initdb then used the bki file to generate the database catalog classes.
178 # That had to change because (1) there can be more than one database system,
179 # and (2) the parameters of a database system should be set at initdb time,
180 # not at postgres build time.
182 install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(EXP) fmgr.h\
183 global1.bki.source local1_template1.bki.source \
184 libpq/pg_hba.conf.sample
186 $(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
187 ifeq ($(MAKE_EXPORTS), true)
188 $(INSTALL) $(INSTLOPTS) postgres$(EXPSUFF) $(LIBDIR)/postgres$(EXPSUFF)
190 @rm -f $(BINDIR)/postmaster
191 cd $(BINDIR); ln -s postgres postmaster
192 $(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
193 $(INSTALL) $(INSTLOPTS) global1.bki.source \
194 $(LIBDIR)/global1.bki.source
195 $(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
196 $(LIBDIR)/local1_template1.bki.source
197 $(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
198 $(LIBDIR)/pg_hba.conf.sample
200 $(BINDIR) $(LIBDIR) $(HEADERDIR):
203 #############################################################################
205 # Support for code development.
207 # Use target "quick" to build "postgres" when you know all the subsystems
208 # are up to date. It saves the time of doing all the submakes.
211 $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
214 # Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
222 # Special rule to generate cpp'd version of a .c file. This is
223 # especially useful given all the hellish macro processing going on.
224 # The cpp'd version has a .C suffix. To create foo.C from foo.c, just
229 $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \