mirror of https://github.com/postgres/postgres
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...pull/50/head
parent
6e13e0c684
commit
6d98d3737a
@ -0,0 +1,180 @@ |
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile.shlib
|
||||
# Common rules for building shared libraries
|
||||
#
|
||||
# Copyright (c) 1998, Regents of the University of California
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.1 1998/10/19 00:00:40 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# This file should be included by any Postgres module Makefile that wants
|
||||
# to build a shared library (if possible for the current platform).
|
||||
# A static library is also built from the same object files.
|
||||
# RESTRICTION: only one library can be built per makefile...
|
||||
|
||||
# Before including this file, the module Makefile must define these variables:
|
||||
# NAME Name of library to build (no suffix nor "lib" prefix)
|
||||
# SO_MAJOR_VERSION Major version number to use for shared library
|
||||
# SO_MINOR_VERSION Minor version number to use for shared library
|
||||
# OBJS List of object files to include in library
|
||||
# SHLIB_LINK If shared library relies on other libraries, additional
|
||||
# stuff to put in its link command
|
||||
# (If you want a patchlevel, include it in SO_MINOR_VERSION, eg, "6.2".)
|
||||
#
|
||||
# The module Makefile must also include $(SRCDIR)/Makefile.global before
|
||||
# including this file (Makefile.global sets PORTNAME and other needed symbols).
|
||||
#
|
||||
# The first rule in this file is a rule for "all", which causes both the
|
||||
# static and shared libraries to be built (as well as all the object files).
|
||||
# If you have other files that need to be made before building object files
|
||||
# and libraries, put another rule for "all" before you include this file.
|
||||
#
|
||||
# Your install rule should look like
|
||||
#
|
||||
# install: install-headers install-lib $(install-shlib-dep)
|
||||
#
|
||||
# where install-headers is only needed if you have header files to install
|
||||
# (and, of course, it has to be provided by your makefile). The rules
|
||||
# install-lib and install-shlib are provided by this makefile --- they
|
||||
# automatically install the plain and shared libraries into $(LIBDIR).
|
||||
# install-shlib-dep is a variable that expands to install-shlib if the
|
||||
# shared library needs to be installed, empty if not.
|
||||
#
|
||||
# Got that? Look at src/interfaces/libpq/Makefile.in for an example.
|
||||
|
||||
|
||||
# shlib and install-shlib-dep default to empty, and stay that way if we're
|
||||
# on a platform where we don't know how to build a shared library.
|
||||
shlib :=
|
||||
install-shlib-dep :=
|
||||
|
||||
# For each platform we support shlibs on, set shlib and install-shlib-dep,
|
||||
# and update flags as needed to build a shared lib. Note we depend on
|
||||
# Makefile.global (or really Makefile.port) to supply DLSUFFIX and other
|
||||
# symbols.
|
||||
|
||||
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), hpux) |
||||
install-shlib-dep := install-shlib
|
||||
# HPUX doesn't believe in version numbers for shlibs
|
||||
shlib := lib$(NAME)$(DLSUFFIX)
|
||||
LDFLAGS_SL := -b
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
|
||||
ifeq ($(PORTNAME), linux) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
|
||||
LDFLAGS_SL := -shared -soname $(shlib)
|
||||
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), 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), 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), 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), 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 |
||||
|
||||
|
||||
# Default target definition. Note shlib is empty if not building a shlib.
|
||||
|
||||
all: lib$(NAME).a $(shlib) |
||||
|
||||
# Rules to build regular and shared libraries
|
||||
|
||||
lib$(NAME).a: $(OBJS) |
||||
ifdef MK_NO_LORDER |
||||
$(AR) $(AROPT) $@ $(OBJS)
|
||||
else |
||||
$(AR) $(AROPT) $@ `lorder $(OBJS) | tsort`
|
||||
endif |
||||
$(RANLIB) $@
|
||||
|
||||
$(shlib): $(OBJS) |
||||
$(LD) $(LDFLAGS_SL) -o $@ $(OBJS) $(SHLIB_LINK)
|
||||
|
||||
# Rules to install regular and shared libraries
|
||||
|
||||
.PHONY: all install-lib install-shlib |
||||
|
||||
install-lib: lib$(NAME).a |
||||
$(INSTALL) $(INSTL_LIB_OPTS) lib$(NAME).a $(LIBDIR)/lib$(NAME).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
|
@ -1,124 +1,52 @@ |
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile
|
||||
# Makefile for ecpg library
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.38 1998/10/19 00:00:40 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
NAME= ecpg
|
||||
SO_MAJOR_VERSION= 2
|
||||
SO_MINOR_VERSION= 6
|
||||
SO_PATCHLEVEL= 2
|
||||
SO_MINOR_VERSION= 6.2
|
||||
|
||||
SRCDIR= @top_srcdir@
|
||||
|
||||
include $(SRCDIR)/Makefile.global |
||||
|
||||
PQ_INCLUDE=-I$(SRCDIR)/interfaces/libpq
|
||||
|
||||
PORTNAME=@PORTNAME@
|
||||
CFLAGS+= -I../include -I$(SRCDIR)/interfaces/libpq
|
||||
|
||||
ifdef KRBVERS |
||||
CFLAGS+= $(KRBFLAGS)
|
||||
endif |
||||
|
||||
# Shared library stuff
|
||||
shlib :=
|
||||
install-shlib-dep :=
|
||||
|
||||
ifeq ($(PORTNAME), linux) |
||||
LINUX_ELF=@LINUX_ELF@
|
||||
ifdef LINUX_ELF
|
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_PATCHLEVEL)
|
||||
LDFLAGS_SL = -shared -soname lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
||||
endif
|
||||
endif |
||||
|
||||
ifeq ($(PORTNAME), bsd) |
||||
ifdef BSD_SHLIB
|
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_PATCHLEVEL)
|
||||
LDFLAGS_SL = -x -Bshareable -Bforcearchive
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif
|
||||
endif |
||||
OBJS= ecpglib.o typename.o
|
||||
|
||||
ifeq ($(PORTNAME), solaris_sparc) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_PATCHLEVEL)
|
||||
LDFLAGS_SL = -G
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
SHLIB_LINK= -L../../libpq -lpq
|
||||
|
||||
ifeq ($(PORTNAME), solaris_i386) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_PATCHLEVEL)
|
||||
LDFLAGS_SL = -G
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
# Shared library stuff, also default 'all' target
|
||||
include $(SRCDIR)/Makefile.shlib |
||||
|
||||
ifeq ($(PORTNAME), svr4) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_PATCHLEVEL)
|
||||
LDFLAGS_SL = -G
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
|
||||
ifeq ($(PORTNAME), univel) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).1
|
||||
LDFLAGS_SL = -G -z text
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
|
||||
ifeq ($(PORTNAME), unixware) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME)$(DLSUFFIX).1
|
||||
LDFLAGS_SL = -G -z text
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
.PHONY: install |
||||
|
||||
ifeq ($(PORTNAME), hpux) |
||||
install-shlib-dep := install-shlib
|
||||
shlib := lib$(NAME).sl
|
||||
LDFLAGS_SL := -b
|
||||
CFLAGS += $(CFLAGS_SL)
|
||||
endif |
||||
install: install-lib $(install-shlib-dep) |
||||
|
||||
all: lib$(NAME).a $(shlib) |
||||
# Handmade dependencies in case make depend not done
|
||||
ecpglib.o : ecpglib.c ../include/ecpglib.h ../include/ecpgtype.h |
||||
typename.o : typename.c ../include/ecpgtype.h |
||||
|
||||
$(shlib): ecpglib.o typename.o |
||||
$(LD) $(LDFLAGS_SL) -o $@ ecpglib.o typename.o
|
||||
|
||||
.PHONY: clean |
||||
clean: |
||||
rm -f *.o *.a core a.out *~ $(shlib) lib$(NAME)$(DLSUFFIX)
|
||||
|
||||
dep depend: |
||||
|
||||
.PHONY: install install-libecpg install-shlib |
||||
|
||||
install: install-libecpg $(install-shlib-dep) |
||||
rm -f lib$(NAME).a $(shlib) $(OBJS)
|
||||
|
||||
install-libecpg: lib$(NAME).a |
||||
$(INSTALL) $(INSTL_LIB_OPTS) lib$(NAME).a $(LIBDIR)/lib$(NAME).a
|
||||
depend dep: |
||||
$(CC) -MM $(CFLAGS) *.c >depend
|
||||
|
||||
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
|
||||
|
||||
|
||||
uninstall:: |
||||
rm -f $(LIBDIR)/lib$(NAME).a $(LIBDIR)/$(shlib)
|
||||
rm -f $(LIBDIR)/lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
||||
rm -f $(LIBDIR)/lib$(NAME)$(DLSUFFIX)
|
||||
|
||||
# Rules that do something
|
||||
lib$(NAME).a : lib$(NAME).a(ecpglib.o) lib$(NAME).a(typename.o) |
||||
|
||||
ecpglib.o : ecpglib.c ../include/ecpglib.h ../include/ecpgtype.h |
||||
$(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c $< -o $@
|
||||
typename.o : typename.c ../include/ecpgtype.h |
||||
$(CC) $(CFLAGS) -I../include $(PQ_INCLUDE) -c $< -o $@
|
||||
ifeq (depend,$(wildcard depend)) |
||||
include depend |
||||
endif |
||||
|
Loading…
Reference in new issue