6
6
# Copyright (c) 1998, Regents of the University of California
7
7
#
8
8
# IDENTIFICATION
9
- # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.111 2008/02/26 10:30:06 petere Exp $
9
+ # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.112 2008/02/26 10:45:24 petere Exp $
10
10
#
11
11
#-------------------------------------------------------------------------
12
12
@@ -99,6 +99,7 @@ soname = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
99
99
ifeq ($(PORTNAME), aix)
100
100
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
101
101
haslibarule = yes
102
+ exports_file = lib$(NAME).exp
102
103
endif
103
104
104
105
ifeq ($(PORTNAME), darwin)
@@ -117,8 +118,9 @@ ifeq ($(PORTNAME), darwin)
117
118
shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
118
119
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
119
120
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
120
- ifneq (,$(SHLIB_EXPORTS))
121
- exported_symbols_list = -exported_symbols_list $(SHLIB_EXPORTS:%.txt=%.list)
121
+ exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
122
+ ifneq (,$(exports_file))
123
+ exported_symbols_list = -exported_symbols_list $(exports_file)
122
124
endif
123
125
endif
124
126
@@ -193,8 +195,9 @@ endif
193
195
ifeq ($(PORTNAME), linux)
194
196
LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname)
195
197
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
196
- ifneq (,$(SHLIB_EXPORTS))
197
- LINK.shared += -Wl,--version-script=$(SHLIB_EXPORTS:%.txt=%.list)
198
+ exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
199
+ ifneq (,$(exports_file))
200
+ LINK.shared += -Wl,--version-script=$(exports_file)
198
201
endif
199
202
endif
200
203
@@ -284,8 +287,7 @@ endif #haslibarule
284
287
285
288
ifeq ($(enable_shared), yes)
286
289
287
- ifneq ($(PORTNAME), win32)
288
- ifneq ($(PORTNAME), cygwin)
290
+ ifeq (,$(filter cygwin win32,$(PORTNAME)))
289
291
ifneq ($(PORTNAME), aix)
290
292
291
293
# Normal case
@@ -321,46 +323,35 @@ else # PORTNAME == aix
321
323
$(shlib) lib$(NAME).a: $(OBJS)
322
324
$(LINK.static) lib$(NAME).a $^
323
325
$(RANLIB) lib$(NAME).a
324
- $(MKLDEXPORT) lib$(NAME).a > lib$(NAME)$(EXPSUFF )
325
- $(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:lib$(NAME)$(EXPSUFF ) $(SHLIB_LINK)
326
+ $(MKLDEXPORT) lib$(NAME).a >$(exports_file )
327
+ $(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:$(exports_file ) $(SHLIB_LINK)
326
328
rm -f lib$(NAME).a
327
329
$(AR) $(AROPT) lib$(NAME).a $(shlib)
328
330
329
331
endif # PORTNAME == aix
330
332
331
- else # PORTNAME == cygwin
333
+ else # PORTNAME == cygwin || PORTNAME == win32
332
334
333
- # Cygwin case
334
- $(shlib) lib$(NAME).a: $(OBJS)
335
- ifndef DLL_DEFFILE
336
- $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
337
- $(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
338
- $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
339
- else
340
- $(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
341
- $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
342
- endif
335
+ # Cygwin or Win32 case
343
336
344
- endif # PORTNAME == cygwin
337
+ DLL_DEFFILE = lib$(NAME)dll.def
345
338
346
- else # PORTNAME == win32
339
+ # If SHLIB_EXPORTS is set, the rules below will build a .def file from
340
+ # that. Else we build a temporary one here.
341
+ ifeq (,$(SHLIB_EXPORTS))
342
+ exports_file = $(DLL_DEFFILE)
347
343
348
- ifneq (,$(SHLIB_EXPORTS) )
349
- DLL_DEFFILE = lib$(NAME)dll. def
344
+ $(exports_file): $(OBJS )
345
+ $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output- def $@ $^
350
346
endif
351
347
352
- # win32 case
353
- $(shlib) lib$(NAME).a: $(OBJS)
354
- ifndef DLL_DEFFILE
355
- $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
356
- $(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
357
- $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
358
- else
359
- $(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
360
- $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
361
- endif
348
+ $(shlib): $(OBJS) $(DLL_DEFFILE)
349
+ $(DLLWRAP) $(LDFLAGS_SL) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
350
+
351
+ lib$(NAME).a: $(shlib) $(DLL_DEFFILE)
352
+ $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
362
353
363
- endif # PORTNAME == win32
354
+ endif # PORTNAME == cygwin || PORTNAME == win32
364
355
365
356
endif # enable_shared
366
357
@@ -464,17 +455,7 @@ endif # enable_shared
464
455
clean-lib:
465
456
rm -f lib$(NAME).a
466
457
ifeq ($(enable_shared), yes)
467
- rm -f $(shlib_bare) $(shlib_major) $(shlib) $(SHLIB_EXPORTS:%.txt=%.list)
468
- ifdef EXPSUFF
469
- rm -f lib$(NAME)$(EXPSUFF)
470
- endif
471
- endif
472
- ifeq ($(PORTNAME), cygwin)
473
- rm -f $(NAME).dll $(NAME).def
474
- endif
475
-
476
- ifeq ($(PORTNAME), win32)
477
- rm -f $(NAME).dll $(NAME).def
458
+ rm -f $(shlib_bare) $(shlib_major) $(shlib) $(exports_file)
478
459
endif
479
460
480
461
ifneq (,$(SHLIB_EXPORTS))
0 commit comments