~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/backend/Makefile

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#-------------------------------------------------------------------------
 
2
#
 
3
# Makefile for the postgres backend
 
4
#
 
5
# Copyright (c) 1994, Regents of the University of California
 
6
#
 
7
# $PostgreSQL: pgsql/src/backend/Makefile,v 1.107.4.1 2005-01-26 21:57:32 tgl Exp $
 
8
#
 
9
#-------------------------------------------------------------------------
 
10
 
 
11
PGFILEDESC = "PostgreSQL Database Backend"
 
12
subdir = src/backend
 
13
top_builddir = ../..
 
14
include $(top_builddir)/src/Makefile.global
 
15
 
 
16
DIRS := access bootstrap catalog parser commands executor lib libpq \
 
17
        main nodes optimizer port postmaster regex rewrite \
 
18
        storage tcop utils $(top_builddir)/src/timezone
 
19
 
 
20
OBJS := $(DIRS:%=%/SUBSYS.o)
 
21
 
 
22
ifeq ($(PORTNAME), qnx4)
 
23
# This file crashes qnx4's wlink and is therefore not in
 
24
# bootstrap/SUBSYS.o on that platform. (Wotta hack ... is it still
 
25
# necessary?) [ Yes, until the Watcom compiler goes open source it's
 
26
# effectively unsupported ]
 
27
OBJS+= bootstrap/bootstrap.o
 
28
endif
 
29
 
 
30
# Use server version of port library
 
31
LIBS := $(patsubst -lpgport,-lpgport_srv, $(LIBS))
 
32
 
 
33
##########################################################################
 
34
 
 
35
all: submake-libpgport postgres $(POSTGRES_IMP)
 
36
 
 
37
ifneq ($(PORTNAME), cygwin)
 
38
ifneq ($(PORTNAME), win32)
 
39
 
 
40
postgres: $(OBJS)
 
41
        $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@
 
42
 
 
43
endif
 
44
endif
 
45
 
 
46
ifeq ($(PORTNAME), cygwin)
 
47
postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a
 
