aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq++/Makefile
blob: fb619a90d3124edb078791104de1e636aa100e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#-------------------------------------------------------------------------
#
# Makefile
#    Makefile for libpq++ library
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.19 1998/07/12 19:20:45 momjian Exp $
#
#-------------------------------------------------------------------------

SRCDIR= ../..
include $(SRCDIR)/Makefile.global
SRCHEADERDIR = $(SRCDIR)/include
LIBPQHEADERDIR = $(SRCHEADERDIR)/libpq

LIBNAME= libpq++

# We have to override -Werror, which makes warnings, fatal, because we
# inevitably get the warning, "abstract declarator used as declaration"
# because of our inclusion of c.h and we don't know how to stop that.

CXXFLAGS= $(CFLAGS) -Wno-error

INCLUDE_OPT= \
             -I$(SRCDIR)/backend \
             -I$(SRCHEADERDIR) \
             -I$(LIBPQDIR)

CXXFLAGS+= $(INCLUDE_OPT)
#CXXFLAGS+= -DDEBUG

ifdef KRBVERS
CXXFLAGS+= $(KRBFLAGS)
endif


OBJS = pgenv.o pgconnection.o pgtransdb.o pgcursordb.o pglobject.o

# Shared library stuff
SHLIB := 
INSTALL-SHLIB-DEP :=
ifeq ($(PORTNAME), linux)
  INSTALL-SHLIB-DEP := install-shlib
  SHLIB := libpq++.so.1
  LDFLAGS_SL = -shared -soname $(SHLIB)
  CFLAGS += $(CFLAGS_SL)
endif

ifeq ($(PORTNAME), solaris)
  INSTALL-SHLIB-DEP := install-shlib
  SHLIB := libpq++.so.1
  LDFLAGS_SL = -G -z text -shared -soname $(SHLIB)
  CFLAGS += $(CFLAGS_SL)
endif

ifeq ($(PORTNAME), hpux)
  install-shlib-dep := install-shlib
  shlib := libpq.sl
  LDFLAGS_SL = -b
  CFLAGS += $(CFLAGS_SL)
endif

all: $(LIBNAME).a $(SHLIB)

$(LIBNAME).a: $(OBJS)
ifdef MK_NO_LORDER
	$(AR) $(AROPT) $(LIBNAME).a $(OBJS)
else
	$(AR) $(AROPT) $(LIBNAME).a `lorder $(OBJS) | tsort`
endif
	$(RANLIB) $(LIBNAME).a

$(SHLIB): $(OBJS)
	$(LD) $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(OBJS)

.PHONY: examples
examples:
	$(MAKE) -C examples all

.PHONY: beforeinstall-headers install-headers 
.PHONY: install beforeinstall-lib install-$(LIBNAME) doc

install: install-headers install-$(LIBNAME) $(INSTALL-SHLIB-DEP) doc

LIBPGXXDIR = $(LIBNAME)
LIBPGXXHEADERDIR = $(HEADERDIR)/$(LIBPGXXDIR)
MAINHEADER = $(LIBNAME).h
LIBPGXXHEADERS = pgenv.h \
		 pgconnection.h \
		 pgdatabase.h \
		 pgtransdb.h \
		 pgcursordb.h \
		 pglobject.h

install-headers: beforeinstall-headers $(MAINHEADER)
	@$(INSTALL) $(INSTLOPTS) $(MAINHEADER) $(HEADERDIR)/$(MAINHEADER)
	@for i in ${LIBPGXXHEADERS}; do \
		echo "Installing $(LIBPGXXHEADERDIR)/$$i."; \
		$(INSTALL) $(INSTLOPTS) $$i $(LIBPGXXHEADERDIR)/$$i; \
	done

beforeinstall-headers:
	@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
	@if [ ! -d $(LIBPGXXHEADERDIR) ]; then mkdir $(LIBPGXXHEADERDIR); fi

beforeinstall-lib:
	@if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR); fi

install-$(LIBNAME): $(LIBNAME).a beforeinstall-lib
	$(INSTALL) $(INSTL_LIB_OPTS) $(LIBNAME).a $(LIBDIR)/$(LIBNAME).a

install-shlib: $(SHLIBNAME) beforeinstall-lib
	$(INSTALL) $(INSTL_SHLIB_OPTS) $(SHLIB) $(LIBDIR)/$(SHLIB)
	rm -f $(LIBDIR)/libpq++.so
	ln -sf $(SHLIB) $(LIBDIR)/libpq++.so


doc:
	$(MAKE) -C man install

clean:
	rm -f $(LIBNAME).a $(OBJS)
	$(MAKE) -C examples clean

dep depend:
	$(CXX) -MM $(CXXFLAGS) *.cc > depend

ifeq (depend,$(wildcard depend))
include depend
endif