aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/Makefile
blob: ce1bee8d37de632a90df46b15ac818a6ed412520 (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
#-------------------------------------------------------------------------
#
# Makefile
#    Makefile for libpq library
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.6 1996/09/23 18:14:08 scrappy Exp $
#
#-------------------------------------------------------------------------

MKDIR=	../mk
include $(MKDIR)/postgres.mk

CFLAGS+= -I../backend/include \
	-I../include \
	-I../backend \
	-I. \

ifdef KRBVERS
CFLAGS+= $(KRBFLAGS)
endif

# dllist.c is found in backend/lib
VPATH:= $(VPATH):../backend/lib

LIBSRCS= fe-auth.c fe-connect.c fe-exec.c fe-misc.c fe-lobj.c \
	dllist.c pqsignal.c 
ifeq ($(PORTNAME), next)
VPATH:=$(VPATH):../backend/port/$(PORTNAME)
LIBSRCS+= getcwd.c putenv.c
endif

all::   libpq.a postgres.h c.h

postgres.h: ../backend/include/postgres.h
# Note: ../backend/include/postgres.h needs to be named something different
# to avoid confusion with this thing we're building now.
#
# hardwire NAMEDATALEN and OIDNAMELEN into the postgres.h for this installation
	rm -f obj/postgres.h
	echo "#define NAMEDATALEN $(NAMEDATALEN)" >> obj/postgres.h
	echo "#define OIDNAMELEN $(OIDNAMELEN)" >> obj/postgres.h
	cat ../backend/include/postgres.h >> obj/postgres.h
	
c.h: ../backend/include/c.h
	rm -f obj/c.h
	echo "#undef PORTNAME" >  obj/c.h
	echo "#define PORTNAME $(PORTNAME)" >> obj/c.h
	echo "#undef PORTNAME_$(PORTNAME)" >>  obj/c.h
	echo "#define PORTNAME_$(PORTNAME)" >> obj/c.h
	cat ../backend/include/c.h >> obj/c.h

.PHONY: beforeinstall-headers install-headers

ifndef NO_BEFOREINSTL
beforeinstall-headers:
	@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
	@if [ ! -d $(HEADERDIR)/port ]; then mkdir $(HEADERDIR)/port; fi
	@if [ ! -d $(HEADERDIR)/port/$(PORTNAME) ]; \
		then mkdir $(HEADERDIR)/port/$(PORTNAME); fi
	@if [ ! -d $(HEADERDIR)/include ]; \
		then mkdir $(HEADERDIR)/include; fi
	@if [ ! -d $(HEADERDIR)/lib ]; \
		then mkdir $(HEADERDIR)/lib; fi
	@if [ ! -d $(HEADERDIR)/libpq ]; \
		then mkdir $(HEADERDIR)/libpq; fi
	@if [ ! -d $(HEADERDIR)/utils ]; \
		then mkdir $(HEADERDIR)/utils; fi
else
beforeinstall-headers: .dosomething
endif

TEMPDIR=obj

install-headers: beforeinstall-headers postgres.h c.h
	$(INSTALL) $(INSTLOPTS) ../backend/include/postgres.h \
          $(HEADERDIR)/postgres.h
	$(INSTALL) $(INSTLOPTS) ../include/libpq/pqcomm.h \
          $(HEADERDIR)/libpq/pqcomm.h
	$(INSTALL) $(INSTLOPTS) ../include/libpq/libpq-fs.h \
          $(HEADERDIR)/libpq/libpq-fs.h
	$(INSTALL) $(INSTLOPTS) ../include/lib/dllist.h \
          $(HEADERDIR)/libpq/dllist.h
	$(INSTALL) $(INSTLOPTS) ../include/utils/geo-decls.h \
          $(HEADERDIR)/utils/geo-decls.h
	$(INSTALL) $(INSTLOPTS) libpq-fe.h $(HEADERDIR)/libpq-fe.h
ifeq ($(PORTNAME), hpux)
	$(INSTALL) $(INSTLOPTS) ../backend/port/hpux/fixade.h \
          $(HEADERDIR)/port/hpux/fixade.h
endif
	$(INSTALL) $(INSTLOPTS) obj/c.h $(HEADERDIR)/c.h
	$(INSTALL) $(INSTLOPTS) obj/postgres.h $(HEADERDIR)/postgres.h

install:: install-headers

CLEANFILES+= c.h postgres.h

LIB= pq
include $(MKDIR)/postgres.lib.mk