]> granicus.if.org Git - postgresql/blob - src/interfaces/ecpg/ecpglib/Makefile
Results from buildfarm show that ecpglib was depending on pg_strcasecmp,
[postgresql] / src / interfaces / ecpg / ecpglib / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for ecpg library
4 #
5 # Copyright (c) 1994, Regents of the University of California
6 #
7 # $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.52 2007/10/04 20:54:08 tgl Exp $
8 #
9 #-------------------------------------------------------------------------
10
11 subdir = src/interfaces/ecpg/ecpglib
12 top_builddir = ../../../..
13 include $(top_builddir)/src/Makefile.global
14
15 NAME= ecpg
16 SO_MAJOR_VERSION= 6
17 SO_MINOR_VERSION= 0
18 DLTYPE= library
19
20 override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
21         -I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
22 override CFLAGS += $(PTHREAD_CFLAGS)
23
24 # Need to recompile any libpgport object files
25 LIBS := $(filter-out -lpgport, $(LIBS))
26
27 OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
28         connect.o misc.o path.o pgstrcasecmp.o \
29         $(filter snprintf.o strlcpy.o, $(LIBOBJS))
30
31 # thread.c is needed only for non-WIN32 implementation of path.c
32 ifneq ($(PORTNAME), win32)
33 OBJS += thread.o
34 endif
35
36 SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) -lm $(PTHREAD_LIBS)
37
38 ifeq ($(PORTNAME), win32)
39 # Link to shfolder.dll instead of shell32.dll
40 SHLIB_LINK += -lshfolder
41 DLL_DEFFILE=libecpgdll.def
42 endif
43
44 all: def-files all-lib
45
46 # Shared library stuff
47 include $(top_srcdir)/src/Makefile.shlib
48
49 # We use some port modules verbatim, but since we need to
50 # compile with appropriate options to build a shared lib, we can't
51 # necessarily use the same object files as the backend uses. Instead,
52 # symlink the source files in here and build our own object file.
53
54 path.c pgstrcasecmp.c snprintf.c strlcpy.c thread.c: % : $(top_srcdir)/src/port/%
55         rm -f $@ && $(LN_S) $< .
56
57 path.o: path.c $(top_builddir)/src/port/pg_config_paths.h
58
59 $(top_builddir)/src/port/pg_config_paths.h:
60         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
61
62 # We need several not-quite-identical variants of .DEF files to build libecpg
63 # DLLs for Windows.  These are made from the single source file exports.txt.
64 # Since we can't assume that Windows boxes will have sed, the .DEF files are
65 # always built and included in distribution tarballs.
66
67 .PHONY: def-files
68 def-files: $(srcdir)/libecpgdll.def $(srcdir)/blibecpgdll.def
69
70 $(srcdir)/libecpgdll.def: exports.txt
71         echo '; DEF file for MS VC++' > $@
72         echo 'LIBRARY LIBECPG' >> $@
73         echo 'EXPORTS' >> $@
74         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1@ \2/' < $< >> $@
75
76 $(srcdir)/blibecpgdll.def: exports.txt
77         echo '; DEF file for Borland C++ Builder' > $@
78         echo 'LIBRARY BLIBECPG' >> $@
79         echo 'EXPORTS' >> $@
80         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    _\1@ \2/' < $< >> $@
81         echo '' >> $@
82         echo '; Aliases for MS compatible names' >> $@
83         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@
84
85 # Where possible, restrict the symbols exported by the library to just the
86 # official list, so as to avoid unintentional ABI changes.
87
88 ifeq ($(PORTNAME), darwin)
89 $(shlib): exports.list
90
91 exports.list: exports.txt
92         $(AWK) '/^[^#]/ {printf "_%s\n",$$1}' $< >$@
93
94 exported_symbols_list = -exported_symbols_list exports.list
95 endif
96
97 ifeq ($(PORTNAME), linux)
98 $(shlib): exports.list
99
100 exports.list: exports.txt
101         echo '{ global:' >$@
102         $(AWK) '/^[^#]/ {printf "%s;\n",$$1}' $< >>$@
103         echo ' local: *; };' >>$@
104
105 exported_symbols_list = -Wl,--version-script=exports.list
106 endif
107
108 install: all installdirs install-lib
109
110 installdirs:
111         $(mkinstalldirs) '$(DESTDIR)$(libdir)'
112
113 uninstall: uninstall-lib
114
115 clean distclean maintainer-clean: clean-lib
116         rm -f $(OBJS)
117         rm -f path.c pgstrcasecmp.c snprintf.c strlcpy.c thread.c exports.list