1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Centralized shared-library build knowledge in a new file,

src/Makefile.shlib.  Updated all the makefiles that try to build shlibs
to include that file instead of having duplicate (and mostly incomplete)
copies of shared-library options.  It works on HPUX, a lot better than it
did before in fact, but there's a chance I broke some other platforms.
At least now you only have to fix one place not six...
This commit is contained in:
Tom Lane
1998-10-19 00:00:51 +00:00
parent 6e13e0c684
commit 6d98d3737a
9 changed files with 303 additions and 628 deletions

View File

@@ -5,9 +5,8 @@
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile.in,v 1.9 1998/10/18 19:40:55 tgl Exp $
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile.in,v 1.10 1998/10/19 00:00:46 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -18,148 +17,50 @@ SO_MINOR_VERSION= 0
SRCDIR= @top_srcdir@
include $(SRCDIR)/Makefile.global
PORTNAME=@PORTNAME@
CXX=@CXX@
SRCHEADERDIR = $(SRCDIR)/include
LIBPQHEADERDIR = $(SRCHEADERDIR)/libpq
# We have to override -Werror, which makes warnings, fatal, because we
# 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.
ifeq ($(CXX), g++)
CXXFLAGS= $(CFLAGS) -Wno-error
CXXFLAGS= -Wno-error
else
CXXFLAGS= $(CFLAGS)
CXXFLAGS=
endif
INCLUDE_OPT= \
-I$(SRCDIR)/backend \
CXXFLAGS+= -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 :=
SHLIB_LINK= -L../libpq -lpq
ifeq ($(PORTNAME), linux)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -shared -soname lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(PORTNAME), bsd)
ifdef BSD_SHLIB
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -x -Bshareable -Bforcearchive
CFLAGS += $(CFLAGS_SL)
endif
endif
ifeq ($(PORTNAME), bsdi)
ifdef BSD_SHLIB
ifeq ($(DLSUFFIX), .so)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL += -shared
CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(DLSUFFIX), .o)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LD := shlicc
LDFLAGS_SL += -O -r
CFLAGS += $(CFLAGS_SL)
endif
endif
endif
ifeq ($(PORTNAME), solaris_sparc)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(PORTNAME), solaris_i386)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(PORTNAME), svr4)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(PORTNAME), unixware)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G -z text
CFLAGS += $(CFLAGS_SL)
ifeq ($(CXX), CC)
CXXFLAGS += -Xw
COMPILE.cc = $(CXX) $(CXXFLAGS:ll,alloca=ll) $(CPPFLAGS) $(TARGET_ARCH) -c
endif
endif
ifeq ($(PORTNAME), univel)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G -z text
CFLAGS += $(CFLAGS_SL)
ifeq ($(CXX), CC)
CXXFLAGS += -Xw
COMPILE.cc = $(CXX) $(CXXFLAGS:ll,alloca=ll) $(CPPFLAGS) $(TARGET_ARCH) -c
endif
endif
ifeq ($(PORTNAME), hpux)
install-shlib-dep := install-shlib
shlib := lib$(NAME).sl
LDFLAGS_SL := -b
CFLAGS += $(CFLAGS_SL)
endif
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
all: libpq++.a $(shlib)
# Pull shared-lib CFLAGS into CXXFLAGS
CXXFLAGS+= $(CFLAGS)
libpq++.a: $(OBJS)
ifdef MK_NO_LORDER
$(AR) $(AROPT) libpq++.a $(OBJS)
else
$(AR) $(AROPT) libpq++.a `lorder $(OBJS) | tsort`
endif
$(RANLIB) libpq++.a
$(shlib): $(OBJS)
$(LD) $(LDFLAGS_SL) -o $@ $(OBJS)
.PHONY: examples
examples:
$(MAKE) -C examples all
.PHONY: beforeinstall-headers install-headers
.PHONY: install beforeinstall-lib install-libpq++ install-shlib
.PHONY: install beforeinstall-headers install-headers
install: install-headers install-libpq++ $(install-shlib-dep)
install: install-headers install-lib $(install-shlib-dep)
LIBPGXXDIR = libpq++
LIBPGXXHEADERDIR = $(HEADERDIR)/$(LIBPGXXDIR)
@@ -182,32 +83,13 @@ 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-libpq++: libpq++.a beforeinstall-lib
$(INSTALL) $(INSTL_LIB_OPTS) libpq++.a $(LIBDIR)/libpq++.a
install-shlib: $(shlib)
$(INSTALL) $(INSTL_SHLIB_OPTS) $(shlib) $(LIBDIR)/$(shlib)
if [ "$(shlib)" != "lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)" ]; then \
cd $(LIBDIR); \
rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION); \
$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION); \
fi
if [ "$(shlib)" != "lib$(NAME)$(DLSUFFIX)" ]; then \
cd $(LIBDIR); \
rm -f lib$(NAME)$(DLSUFFIX); \
$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX); \
fi
.PHONY: clean
clean:
rm -f libpq++.a $(shlib) $(OBJS)
$(MAKE) -C examples clean
dep depend:
$(CXX) -MM $(CXXFLAGS) *.cc > depend
$(CXX) -MM $(CXXFLAGS) *.cc >depend
ifeq (depend,$(wildcard depend))
include depend