44#
55# Copyright (c) 1994, Regents of the University of California
66#
7- # $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.62 2002/06/14 04:23:17 momjian Exp $
7+ # $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.63 2002/07/18 03:59:49 momjian Exp $
88#
99# -------------------------------------------------------------------------
1010
1111subdir = src/interfaces/libpq
1212top_builddir = ../../..
1313include $(top_builddir ) /src/Makefile.global
1414
15+
1516# shared library parameters
1617NAME = pq
1718SO_MAJOR_VERSION = 2
@@ -21,12 +22,13 @@ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconf
2122
2223OBJS = fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o\
2324 pqexpbuffer.o dllist.o md5.o pqsignal.o fe-secure.o\
24- $(INET_ATON ) $(SNPRINTF ) $(STRERROR )
25+ $(notdir $( INET_ATON )) $(notdir $( SNPRINTF )) $(notdir $( STRERROR ) )
2526
2627ifdef MULTIBYTE
2728OBJS+ = wchar.o encnames.o
2829endif
2930
31+
3032# Add libraries that libpq depends (or might depend) on into the
3133# shared library link. (The order in which you list them here doesn't
3234# matter.)
@@ -37,32 +39,35 @@ all: all-lib
3739
3840# Shared library stuff
3941include $(top_srcdir ) /src/Makefile.shlib
40-
41-
42- # We use several backend modules verbatim, but since we need to
43- # compile with appropriate options to build a shared lib, we can't
44- # necessarily use the same object files as the backend uses. Instead,
45- # symlink the source files in here and build our own object file.
46-
4742backend_src =$(top_srcdir ) /src/backend
4843
44+
4945dllist.c :$(backend_src ) /lib/dllist.c
5046rm -f$@ && $(LN_S ) $< .
5147
5248md5.c :$(backend_src ) /libpq/md5.c
5349rm -f$@ && $(LN_S ) $< .
5450
51+ # We use several backend modules verbatim, but since we need to
52+ # compile with appropriate options to build a shared lib, we can't
53+ # necessarily use the same object files as the backend uses. Instead,
54+ # symlink the source files in here and build our own object file.
5555# this only gets done if configure finds system doesn't have inet_aton()
56- inet_aton.c :$(backend_src ) /port/inet_aton.c
56+
57+ ifdef INET_ATON
58+ $(basename $(notdir $(INET_ATON ) ) ) .c :$(basename $(INET_ATON ) ) .c
5759rm -f$@ && $(LN_S ) $< .
60+ endif
5861
59- # this only gets done if configure finds system doesn't have snprintf()
60- snprintf .c :$(backend_src ) /port/snprintf .c
62+ ifdef SNPRINTF
63+ $( basename $( notdir $( SNPRINTF ) ) ) .c :$(basename $( SNPRINTF ) ) .c
6164rm -f$@ && $(LN_S ) $< .
65+ endif
6266
63- # this only gets done if configure finds system doesn't have strerror()
64- strerror .c :$(backend_src ) /port/strerror .c
67+ ifdef STRERROR
68+ $( basename $( notdir $( STRERROR ) ) ) .c :$(basename $( STRERROR ) ) .c
6569rm -f$@ && $(LN_S ) $< .
70+ endif
6671
6772ifdef MULTIBYTE
6873wchar.c :% :$(backend_src ) /utils/mb/%