diff options
| author | Peter Eisentraut | 2008-02-26 06:41:24 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2008-02-26 06:41:24 +0000 |
| commit | a1d5d8574751d62a039d8ceb44329ee7c637196a (patch) | |
| tree | de1dca04651df84fa21a97fb58c560e4825a8522 /src/interfaces | |
| parent | fd15dba543247eb1ce879d22632b9fdb4c230831 (diff) | |
Refactor the code that creates the shared library export files to appear
only once in Makefile.shlib and not in four copies.
Diffstat (limited to 'src/interfaces')
| -rw-r--r-- | src/interfaces/ecpg/compatlib/Makefile | 64 | ||||
| -rw-r--r-- | src/interfaces/ecpg/ecpglib/Makefile | 61 | ||||
| -rw-r--r-- | src/interfaces/ecpg/pgtypeslib/Makefile | 64 | ||||
| -rw-r--r-- | src/interfaces/libpq/Makefile | 69 |
4 files changed, 25 insertions, 233 deletions
diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile index b6aa2990ed2..b8c17f07061 100644 --- a/src/interfaces/ecpg/compatlib/Makefile +++ b/src/interfaces/ecpg/compatlib/Makefile @@ -5,7 +5,7 @@ # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.38 2008/02/13 18:14:46 momjian Exp $ +# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.39 2008/02/26 06:41:23 petere Exp $ # #------------------------------------------------------------------------- @@ -25,16 +25,14 @@ override CFLAGS += $(PTHREAD_CFLAGS) SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) -lm \ $(PTHREAD_LIBS) +SHLIB_EXPORTS = exports.txt + # Need to recompile any libpgport object files LIBS := $(filter-out -lpgport, $(LIBS)) OBJS= informix.o $(filter snprintf.o, $(LIBOBJS)) -ifeq ($(PORTNAME), win32) -DLL_DEFFILE=libecpg_compatdll.def -endif - -all: def-files all-lib +all: all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib @@ -42,55 +40,6 @@ include $(top_srcdir)/src/Makefile.shlib snprintf.c: % : $(top_srcdir)/src/port/% rm -f $@ && $(LN_S) $< . -# We need several not-quite-identical variants of .DEF files to build libecpg -# DLLs for Windows. These are made from the single source file exports.txt. -# Since we can't assume that Windows boxes will have sed, the .DEF files are -# always built and included in distribution tarballs. - -distprep: def-files - -.PHONY: def-files - -def-files: $(srcdir)/libecpg_compatdll.def $(srcdir)/blibecpg_compatdll.def - -$(srcdir)/libecpg_compatdll.def: exports.txt - echo '; DEF file for MS VC++' > $@ - echo 'LIBRARY LIBECPG_COMPAT' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@ - -$(srcdir)/blibecpg_compatdll.def: exports.txt - echo '; DEF file for Borland C++ Builder' > $@ - echo 'LIBRARY BLIBECPG_COMPAT' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ _\1@ \2/' < $< >> $@ - echo '' >> $@ - echo '; Aliases for MS compatible names' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1= _\1/' < $< | sed 's/ *$$//' >> $@ - -# Where possible, restrict the symbols exported by the library to just the -# official list, so as to avoid unintentional ABI changes. - -ifeq ($(PORTNAME), darwin) -$(shlib): exports.list - -exports.list: exports.txt - $(AWK) '/^[^#]/ {printf "_%s\n",$$1}' $< >$@ - -exported_symbols_list = -exported_symbols_list exports.list -endif - -ifeq ($(PORTNAME), linux) -$(shlib): exports.list - -exports.list: exports.txt - echo '{ global:' >$@ - $(AWK) '/^[^#]/ {printf "%s;\n",$$1}' $< >>$@ - echo ' local: *; };' >>$@ - -exported_symbols_list = -Wl,--version-script=exports.list -endif - install: all installdirs install-lib installdirs: @@ -99,7 +48,6 @@ installdirs: uninstall: uninstall-lib clean distclean: clean-lib - rm -f $(OBJS) snprintf.c exports.list + rm -f $(OBJS) snprintf.c -maintainer-clean: distclean - rm -f $(srcdir)/libecpg_compatdll.def $(srcdir)/blibecpg_compatdll.def +maintainer-clean: distclean maintainer-clean-lib diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile index 32d06b89ff8..d7f0a86aa93 100644 --- a/src/interfaces/ecpg/ecpglib/Makefile +++ b/src/interfaces/ecpg/ecpglib/Makefile @@ -5,7 +5,7 @@ # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.55 2008/02/13 18:14:46 momjian Exp $ +# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.56 2008/02/26 06:41:24 petere Exp $ # #------------------------------------------------------------------------- @@ -36,13 +36,14 @@ endif SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) -lm $(PTHREAD_LIBS) +SHLIB_EXPORTS = exports.txt + ifeq ($(PORTNAME), win32) # Link to shfolder.dll instead of shell32.dll SHLIB_LINK += -lshfolder -DLL_DEFFILE=libecpgdll.def endif -all: def-files all-lib +all: all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib @@ -60,55 +61,6 @@ path.o: path.c $(top_builddir)/src/port/pg_config_paths.h $(top_builddir)/src/port/pg_config_paths.h: $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h -# We need several not-quite-identical variants of .DEF files to build libecpg -# DLLs for Windows. These are made from the single source file exports.txt. -# Since we can't assume that Windows boxes will have sed, the .DEF files are -# always built and included in distribution tarballs. - -distprep: def-files - -.PHONY: def-files - -def-files: $(srcdir)/libecpgdll.def $(srcdir)/blibecpgdll.def - -$(srcdir)/libecpgdll.def: exports.txt - echo '; DEF file for MS VC++' > $@ - echo 'LIBRARY LIBECPG' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@ - -$(srcdir)/blibecpgdll.def: exports.txt - echo '; DEF file for Borland C++ Builder' > $@ - echo 'LIBRARY BLIBECPG' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ _\1@ \2/' < $< >> $@ - echo '' >> $@ - echo '; Aliases for MS compatible names' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1= _\1/' < $< | sed 's/ *$$//' >> $@ - -# Where possible, restrict the symbols exported by the library to just the -# official list, so as to avoid unintentional ABI changes. - -ifeq ($(PORTNAME), darwin) -$(shlib): exports.list - -exports.list: exports.txt - $(AWK) '/^[^#]/ {printf "_%s\n",$$1}' $< >$@ - -exported_symbols_list = -exported_symbols_list exports.list -endif - -ifeq ($(PORTNAME), linux) -$(shlib): exports.list - -exports.list: exports.txt - echo '{ global:' >$@ - $(AWK) '/^[^#]/ {printf "%s;\n",$$1}' $< >>$@ - echo ' local: *; };' >>$@ - -exported_symbols_list = -Wl,--version-script=exports.list -endif - install: all installdirs install-lib installdirs: @@ -118,7 +70,6 @@ uninstall: uninstall-lib clean distclean: clean-lib rm -f $(OBJS) - rm -f path.c pgstrcasecmp.c snprintf.c strlcpy.c thread.c exports.list + rm -f path.c pgstrcasecmp.c snprintf.c strlcpy.c thread.c -maintainer-clean: distclean - rm -f $(srcdir)/libecpgdll.def $(srcdir)/blibecpgdll.def +maintainer-clean: distclean maintainer-clean-lib diff --git a/src/interfaces/ecpg/pgtypeslib/Makefile b/src/interfaces/ecpg/pgtypeslib/Makefile index 6b468c8bc0b..1397167bde1 100644 --- a/src/interfaces/ecpg/pgtypeslib/Makefile +++ b/src/interfaces/ecpg/pgtypeslib/Makefile @@ -5,7 +5,7 @@ # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.40 2008/02/13 18:14:46 momjian Exp $ +# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.41 2008/02/26 06:41:24 petere Exp $ # #------------------------------------------------------------------------- @@ -27,68 +27,17 @@ LIBS := $(filter-out -lpgport, $(LIBS)) SHLIB_LINK += -lm +SHLIB_EXPORTS = exports.txt + OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \ pgstrcasecmp.o \ $(filter rint.o snprintf.o, $(LIBOBJS)) -ifeq ($(PORTNAME), win32) -DLL_DEFFILE=libpgtypesdll.def -endif - -all: def-files all-lib +all: all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib -# We need several not-quite-identical variants of .DEF files to build libecpg -# DLLs for Windows. These are made from the single source file exports.txt. -# Since we can't assume that Windows boxes will have sed, the .DEF files are -# always built and included in distribution tarballs. - -distprep: def-files - -.PHONY: def-files - -def-files: $(srcdir)/libpgtypesdll.def $(srcdir)/blibpgtypesdll.def - -$(srcdir)/libpgtypesdll.def: exports.txt - echo '; DEF file for MS VC++' > $@ - echo 'LIBRARY LIBPGTYPES' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@ - -$(srcdir)/blibpgtypesdll.def: exports.txt - echo '; DEF file for Borland C++ Builder' > $@ - echo 'LIBRARY BLIBPGTYPES' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ _\1@ \2/' < $< >> $@ - echo '' >> $@ - echo '; Aliases for MS compatible names' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1= _\1/' < $< | sed 's/ *$$//' >> $@ - -# Where possible, restrict the symbols exported by the library to just the -# official list, so as to avoid unintentional ABI changes. - -ifeq ($(PORTNAME), darwin) -$(shlib): exports.list - -exports.list: exports.txt - $(AWK) '/^[^#]/ {printf "_%s\n",$$1}' $< >$@ - -exported_symbols_list = -exported_symbols_list exports.list -endif - -ifeq ($(PORTNAME), linux) -$(shlib): exports.list - -exports.list: exports.txt - echo '{ global:' >$@ - $(AWK) '/^[^#]/ {printf "%s;\n",$$1}' $< >>$@ - echo ' local: *; };' >>$@ - -exported_symbols_list = -Wl,--version-script=exports.list -endif - # We use some port modules verbatim, but since we need to # compile with appropriate options to build a shared lib, we can't # necessarily use the same object files as the backend uses. Instead, @@ -105,7 +54,6 @@ installdirs: uninstall: uninstall-lib clean distclean: clean-lib - rm -f $(OBJS) pgstrcasecmp.c rint.c snprintf.c exports.list + rm -f $(OBJS) pgstrcasecmp.c rint.c snprintf.c -maintainer-clean: distclean - rm -f $(srcdir)/libpgtypesdll.def $(srcdir)/blibpgtypesdll.def +maintainer-clean: distclean maintainer-clean-lib diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index ff2a50b5c21..c44c425e41c 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -5,7 +5,7 @@ # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.160 2008/02/13 18:14:46 momjian Exp $ +# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.161 2008/02/26 06:41:24 petere Exp $ # #------------------------------------------------------------------------- @@ -42,7 +42,6 @@ endif ifeq ($(PORTNAME), win32) OBJS += win32.o pgsleep.o libpqrc.o -DLL_DEFFILE=libpqdll.def libpqrc.o: libpq.rc windres -i libpq.rc -o libpqrc.o @@ -65,8 +64,9 @@ ifeq ($(PORTNAME), win32) SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS)) endif +SHLIB_EXPORTS = exports.txt -all: def-files $(srcdir)/libpq.rc all-lib +all: $(srcdir)/libpq.rc all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib @@ -90,62 +90,7 @@ encnames.c wchar.c : % : $(backend_src)/utils/mb/% rm -f $@ && $(LN_S) $< . -# We need several not-quite-identical variants of .DEF files to build libpq -# DLLs for Windows. These are made from the single source file exports.txt. -# Since we can't assume that Windows boxes will have sed, the .DEF files are -# always built and included in distribution tarballs. - -distprep: def-files $(srcdir)/libpq.rc - -.PHONY: def-files - -def-files: $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def - -$(srcdir)/libpqdll.def: exports.txt - echo '; DEF file for MS VC++' > $@ - echo 'LIBRARY LIBPQ' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@ - -$(srcdir)/libpqddll.def: exports.txt - echo '; DEF file for MS VC++' > $@ - echo 'LIBRARY LIBPQD' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@ - -$(srcdir)/blibpqdll.def: exports.txt - echo '; DEF file for Borland C++ Builder' > $@ - echo 'LIBRARY BLIBPQ' >> $@ - echo 'EXPORTS' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ _\1@ \2/' < $< >> $@ - echo '' >> $@ - echo '; Aliases for MS compatible names' >> $@ - sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/ \1= _\1/' < $< | sed 's/ *$$//' >> $@ - -# Where possible, restrict the symbols exported by the library to just the -# official list, so as to avoid unintentional ABI changes. On recent Darwin -# this also quiets multiply-defined-symbol warnings in programs that use -# libpgport along with libpq. - -ifeq ($(PORTNAME), darwin) -$(shlib): exports.list - -exports.list: exports.txt - $(AWK) '/^[^#]/ {printf "_%s\n",$$1}' $< >$@ - -exported_symbols_list = -exported_symbols_list exports.list -endif - -ifeq ($(PORTNAME), linux) -$(shlib): exports.list - -exports.list: exports.txt - echo '{ global:' >$@ - $(AWK) '/^[^#]/ {printf "%s;\n",$$1}' $< >>$@ - echo ' local: *; };' >>$@ - -exported_symbols_list = -Wl,--version-script=exports.list -endif +distprep: $(srcdir)/libpq.rc # depend on Makefile.global to force rebuild on re-run of configure $(srcdir)/libpq.rc: libpq.rc.in $(top_builddir)/src/Makefile.global @@ -169,9 +114,9 @@ uninstall: uninstall-lib rm -f '$(DESTDIR)$(includedir)/libpq-fe.h' '$(DESTDIR)$(includedir_internal)/libpq-int.h' '$(DESTDIR)$(includedir_internal)/pqexpbuffer.h' '$(DESTDIR)$(datadir)/pg_service.conf.sample' clean distclean: clean-lib - rm -f $(OBJS) pg_config_paths.h crypt.c getaddrinfo.c inet_aton.c noblock.c open.c pgstrcasecmp.c snprintf.c strerror.c strlcpy.c thread.c md5.c ip.c encnames.c wchar.c win32error.c pgsleep.c pthread.h exports.list + rm -f $(OBJS) pg_config_paths.h crypt.c getaddrinfo.c inet_aton.c noblock.c open.c pgstrcasecmp.c snprintf.c strerror.c strlcpy.c thread.c md5.c ip.c encnames.c wchar.c win32error.c pgsleep.c pthread.h # Might be left over from a Win32 client-only build rm -f pg_config_paths.h -maintainer-clean: distclean - rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def $(srcdir)/libpq.rc +maintainer-clean: distclean maintainer-clean-lib + rm -f $(srcdir)/libpq.rc |