48
        $(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
 
49
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(LIBS)
 
50
        $(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
 
51
        $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--stack,4194304 -o $@$(X) $@.exp $(OBJS) $(LIBS)
 
52
        rm -f $@.exp $@.base
 
53
 
 
54
postgres.def: $(OBJS)
 
55
        $(DLLTOOL) --export-all --output-def $@ $^
 
56
 
 
57
libpostgres.a: postgres.def
 
58
        $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
 
59
 
 
60
endif # cygwin
 
61
 
 
62
ifeq ($(PORTNAME), win32)
 
63
 
 
64
postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a $(WIN32RES)
 
65
        $(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
 
66
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(WIN32RES) $(LIBS)
 
67
        $(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
 
68
        $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--stack=4194304 -o $@$(X) $@.exp $(OBJS) $(WIN32RES) $(LIBS)
 
69
        rm -f $@.exp $@.base
 
70
 
 
71
postgres.def: $(OBJS)
 
72
        $(DLLTOOL) --export-all --output-def $@ $^ $(top_builddir)/src/port/libpgport.a
 
73
 
 
74
libpostgres.a: postgres.def
 
75
        $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
 
76
 
 
77
endif # win32
 
78
 
 
79
 
 
80
ifeq ($(PORTNAME), aix)
 
81
 
 
82
postgres: $(POSTGRES_IMP)
 
83
        $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -o $@
 
84
 
 
85
$(POSTGRES_IMP): $(OBJS)
 
86
        $(LD) $(LDREL) $(LDOUT) SUBSYS.o $^
 
87
ifeq ($(host_os), aix3.2.5)
 
88
        $(MKLDEXPORT) SUBSYS.o $(bindir)/postgres > $@
 
89
else
 
90
ifneq (,$(findstring aix4.1, $(host_os)))
 
91
        $(MKLDEXPORT) SUBSYS.o $(bindir)/postgres > $@
 
92
else
 
93
        $(MKLDEXPORT) SUBSYS.o . > $@
 
94
endif
 
95
endif
 
96
        @rm -f SUBSYS.o
 
97
 
 
98
endif # aix
 
99
 
 
100
# Parallel make trickery
 
101
$(OBJS): $(DIRS:%=%-recursive) ;
 
102
 
 
103
.PHONY: $(DIRS:%=%-recursive)
 
104
# Update the commonly used headers before building the subdirectories
 
105
$(DIRS:%=%-recursive): $(top_builddir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
 
106
        $(MAKE) -C $(subst -recursive,,$@) all
 
107
 
 
108
 
 
109
$(DLLINIT): $(DLLINIT:%.o=%.c)
 
110
        $(MAKE) -C $(@D) $(@F)
 
111
 
 
112
# The postgres.o target is needed by the rule in Makefile.global that
 
113
# creates the exports file when MAKE_EXPORTS = true.
 
114
postgres.o: $(OBJS)
 
115
        $(CC) $(LDREL) $(LDFLAGS) $^ $(LIBS) -o $@
 
116
 
 
117
 
 
118
# The following targets are specified in make commands that appear in
 
119
# the make files in our subdirectories. Note that it's important we
 
120
# match the dependencies shown in the subdirectory makefiles!
 
121
 
 
122
$(srcdir)/parser/parse.h: parser/gram.y
 
123
        $(MAKE) -C parser parse.h
 
124
 
 
125
utils/fmgroids.h: utils/Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
 
126
        $(MAKE) -C utils fmgroids.h
 
127
 
 
128
# Make symlinks for these headers in the include directory. That way
 
129
# we can cut down on the -I options. Also, a symlink is automatically
 
130
# up to date when we update the base file.
 
131
 
 
132
$(top_builddir)/src/include/parser/parse.h: $(srcdir)/parser/parse.h
 
133
        prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
 
134
          cd $(dir $@) && rm -f $(notdir $@) && \
 
135
          $(LN_S) "$$prereqdir/$(notdir $<)" .
 
136
 
 
137
$(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
 
138
        cd $(dir $@) && rm -f $(notdir $@) && \
 
139
            $(LN_S) ../../../$(subdir)/utils/fmgroids.h .
 
140
 
 
141
 
 
142
##########################################################################
 
143
 
 
144
distprep:
 
145
        $(MAKE) -C parser       gram.c parse.h scan.c
 
146
        $(MAKE) -C bootstrap    bootparse.c bootstrap_tokens.h bootscanner.c
 
147
        $(MAKE) -C utils/misc   guc-file.c
 
148
 
 
149
 
 
150
##########################################################################
 
151
 
 
152
install: all installdirs install-bin
 
153
ifeq ($(PORTNAME), cygwin)
 
154
ifeq ($(MAKE_DLL), true)
 
155
        $(INSTALL_DATA) libpostgres.a $(DESTDIR)$(libdir)/libpostgres.a
 
156
endif
 
157
endif
 
158
ifeq ($(PORTNAME), win32)
 
159
ifeq ($(MAKE_DLL), true)
 
160
        $(INSTALL_DATA) libpostgres.a $(DESTDIR)$(libdir)/libpostgres.a
 
161
endif
 
162
endif
 
163
        $(MAKE) -C catalog install-data
 
164
        $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample $(DESTDIR)$(datadir)/pg_hba.conf.sample
 
165
        $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
 
166
        $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
 
167
        $(INSTALL_DATA) $(srcdir)/access/transam/recovery.conf.sample $(DESTDIR)$(datadir)/recovery.conf.sample
 
168
 
 
169
install-bin: postgres $(POSTGRES_IMP) installdirs
 
170
        $(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
 
171
ifneq ($(PORTNAME), win32)
 
172
        @rm -f $(DESTDIR)$(bindir)/postmaster$(X)
 
173
        ln -s postgres$(X) $(DESTDIR)$(bindir)/postmaster$(X)
 
174
else
 
175
        $(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postmaster$(X)
 
176
endif
 
177
ifeq ($(MAKE_EXPORTS), true)
 
178
        $(INSTALL_DATA) $(POSTGRES_IMP) $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
 
179
endif
 
180
 
 
181
.PHONY: install-bin
 
182
 
 
183
installdirs:
 
184
        $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)
 
185
ifeq ($(PORTNAME), cygwin)
 
186
ifeq ($(MAKE_DLL), true)
 
187
        $(mkinstalldirs) $(DESTDIR)$(libdir)
 
188
endif
 
189
endif
 
190
ifeq ($(PORTNAME), win32)
 
191
ifeq ($(MAKE_DLL), true)
 
192
        $(mkinstalldirs) $(DESTDIR)$(libdir)
 
193
endif
 
194
endif
 
195
ifeq ($(MAKE_EXPORTS), true)
 
196
        $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
 
197
endif
 
198
 
 
199
 
 
200
##########################################################################
 
201
 
 
202
uninstall:
 
203
        rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(bindir)/postmaster
 
204
ifeq ($(MAKE_EXPORTS), true)
 
205
        rm -f $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
 
206
endif
 
207
ifeq ($(PORTNAME), cygwin)
 
208
ifeq ($(MAKE_DLL), true)
 
209
        rm -f $(DESTDIR)$(libdir)/libpostgres.a
 
210
endif
 
211
endif
 
212
ifeq ($(PORTNAME), win32)
 
213
ifeq ($(MAKE_DLL), true)
 
214
        rm -f $(DESTDIR)$(libdir)/libpostgres.a
 
215
endif
 
216
endif
 
217
        $(MAKE) -C catalog uninstall-data
 
218
        rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \
 
219
              $(DESTDIR)$(datadir)/pg_service.conf.sample \
 
220
              $(DESTDIR)$(datadir)/pg_ident.conf.sample \
 
221
              $(DESTDIR)$(datadir)/postgresql.conf.sample
 
222
 
 
223
 
 
224
##########################################################################
 
225
 
 
226
clean:
 
227
        rm -f postgres$(X) $(POSTGRES_IMP) \
 
228
                $(top_srcdir)/src/include/parser/parse.h \
 
229
                $(top_builddir)/src/include/utils/fmgroids.h
 
230
ifeq ($(PORTNAME), cygwin)
 
231
        rm -f postgres.dll postgres.def libpostgres.a
 
232
endif
 
233
ifeq ($(PORTNAME), win32)
 
234
        rm -f postgres.dll postgres.def libpostgres.a $(WIN32RES)
 
235
endif
 
236
        for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done
 
237
 
 
238
distclean: clean
 
239
        rm -f port/tas.s port/dynloader.c port/pg_sema.c port/pg_shmem.c
 
240
 
 
241
maintainer-clean: distclean
 
242
        rm -f $(srcdir)/bootstrap/bootparse.c \
 
243
              $(srcdir)/bootstrap/bootscanner.c \
 
244
              $(srcdir)/bootstrap/bootstrap_tokens.h \
 
245
              $(srcdir)/parser/gram.c \
 
246
              $(srcdir)/parser/scan.c \
 
247
              $(srcdir)/parser/parse.h \
 
248
              $(srcdir)/utils/misc/guc-file.c
 
249
 
 
250
 
 
251
##########################################################################
 
252
#
 
253
# Support for code development.
 
254
#
 
255
# Use target "quick" to build "postgres" when you know all the subsystems 
 
256
# are up to date.  It saves the time of doing all the submakes.
 
257
.PHONY: quick
 
258
quick: $(OBJS)
 
259
        $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o postgres
 
260
 
 
261
depend dep: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
 
262
        for i in $(DIRS); do $(MAKE) -C $$i $@; done