Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b216c1e

Browse files
author
Bryan Henderson
committed
Continuation of make file simplification; deal with header file shuffle.
1 parent 31e8156 commit b216c1e

File tree

1 file changed

+87
-52
lines changed

1 file changed

+87
-52
lines changed

src/interfaces/libpq/Makefile

Lines changed: 87 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.8 1996/10/25 09:22:30 bryanh Exp $
10+
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.9 1996/11/02 09:54:44 bryanh Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

14-
MKDIR= ../mk
15-
include $(MKDIR)/postgres.mk
14+
SRCDIR= ..
15+
include ../Makefile.global
1616

17-
CFLAGS+= -I../backend/include \
18-
-I../include \
19-
-I../backend \
20-
-I. \
17+
INCLUDE_OPT= \
18+
-I. \
19+
-I../include \
20+
-I../backend \
2121

22-
CFLAGS+= -DPOSTPORT='"$(POSTPORT)"'
22+
CFLAGS+= $(INCLUDE_OPT) -DPOSTPORT='"$(POSTPORT)"'
2323

2424
ifdef KRBVERS
2525
CFLAGS+= $(KRBFLAGS)
@@ -28,58 +28,65 @@ endif
2828
# dllist.c is found in backend/lib
2929
VPATH:= $(VPATH):../backend/lib
3030

31-
LIBSRCS= fe-auth.c fe-connect.c fe-exec.c fe-misc.c fe-lobj.c \
32-
dllist.c pqsignal.c
31+
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-lobj.o \
32+
../backend/lib/dllist.o pqsignal.o
3333
ifeq ($(PORTNAME), next)
3434
VPATH:=$(VPATH):../backend/port/$(PORTNAME)
35-
LIBSRCS+= getcwd.c putenv.c
35+
OBJS+= getcwd.o putenv.o
3636
endif
3737

38-
all:: libpq.a postgres.h c.h
38+
ifdef LINUX_ELF
39+
shlib := libpq.so.1
40+
else
41+
shlib :=
42+
endif
43+
44+
all: libpq.a $(shlib) postgres.h c.h
45+
46+
libpq.a: $(OBJS)
47+
ifdef MK_NO_LORDER
48+
$(AR) $(AROPT) libpq.a $(OBJS)
49+
else
50+
$(AR) $(AROPT) libpq.a `lorder $(OBJS) | tsort`
51+
endif
52+
$(RANLIB) libpq.a
3953

40-
postgres.h: ../backend/include/postgres.h
54+
libpq.so.1: $(OBJS)
55+
$(CC) $(LDFLAGS) -shared $(OBJS) -o libpq.so.1
56+
57+
# If dllist.o is out of date, we will not cause it to get remade. We
58+
# only make it if it doesn't exist.
59+
60+
../backend/lib/dllist.o:
61+
$(MAKE) -C ../backend/lib dllist.o
62+
63+
postgres.h: ../include/postgres.h
4164
# Note: ../backend/include/postgres.h needs to be named something different
4265
# to avoid confusion with this thing we're building now.
4366
#
4467
# hardwire NAMEDATALEN and OIDNAMELEN into the postgres.h for this installation
45-
rm -f obj/postgres.h
46-
echo "#define NAMEDATALEN $(NAMEDATALEN)" >> obj/postgres.h
47-
echo "#define OIDNAMELEN $(OIDNAMELEN)" >> obj/postgres.h
48-
cat ../backend/include/postgres.h >> obj/postgres.h
68+
rm -f postgres.h
69+
echo "#define NAMEDATALEN $(NAMEDATALEN)" >> postgres.h
70+
echo "#define OIDNAMELEN $(OIDNAMELEN)" >> postgres.h
71+
cat ../include/postgres.h >> postgres.h
4972

50-
c.h: ../backend/include/c.h
51-
rm -f obj/c.h
52-
echo "#undef PORTNAME" > obj/c.h
53-
echo "#define PORTNAME $(PORTNAME)" >> obj/c.h
54-
echo "#undef PORTNAME_$(PORTNAME)" >> obj/c.h
55-
echo "#define PORTNAME_$(PORTNAME)" >> obj/c.h
56-
cat ../backend/include/c.h >> obj/c.h
73+
c.h: ../include/c.h
74+
rm -f c.h
75+
echo "#undef PORTNAME" > c.h
76+
echo "#define PORTNAME $(PORTNAME)" >> c.h
77+
echo "#undef PORTNAME_$(PORTNAME)" >> c.h
78+
echo "#define PORTNAME_$(PORTNAME)" >> c.h
79+
cat ../include/c.h >> c.h
5780

