1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +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

@@ -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 :=
OBJS= ecpglib.o typename.o
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
SHLIB_LINK= -L../../libpq -lpq
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
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
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
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
ifeq ($(PORTNAME), hpux)
install-shlib-dep := install-shlib
shlib := lib$(NAME).sl
LDFLAGS_SL := -b
CFLAGS += $(CFLAGS_SL)
endif
all: lib$(NAME).a $(shlib)
$(shlib): ecpglib.o typename.o
$(LD) $(LDFLAGS_SL) -o $@ ecpglib.o typename.o
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)
install-libecpg: 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
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
uninstall::
rm -f $(LIBDIR)/lib$(NAME).a $(LIBDIR)/$(shlib)
rm -f $(LIBDIR)/lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
rm -f $(LIBDIR)/lib$(NAME)$(DLSUFFIX)
.PHONY: install
# Rules that do something
lib$(NAME).a : lib$(NAME).a(ecpglib.o) lib$(NAME).a(typename.o)
install: install-lib $(install-shlib-dep)
# Handmade dependencies in case make depend not done
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 $@
.PHONY: clean
clean:
rm -f lib$(NAME).a $(shlib) $(OBJS)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
ifeq (depend,$(wildcard depend))
include depend
endif