blob: e92dedbe8b0ce8ca5bedb7bc1c00c6dfff4c772f [file] [log] [blame]
# -*- Makefile -*-
#
# $Id$
#
# makefile to build the C++ Standard library
#
##############################################################################
include ../makefile.in
# catalog to build and source files to build it from
CATFILE := rwstderr.cat
MSGFILES := rwstderr.msg
# the name of the library to build (and in shared builds,
# the name of the symbolic link pointing to it, for library
# versioning)
LIBLINK := $(LIBNAME)
ifeq ($(findstring shared,$(BUILDMODE)),shared)
ifneq ($(LIBSUFFIX),.dll)
LIB := $(LIBLINK).$(LIBVER)
else
# on Cygwin use name libstd${BUILDTYPE}-X.Y.Z.dll
LIB := $(basename $(LIBLINK))-$(LIBVER)$(LIBSUFFIX)
endif
TARGET := $(LIB) $(LIBLINK)
else
LIB := $(LIBLINK)
TARGET := $(LIB)
endif
TARGET += $(CATFILE)
SRCDIRS = $(TOPDIR)/src
# do not compile these sources...
OMIT_SRCS += rwstderr.cpp
# include common variables setting for all makefiles
ONE_REPOSITORY = 1
include ../makefile.common
CXXFLAGS += $(PICFLAGS)
LDFLAGS += $(LDSOFLAGS) $(MAPFLAGS) $(MAPFILE)
# OBJS += $(shell [ -d ./cxx_repository/ ] && echo ./cxx_repository/*.o)
# For AIX 5.1 xlC 5.0.2.0
ifneq ($(DEFAULT_SHROBJ),)
SOBJS=$(DEFAULT_SHROBJ)
else
SOBJS=$(OBJS)
endif
# CXXPRELINK - command for compilers that use template
# instantiation models that require a prelink stage
ifneq ($(PRELINKFLAGS),)
CXXPRELINK = $(CXX) $(CPPFLAGS) $(LDFLAGS) $(PRELINKFLAGS) $(OBJS)
endif # ($(PRELINKFLAGS),)
##############################################################################
# TARGETS
##############################################################################
# Cancel implicit rules
.SUFFIXES:
all: $(TARGET)
# do any directory specific cleanup using the realclean target
realclean: dependclean clean
# build an archive or shared library (repository included for DEC cxx 6.2)
ifeq ($(findstring shared,$(BUILDMODE)),shared)
ifeq ($(findstring archive,$(BUILDMODE)),archive)
# shared archives are unique to IBM AIX
# IBM VisualAge/XLC++ on AIX first "preprocesses" object files
# with -qmkshrobj and then uses `ar' to create a shared archive
$(LIB): $(OBJS)
@echo "$(CXXPRELINK) -o $(LIBBASE).o" >> $(LOGFILE)
$(CXXPRELINK) -o $(LIBBASE).o $(TEEOPTS)
@echo "$(AR) $(ARFLAGS) $@ $(LIBBASE).o" >> $(LOGFILE)
$(AR) $(ARFLAGS) $@ $(LIBBASE).o $(TEEOPTS)
else
$(LIB): $(OBJS) $(MAPFILE)
@echo "$(LD) $(LDFLAGS) $< $(LDLIBS) -o $@" >> $(LOGFILE)
$(LD) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@ $(TEEOPTS)
endif # shared archive
$(LIBLINK): $(LIB)
@echo "ln -sf $< $@" >> $(LOGFILE)
ln -sf $< $@
else
$(LIB): $(OBJS)
@echo "$(CXXPRELINK)" >> $(LOGFILE)
$(CXXPRELINK) $(TEEOPTS)
@echo "$(AR) $(ARFLAGS) $(LIBNAME) $(SOBJS)" >> $(LOGFILE)
$(AR) $(ARFLAGS) $(LIBNAME) $(SOBJS) $(TEEOPTS)
endif # ($(findstring shared,$(BUILDMODE)),shared)
# Common rules used by all Makefiles
include ../makefile.rules
# create the $(PREFIX)/etc/ and $(PREFIX)/lib/ directories
# and install the library binary and the message catalog(s)
install: $(TARGET)
mkdir -p $(PREFIX)/lib
cp $(LIB) $(PREFIX)/lib
if [ $(LIBLINK) != $(LIB) ]; then \
rm $(PREFIX)/lib/$(LIBLINK); \
ln -s $(LIB) $(PREFIX)/lib/$(LIBLINK); \
fi
mkdir -p $(PREFIX)/etc
cp $(CATFILE) $(PREFIX)/etc