5881
.PHONY: beforeinstall-headers install-headers
82+
.PHONY: install install-libpq install-shlib-dep
5983

60-
ifndef NO_BEFOREINSTL
61-
beforeinstall-headers:
62-
@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
63-
@if [ ! -d $(HEADERDIR)/port ]; then mkdir $(HEADERDIR)/port; fi
64-
@if [ ! -d $(HEADERDIR)/port/$(PORTNAME) ]; \
65-
then mkdir $(HEADERDIR)/port/$(PORTNAME); fi
66-
@if [ ! -d $(HEADERDIR)/include ]; \
67-
then mkdir $(HEADERDIR)/include; fi
68-
@if [ ! -d $(HEADERDIR)/lib ]; \
69-
then mkdir $(HEADERDIR)/lib; fi
70-
@if [ ! -d $(HEADERDIR)/libpq ]; \
71-
then mkdir $(HEADERDIR)/libpq; fi
72-
@if [ ! -d $(HEADERDIR)/utils ]; \
73-
then mkdir $(HEADERDIR)/utils; fi
74-
else
75-
beforeinstall-headers: .dosomething
76-
endif
77-
78-
TEMPDIR=obj
84+
install: install-headers install-libpq $(install-shlib-dep)
7985

80-
install-headers: beforeinstall-headers postgres.h c.h
81-
$(INSTALL) $(INSTLOPTS) ../backend/include/postgres.h \
82-
$(HEADERDIR)/postgres.h
86+
install-headers: beforeinstall-headers postgres.h c.h \
87+
../include/config.h ../include/libpq/pqcomm.h \
88+
../include/libpq/libpq-fs.h ../include/lib/dllist.h \
89+
../include/utils/geo-decls.h libpq.fe.h
8390
$(INSTALL) $(INSTLOPTS) ../include/config.h \
8491
$(HEADERDIR)/config.h
8592
$(INSTALL) $(INSTLOPTS) ../include/libpq/pqcomm.h \
@@ -95,14 +102,42 @@ ifeq ($(PORTNAME), hpux)
95102
$(INSTALL) $(INSTLOPTS) ../backend/port/hpux/fixade.h \
96103
$(HEADERDIR)/port/hpux/fixade.h
97104
endif
98-
$(INSTALL) $(INSTLOPTS) obj/c.h $(HEADERDIR)/c.h
99-
$(INSTALL) $(INSTLOPTS) obj/postgres.h $(HEADERDIR)/postgres.h
105+
$(INSTALL) $(INSTLOPTS) c.h $(HEADERDIR)/c.h
106+
$(INSTALL) $(INSTLOPTS) postgres.h $(HEADERDIR)/postgres.h
100107

101-
install:: install-headers
108+
beforeinstall-headers:
109+
@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
110+
@if [ ! -d $(HEADERDIR)/port ]; then mkdir $(HEADERDIR)/port; fi
111+
@if [ ! -d $(HEADERDIR)/port/$(PORTNAME) ]; \
112+
then mkdir $(HEADERDIR)/port/$(PORTNAME); fi
113+
@if [ ! -d $(HEADERDIR)/include ]; \
114+
then mkdir $(HEADERDIR)/include; fi
115+
@if [ ! -d $(HEADERDIR)/lib ]; \
116+
then mkdir $(HEADERDIR)/lib; fi
117+
@if [ ! -d $(HEADERDIR)/libpq ]; \
118+
then mkdir $(HEADERDIR)/libpq; fi
119+
@if [ ! -d $(HEADERDIR)/utils ]; \
120+
then mkdir $(HEADERDIR)/utils; fi
102121

103-
CLEANFILES+= c.h postgres.h
122+
ifdef LINUX_ELF
123+
install-shlib-dep := install-shlib
124+
else
125+
install-shlib-dep :=
126+
endif
127+
128+
install-libpq:
129+
$(INSTALL) $(INSTL_LIB_OPTS) libpq.a $(DESTDIR)$(LIBDIR)/libpq.a
104130

105-
LIB= pq
106-
include $(MKDIR)/postgres.lib.mk
131+
install-shlib:
132+
$(INSTALL) $(INSTL_LIB_OPTS) libpq.so.1 $(DESTDIR)$(LIBDIR)/libpq.so.1
107133

134+
depend dep:
135+
$(CC) -MM $(INCLUDE_OPT) *.c >depend
108136

137+
.PHONY: clean
138+
clean:
139+
rm -f libpq.a libpq.so.1 $(OBJS) c.h postgres.h
140+
141+
ifeq (depend,$(wildcard depend))
142+
include depend
143+
endif

0 commit comments

Comments
 (0)