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.16 1996/11/18 02:23:41 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 all: postgres global1.bki.source local1_template1.bki.source
58 postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
59 $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
63 $(MAKE) -C bootstrap all
64 $(MAKE) -C catalog SUBSYS.o
65 $(MAKE) -C commands all
67 $(MAKE) -C executor all
73 $(MAKE) -C optimizer all
75 $(MAKE) -C port all PORTNAME=$(PORTNAME)
76 $(MAKE) -C postmaster all
79 $(MAKE) -C rewrite all
80 $(MAKE) -C storage all
86 $(MAKE) -C ../utils version.o
88 global1.bki.source local1_template1.bki.source:
93 ############################################################################
94 # The following targets are specified in make commands that appear in the
95 # make files in our subdirectories.
98 $(MAKE) -C parser parse.h
102 $(MAKE) -C utils fmgr.h
105 #############################################################################
107 rm -f postgres fmgr.h parse.h \
108 global1.bki.source local1_template1.bki.source
109 $(MAKE) -C access clean
110 $(MAKE) -C bootstrap clean
111 $(MAKE) -C catalog clean
112 $(MAKE) -C commands clean
113 $(MAKE) -C executor clean
115 $(MAKE) -C libpq clean
116 $(MAKE) -C main clean
117 $(MAKE) -C nodes clean
118 $(MAKE) -C optimizer clean
119 $(MAKE) -C parser clean
120 $(MAKE) -C port clean PORTNAME=$(PORTNAME)
121 $(MAKE) -C postmaster clean
122 $(MAKE) -C regex clean
123 $(MAKE) -C rewrite clean
124 $(MAKE) -C storage clean
125 $(MAKE) -C tcop clean
126 $(MAKE) -C utils clean
128 $(MAKE) -C tioga clean
133 $(MAKE) -C bootstrap $@
134 $(MAKE) -C catalog $@
135 $(MAKE) -C commands $@
136 $(MAKE) -C executor $@
141 $(MAKE) -C optimizer $@
143 $(MAKE) -C port $@ PORTNAME=$(PORTNAME)
144 $(MAKE) -C postmaster $@
146 $(MAKE) -C rewrite $@
147 $(MAKE) -C storage $@
155 #############################################################################
159 # Install the backend program (postgres) to the binary directory and
160 # make a link as "postmaster". Install the bki files templates and sample
161 # files to the library directory.
163 # (History: Before Release 2, make install generated a bki.source file
164 # and then used build parameters to convert it to a bki file, then installed
165 # that bki file in the /files subdirectory of the default data directory.
166 # Initdb then used the bki file to generate the database catalog classes.
167 # That had to change because (1) there can be more than one database system,
168 # and (2) the parameters of a database system should be set at initdb time,
169 # not at postgres build time.
171 D_LIBDIR = $(DESTDIR)$(LIBDIR)
172 D_BINDIR = $(DESTDIR)$(BINDIR)
174 install: $(D_LIBDIR) $(D_BINDIR) $(HEADERDIR) postgres fmgr.h\
175 global1.bki.source local1_template1.bki.source \
176 libpq/pg_hba.conf.sample
178 $(INSTALL) $(INSTL_EXE_OPTS) postgres $(D_BINDIR)/postgres
179 @rm -f $(D_BINDIR)/postmaster
180 cd $(D_BINDIR); ln -s postgres postmaster
181 $(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
182 $(INSTALL) $(INSTLOPTS) global1.bki.source \
183 $(D_LIBDIR)/global1.bki.source
184 $(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
185 $(D_LIBDIR)/local1_template1.bki.source
186 $(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
187 $(D_LIBDIR)/pg_hba.conf.sample
189 $(D_BINDIR) $(D_LIBDIR) $(HEADERDIR):
192 #############################################################################
194 # Support for code development.
196 # Use target "quick" to build "postgres" when you know all the subsystems
197 # are up to date. It saves the time of doing all the submakes.
200 $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
203 # Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
211 # Special rule to generate cpp'd version of a .c file. This is
212 # especially useful given all the hellish macro processing going on.
213 # The cpp'd version has a .C suffix. To create foo.C from foo.c, just
218 $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \