blob: 5632ef3647609d1102fe1f2d3fc3775b278d67c0 [file] [log] [blame]
# -*- Makefile -*-
#
# $Id$
#
# makefile to build the C++ Standard library
#
########################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# Copyright 1999-2007 Rogue Wave Software, Inc.
#
########################################################################
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)
# 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
# Compaq C++ needs all files from the repository
SOBJS += $(shell [ -d repository.ti ] && echo repository.ti/*.o)
$(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