]> granicus.if.org Git - postgresql/blob - src/backend/Makefile
Make port-specific link libraries defined for linking backend more global
[postgresql] / src / backend / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile--
4 #   Makefile for the postgres backend (and the postmaster)
5 #
6 # Copyright (c) 1994, Regents of the University of California
7 #
8 # Functional notes:
9 #
10 #   Parallel make:  
11 #
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 
14 #     once.  
15 #
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).
25 #
26 #
27 #
28 # Implementation notes:
29 #
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.
34 #
35 #
36 # IDENTIFICATION
37 #    $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.16 1996/11/18 02:23:41 bryanh Exp $
38 #
39 #-------------------------------------------------------------------------
40
41 SRCDIR = ..
42 include ../Makefile.global
43
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 \
50        ../utils/version.o
51
52 ifdef TIOGA
53 OBJS += tioga/SUBSYS.o
54 endif
55
56 all: postgres global1.bki.source local1_template1.bki.source
57
58 postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4 
59         $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
60
61 postgres_group1:
62         $(MAKE) -C access     all   
63         $(MAKE) -C bootstrap  all   
64         $(MAKE) -C catalog    SUBSYS.o
65         $(MAKE) -C commands   all   
66 postgres_group2:
67         $(MAKE) -C executor   all   
68         $(MAKE) -C lib        all   
69         $(MAKE) -C libpq      all   
70         $(MAKE) -C main       all   
71         $(MAKE) -C nodes      all   
72 postgres_group3:
73         $(MAKE) -C optimizer  all   
74         $(MAKE) -C parser     all   
75         $(MAKE) -C port       all   PORTNAME=$(PORTNAME)
76         $(MAKE) -C postmaster all   
77         $(MAKE) -C regex      all   
78 postgres_group4:
79         $(MAKE) -C rewrite    all   
80         $(MAKE) -C storage    all   
81         $(MAKE) -C tcop       all   
82         $(MAKE) -C utils      all   
83 ifdef TIOGA
84         $(MAKE) -C tioga      all   
85 endif
86         $(MAKE) -C ../utils version.o        
87
88 global1.bki.source local1_template1.bki.source: 
89         $(MAKE) -C catalog $@
90         cp catalog/$@ .
91
92
93 ############################################################################
94 # The following targets are specified in make commands that appear in the
95 # make files in our subdirectories.
96
97 parse.h: 
98         $(MAKE) -C parser parse.h
99         cp parser/parse.h .
100
101 fmgr.h:
102         $(MAKE) -C utils fmgr.h
103         cp utils/fmgr.h .
104
105 #############################################################################
106 clean:
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
114         $(MAKE) -C lib        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
127 ifdef TIOGA
128         $(MAKE) -C tioga      clean
129 endif
130
131 .DEFAULT:
132         $(MAKE) -C access     $@
133         $(MAKE) -C bootstrap  $@
134         $(MAKE) -C catalog    $@
135         $(MAKE) -C commands   $@
136         $(MAKE) -C executor   $@
137         $(MAKE) -C lib        $@
138         $(MAKE) -C libpq      $@
139         $(MAKE) -C main       $@
140         $(MAKE) -C nodes      $@
141         $(MAKE) -C optimizer  $@
142         $(MAKE) -C parser     $@
143         $(MAKE) -C port       $@  PORTNAME=$(PORTNAME)
144         $(MAKE) -C postmaster $@
145         $(MAKE) -C regex      $@
146         $(MAKE) -C rewrite    $@
147         $(MAKE) -C storage    $@
148         $(MAKE) -C tcop       $@
149         $(MAKE) -C utils      $@
150 ifdef TIOGA
151         $(MAKE) -C tioga      $@
152 endif
153
154
155 #############################################################################
156 #
157 # Installation.
158 #
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.
162 #
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.
170
171 D_LIBDIR = $(DESTDIR)$(LIBDIR)
172 D_BINDIR = $(DESTDIR)$(BINDIR)
173
174 install: $(D_LIBDIR) $(D_BINDIR) $(HEADERDIR) postgres fmgr.h\
175          global1.bki.source local1_template1.bki.source \
176          libpq/pg_hba.conf.sample
177         
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
188
189 $(D_BINDIR) $(D_LIBDIR) $(HEADERDIR): 
190         mkdir $@
191
192 #############################################################################
193 #
194 # Support for code development.
195 #
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.
198 .PHONY: quick
199 quick: $(OBJS)
200         $(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
201
202 #
203 # Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
204 #
205 IDFILE= ID
206 .PHONY: $(IDFILE)
207 $(IDFILE):
208         ./makeID $(PORTNAME)
209
210 #
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
214 # type
215 #       make foo.C
216 #
217 %.cpp:  %.c
218         $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \
219             > $(@F)