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.25 1997/09/19 19:44:30 scrappy Exp $
39 #-------------------------------------------------------------------------
42 include ../Makefile.global
44 DIRS = access bootstrap catalog commands executor lib libpq \
45 main nodes optimizer parser port postmaster regex rewrite \
52 OBJS = $(DIRS:%=%/SUBSYS.o)
54 all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
56 postgres: $(OBJS) ../utils/version.o
57 $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
59 $(OBJS): $(DIRS:%=%.dir)
62 $(MAKE) -C $(subst .dir,,$@) all PORTNAME=$(PORTNAME)
65 $(MAKE) -C ../utils version.o
67 global1.bki.source local1_template1.bki.source: catalog/$@
70 catalog/global1.bki.source catalog/local1_template1.bki.source:
73 # The postgres.o target is needed by the rule in Makefile.global that
74 # creates the exports file when MAKE_EXPORTS = true.
76 $(CC) -r -o postgres.o $(OBJS) $(LDFLAGS)
79 ############################################################################
80 # The following targets are specified in make commands that appear in the
81 # make files in our subdirectories.
84 $(MAKE) -C parser parse.h
88 $(MAKE) -C utils fmgr.h
91 #############################################################################
93 rm -f postgres $(POSTGRES_IMP) fmgr.h parse.h \
94 global1.bki.source local1_template1.bki.source
95 for i in $(DIRS); do $(MAKE) -C $$i clean PORTNAME=$(PORTNAME); done
98 for i in $(DIRS); do $(MAKE) -C $$i $@ PORTNAME=$(PORTNAME); done
100 #############################################################################
104 # Install the backend program (postgres) to the binary directory and
105 # make a link as "postmaster". Install the bki files templates and sample
106 # files to the library directory.
108 # (History: Before Release 2, make install generated a bki.source file
109 # and then used build parameters to convert it to a bki file, then installed
110 # that bki file in the /files subdirectory of the default data directory.
111 # Initdb then used the bki file to generate the database catalog classes.
112 # That had to change because (1) there can be more than one database system,
113 # and (2) the parameters of a database system should be set at initdb time,
114 # not at postgres build time.
116 install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(POSTGRES_IMP) fmgr.h\
117 global1.bki.source local1_template1.bki.source \
118 libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
120 $(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
121 ifeq ($(MAKE_EXPORTS), true)
122 $(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
124 @rm -f $(BINDIR)/postmaster
125 ln -s postgres $(BINDIR)postmaster
126 $(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
127 $(INSTALL) $(INSTLOPTS) global1.bki.source \
128 $(LIBDIR)/global1.bki.source
129 $(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
130 $(LIBDIR)/local1_template1.bki.source
131 $(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
132 $(LIBDIR)/pg_hba.conf.sample
133 $(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \
134 $(LIBDIR)/pg_geqo.sample
136 $(BINDIR) $(LIBDIR) $(HEADERDIR):
139 #############################################################################
141 # Support for code development.
143 # Use target "quick" to build "postgres" when you know all the subsystems
144 # are up to date. It saves the time of doing all the submakes.
147 $(CC) -o postgres $(OBJS) $(LDFLAGS)
150 # Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
158 # Special rule to generate cpp'd version of a .c file. This is
159 # especially useful given all the hellish macro processing going on.
160 # The cpp'd version has a .C suffix. To create foo.C from foo.c, just
165 $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \