Ice Makefile学习

makefile 关系:

  入口Ice-3.4.2\cpp\Makefile,include $(top_srcdir)/config/Make.rules,然后执行下面子目录的Makefile,如Ice-3.4.2\cpp\src\IceUtil\Makefile

   而Ice-3.4.2\cpp\config\Make.rules通过如下:

     include $(top_srcdir)/config/Make.rules.$(UNAME)

    ifeq ($(shell test -f $(top_srcdir)/config/Make.common.rules && echo 0),0)
                include $(top_srcdir)/config/Make.common.rules
    else
                  include $(top_srcdir)/../config/Make.common.rules
     endif

   包含了跨平台文件 Ice-3.4.2\config\Make.common.rules和操作系统平台文件Ice-3.4.2\cpp\config\Make.rules.Linux

    从而定义各个函数!!

  

1. Ice-3.4.2\config\Make.common.rules

 # **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

# ----------------------------------------------------------------------
# Don't change anything below this line!
# ----------------------------------------------------------------------

SHELL			= /bin/sh
VERSION_MAJOR   	= 3
VERSION_MINOR   	= 4
VERSION_PATCH           = 2
VERSION			= 3.4.2
SHORT_VERSION           = 3.4
SOVERSION		= 34

INSTALL			= cp -fp
INSTALL_PROGRAM		= ${INSTALL}
INSTALL_LIBRARY		= ${INSTALL}
INSTALL_DATA		= ${INSTALL}

OBJEXT			= .o

UNAME			:= $(shell uname)
MACHINE_TYPE		:= $(shell uname -m)

#
# Ensure ice_language has been set by the file that includes this one.
#
ifndef ice_language
$(error ice_language must be defined)
endif

ifeq ($(USE_BIN_DIST),yes)
ice_bin_dist = 1
endif

ifeq ($(UNAME),SunOS)
    ifeq ($(MACHINE_TYPE),sun4u)
       lp64suffix	= /sparcv9
       lp64binsuffix	= /sparcv9
    endif
    ifeq ($(MACHINE_TYPE),i86pc)
	lp64suffix	= /amd64
	lp64binsuffix	= /amd64
    endif
endif

ifeq ($(UNAME),HP-UX)
    lp64suffix		= /pa20_64
    lp64binsuffix	= /pa20_64
endif

ifeq ($(UNAME),Linux)
   ifeq ($(MACHINE_TYPE),x86_64)
      lp64suffix	= 64
      ifeq ($(LP64),)
          LP64      	= yes
      endif
   endif
endif

ifeq ($(LP64),yes)
    libsubdir		  := lib$(lp64suffix)
    binsubdir		  := bin$(lp64binsuffix)
else
    libsubdir		  := lib
    binsubdir		  := bin
endif

#
# The following variables might also be defined:
# 
# - slice_translator: the name of the slice translator required for the build.
#   Setting this variable is required when building source trees other than the
#   the source distribution (e.g.: the demo sources).
#                  
# - ice_require_cpp: define this variable to check for the presence of the C++
#   dev kit and check for the existence of the include/Ice/Config.h header.
#

#
# First, check if we're building a source distribution. 
#
# If building from a source distribution, ice_dir is defined to the
# top-level directory of the source distribution and ice_cpp_dir is
# defined to the directory containing the C++ binaries and headers to
# use to build the sources.
#
ifndef ice_bin_dist
    ifeq ($(shell test -d $(top_srcdir)/../$(ice_language) && echo 0),0)
        ice_dir = $(top_srcdir)/..
        ice_src_dist = 1

        #
        # When building a source distribution, if ICE_HOME is specified, it takes precedence over 
        # the source tree for building the language mappings. For example, this can be used to 
        # build the Python language mapping using the translators from the distribution specified
        # by ICE_HOME.
        #
	ifneq ($(ICE_HOME),)
	    ifdef slice_translator
		ifneq ($(shell test -f $(ICE_HOME)/$(binsubdir)/$(slice_translator) && echo 0), 0)
$(error Unable to find $(slice_translator) in $(ICE_HOME)/$(binsubdir), please verify ICE_HOME is properly configured and Ice is correctly installed.)
		endif
		ifeq ($(shell test -f $(ice_dir)/cpp/bin/$(slice_translator) && echo 0), 0)
$(warning Found $(slice_translator) in both ICE_HOME/bin and $(ice_dir)/cpp/bin, ICE_HOME/bin/$(slice_translator) will be used!)
		endif
		ice_cpp_dir = $(ICE_HOME)
	    else
$(warning Ignoring ICE_HOME environment variable to build current source tree.)
		ice_cpp_dir = $(ice_dir)/cpp
	    endif
	else
	    ice_cpp_dir = $(ice_dir)/cpp
	endif

    endif
    ifeq ($(shell test -d $(top_srcdir)/ice/$(ice_language) && echo 0),0)
        ice_dir = $(top_srcdir)/ice
        ice_src_dist = 1

        #
        # When building a source distribution, if ICE_HOME is specified, it takes precedence over 
        # the source tree for building the language mappings. For example, this can be used to 
        # build the Python language mapping using the translators from the distribution specified
        # by ICE_HOME.
        #
	ifneq ($(ICE_HOME),)
	    ifdef slice_translator
		ifneq ($(shell test -f $(ICE_HOME)/$(binsubdir)/$(slice_translator) && echo 0), 0)
$(error Unable to find $(slice_translator) in $(ICE_HOME)/$(binsubdir), please verify ICE_HOME is properly configured and Ice is correctly installed.)
		endif
		ifeq ($(shell test -f $(ice_dir)/cpp/bin/$(slice_translator) && echo 0), 0)
$(warning Found $(slice_translator) in both ICE_HOME/bin and $(ice_dir)/cpp/bin, ICE_HOME/bin/$(slice_translator) will be used!)
		endif
		ice_cpp_dir = $(ICE_HOME)
	    else
$(warning Ignoring ICE_HOME environment variable to build current source tree.)
		ice_cpp_dir = $(ice_dir)/cpp
	    endif
	else
	    ice_cpp_dir = $(ice_dir)/cpp
	endif
    endif
endif

#
# Then, check if we're building against a binary distribution.
#
ifndef ice_src_dist

    ifndef slice_translator
$(error slice_translator must be defined)
    endif

    ifneq ($(ICE_HOME),)
        ifneq ($(shell test -f $(ICE_HOME)/$(binsubdir)/$(slice_translator) && echo 0), 0)
$(error Unable to find $(slice_translator) in $(ICE_HOME)/$(binsubdir), please verify ICE_HOME is properly configured and Ice is correctly installed.)
        endif
        ice_dir = $(ICE_HOME)
    else
        ifeq ($(shell test -f $(top_srcdir)/bin/$(slice_translator) && echo 0), 0)
            ice_dir = $(top_srcdir)
        else 
	    ifeq ($(shell test -f /usr/bin/$(slice_translator) && echo 0), 0)
	        ice_dir = /usr
	        ifeq ($(shell test -f /opt/Ice-$(VERSION)/bin/$(slice_translator) && echo 0), 0)
$(warning Found $(slice_translator) in both /usr/bin and /opt/Ice-$(VERSION)/bin, /usr/bin/$(slice_translator) will be used!)
		endif
	    else
	        ifeq ($(shell test -f /opt/Ice-$(VERSION)/$(binsubdir)/$(slice_translator) && echo 0), 0)
	            ice_dir = /opt/Ice-$(VERSION)
		endif
	    endif
        endif
    endif

    ifndef ice_dir
$(error Unable to find a valid Ice distribution, please verify ICE_HOME is properly configured and Ice is correctly installed.)
    endif
    ice_bin_dist = 1
    ice_cpp_dir = $(ice_dir)
endif

#
# If ice_require_cpp is defined, ensure the C++ headers exist
#
ifeq ($(ice_require_cpp), "yes")
    ifdef ice_src_dist
        ice_cpp_header = $(ice_cpp_dir)/include/Ice/Ice.h
    else
        ice_cpp_header = $(ice_dir)/include/Ice/Ice.h
    endif
    ifneq ($(shell test -f $(ice_cpp_header) && echo 0),0)
$(error Unable to find the C++ header file $(ice_cpp_header), please verify ICE_HOME is properly configured and Ice is correctly installed.)
    endif
endif

#
# Clear the embedded runpath prefix if building against RPM distribution.
#
ifeq ($(ice_dir), /usr)
    embedded_runpath_prefix =
endif

#
# Set slicedir to the path of the directory containing the Slice files.
#
ifeq ($(ice_dir), /usr)
    slicedir = /usr/share/Ice-$(VERSION)/slice
else
    slicedir = $(ice_dir)/slice
endif

install_slicedir = $(prefix)/slice

#
# Set environment variables for the Slice translator.
#
ifneq ($(ice_dir), /usr)
    ifdef ice_src_dist
	ifeq ($(ice_cpp_dir), $(ice_dir)/cpp)
	    ice_lib_dir = $(ice_cpp_dir)/lib
	else
            ice_lib_dir = $(ice_cpp_dir)/$(libsubdir)
	endif
    else
        ice_lib_dir = $(ice_dir)/$(libsubdir)
    endif

    ifeq ($(UNAME),Linux)
        export LD_LIBRARY_PATH := $(ice_lib_dir):$(LD_LIBRARY_PATH)
    endif

    ifeq ($(UNAME),SunOS)
        ifeq ($(LP64),yes)
            export LD_LIBRARY_PATH_64 := $(ice_lib_dir):$(LD_LIBRARY_PATH_64)
        else
            export LD_LIBRARY_PATH := $(ice_lib_dir):$(LD_LIBRARY_PATH)
	endif
    endif

    ifeq ($(UNAME),Darwin)
        export DYLD_LIBRARY_PATH := $(ice_lib_dir):$(DYLD_LIBRARY_PATH)
    endif

    ifeq ($(UNAME),AIX)
        export LIBPATH := $(ice_lib_dir):$(LIBPATH)
    endif

    ifeq ($(UNAME),HP-UX)
        ifeq ($(LP64),yes)
	    export LD_LIBRARY_PATH := $(ice_lib_dir)$(lp64dir):$(SHLIB_PATH)
	else
	    export SHLIB_PATH := $(ice_lib_dir):$(LD_LIBRARY_PATH)
	endif
    endif

    ifeq ($(UNAME),FreeBSD)
        export LD_LIBRARY_PATH := $(ice_lib_dir):$(LD_LIBRARY_PATH)
    endif

    ifeq ($(UNAME),OSF1)
        export LD_LIBRARY_PATH := $(ice_lib_dir):$(LD_LIBRARY_PATH)
    endif

endif


#
# Default functions for shared library names
#

ifeq ($(mklibfilename),)
    # These default platform-specific rules are needed for cs/config/Make.rules.cs
    ifeq ($(UNAME),Darwin)
	mklibfilename	= $(if $(2),lib$(1).$(2).dylib,lib$(1).dylib)
    else
	mklibfilename	= $(if $(2),lib$(1).so.$(2),lib$(1).so)
    endif
endif

ifeq ($(mksoname),)
    mksoname	= $(if $(2),lib$(1).so.$(2),lib$(1).so)
endif

ifeq ($(mklibname),)
    ifeq ($(STATICLIBS),yes)
	mklibname	= lib$(1).a
    else
	mklibname	= lib$(1).so
    endif
endif

ifndef mklibtargets
    ifeq ($(STATICLIBS),yes)
	mklibtargets	= $(3)
    else
	mklibtargets	= $(1) $(2) $(3)
    endif
endif

ifeq ($(installlib),)
    ifeq ($(STATICLIBS),yes)
	installlib	= $(INSTALL) $(2)/$(5) $(1); \
			  chmod a+rx $(1)/$(5) 
    else
	installlib	= $(INSTALL) $(2)/$(3) $(1); \
			  rm -f $(1)/$(4); ln -s $(3) $(1)/$(4); \
			  rm -f $(1)/$(5); ln -s $(4) $(1)/$(5); \
			  chmod a+rx $(1)/$(3) 
    endif
endif

ifeq ($(installdata),)
    installdata		= $(INSTALL_DATA) $(1) $(2); \
			  chmod a+r $(2)/$(notdir $(1))
endif

ifeq ($(installprogram),)
    installprogram	= $(INSTALL_PROGRAM) $(1) $(2); \
			  chmod a+rx $(2)/$(notdir $(1))
endif

ifeq ($(mkdir),)
    mkdir		= $(if $(2),mkdir $(2) $(1),mkdir $(1)); \
			  chmod a+rx $(1)
endif

all::

install-common::
	@if test ! -d $(prefix) ; \
	then \
	    echo "Creating $(prefix)..." ; \
	    $(call mkdir,$(prefix), -p) ; \
	fi

	@if test ! -d $(install_slicedir) ; \
	then \
	    echo "Creating $(install_slicedir)..." ; \
	    $(call mkdir, $(install_slicedir)) ; \
	    cd $(top_srcdir)/../slice ; \
# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

#
# Select an installation base directory. The directory will be created
# if it does not exist.
#
prefix			?= /opt/Ice-$(VERSION)

#
# The "root directory" for runpath embedded in executables. Can be unset
# to avoid adding a runpath to Ice executables.
#
embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)

#
# Define create_runpath_symlink as yes if you would like 'make install'
# to automatically create a symbolic link for the embedded runpath
# directory. Only applies if embedded_runpath_prefix is also set.
#
create_runpath_symlink	?= no

#
# Define OPTIMIZE as yes if you want to build with
# optimization. Otherwise Ice is build with debug information.
#
#OPTIMIZE		= yes

#
# Define LP64 as yes or no if you want force a 32 or 64 bit. The
# default is platform-dependent
#
#LP64			?= yes

#
# Define USE_READLINE as yes if you want to build parts of Ice using
# readline on platforms where readline is available (see
# PLATFORM_HAS_READLINE in Make.rules.$(UNAME))
#
# readline is used by a number of Ice admin programs to provide
# command history, an optional feature.
#
# readline is licensed by the Free Software Foundation under the GNU
# Public License v2, and cannot be combined with GPL-incompatible
# software in any program. In particular the OpenSSL license is
# GPL-incompatible.
#
# If you combine Ice with more GPL-incompatible software, or have
# licensed Ice under a commercial (non-GPL) license, you should ponder
# the licensing implications of using readline.
# 

USE_READLINE		?= no

#
# If libbzip2 is not installed in a standard location where the
# compiler can find it, set BZIP2_HOME to the bzip2 installation
# directory.
#
#BZIP2_HOME		?= /opt/bzip2


#
# If Berkeley DB is not installed in a standard location where the
# compiler can find it, set DB_HOME to the Berkeley DB installation
# directory.
#
#DB_HOME		?= /opt/db

#
# If expat is not installed in a standard location where the compiler
# can find it, set EXPAT_HOME to the expat installation directory.
#
#EXPAT_HOME		?= /opt/expat

#
# If OpenSSL is not installed in a standard location where the
# compiler can find it, set OPENSSL_HOME to the OpenSSL installation
# directory.
#
#OPENSSL_HOME		?= /opt/openssl

#
# If MCPP is not installed in a standard location where the compiler 
# can find it, set MCPP_HOME to the Mcpp installation directory.
#
#MCPP_HOME		?= /opt/mcpp

#
# If libiconv is not installed in a standard location where the compiler 
# can find it, set ICONV_HOME to the libiconv installation directory.
#
#ICONV_HOME		?= /opt/libiconv

#
# If readline is not installed in a standard location where the
# compiler can find it, AND you want to use readline, set
# READLINE_HOME to the readline installation directory.
#
#READLINE_HOME		?= /opt/readline

#
# If you want to build the SQL database plugins for IceStorm and
# IceGrid, set QT_HOME to the Qt installation directory.
#
#
#QT_HOME	= /usr/local/Trolltech/Qt-4.5.3
#QT_HOME	= /Library/Frameworks

#
# Generate position independent code unless GENPIC is set to no
#
#GENPIC                     ?= yes

#
# The build architectures for gcc based builds. The format of these
# build flags are OS dependent. For example, under Mac OS X to build
# binaries which support both i386 and x86_64 you would use "-arch
# i386 -arch x86_64".  The default is OS version dependent. Be aware
# that this value may conflict with the setting of LP64 above.
#
#CXXARCHFLAGS		     = -arch i386 -arch x86_64

# ----------------------------------------------------------------------
# Don't change anything below this line!
# ----------------------------------------------------------------------

#
# Common definitions
#
ice_language     = cpp
ifneq ($(shell test "$(USE_BIN_DIST)" != "yes" -a -d $(top_srcdir)/../$(ice_language) && echo 0),0)
    slice_translator = slice2cpp
    ice_require_cpp  = 1
endif

ifeq ($(shell test -f $(top_srcdir)/config/Make.common.rules && echo 0),0)
    include $(top_srcdir)/config/Make.common.rules
else
    include $(top_srcdir)/../config/Make.common.rules
endif

bindir			= $(top_srcdir)/bin
libdir			= $(top_srcdir)/lib
headerdir		= $(top_srcdir)/include

#
# includedir is not handled the same as bindir and libdir
# because it is used in the .depend files
#
ifdef ice_src_dist
    includedir		= $(top_srcdir)/include
else
    includedir		= $(ice_dir)/include
endif

#
# Platform specific definitions
#
include	 $(top_srcdir)/config/Make.rules.$(UNAME)

install_includedir	:= $(prefix)/include
install_docdir		:= $(prefix)/doc
install_bindir	  	:= $(prefix)/$(binsubdir)
install_libdir	  	:= $(prefix)/$(libsubdir)
install_configdir 	:= $(prefix)/config

ifneq ($(embedded_runpath_prefix),)
    runpath_libdir	:= $(embedded_runpath_prefix)/$(libsubdir)
else
    create_runpath_symlink = no
endif

OPENSSL_FLAGS           = $(if $(OPENSSL_HOME),-I$(OPENSSL_HOME)/include)
OPENSSL_LIBS            = $(if $(OPENSSL_HOME),-L$(OPENSSL_HOME)/$(libsubdir)) -lssl -lcrypto
OPENSSL_RPATH_LINK      = $(if $(OPENSSL_HOME),$(call rpathlink,$(OPENSSL_HOME)/$(libsubdir)))

BZIP2_FLAGS             = $(if $(BZIP2_HOME),-I$(BZIP2_HOME)/include)
BZIP2_LIBS              = $(if $(BZIP2_HOME),-L$(BZIP2_HOME)/$(libsubdir)) -lbz2
BZIP2_RPATH_LINK        = $(if $(BZIP2_HOME),$(call rpathlink,$(BZIP2_HOME)/$(libsubdir)))

ICONV_LIBS              = $(if $(ICONV_HOME),-L$(ICONV_HOME)/$(libsubdir)) $(ICONV_LIB)

ifneq ($(DB_HOME),)
   DB_FLAGS             = -I$(DB_HOME)/include
   DB_LIBS              = -L$(DB_HOME)/$(libsubdir) -ldb_cxx
   DB_RPATH_LINK        = $(call rpathlink,$(DB_HOME)/$(libsubdir))
else
   ifeq ($(shell if [ -d /usr/include/db48 -a -d /usr/$(libsubdir)/db48 ] ; then echo yes; fi), yes)
      DB_FLAGS          = -I/usr/include/db48
      DB_LIBS           = -L/usr/$(libsubdir)/db48 -ldb_cxx
   else
      DB_LIBS           = -ldb_cxx
   endif
endif

EXPAT_FLAGS             = $(if $(EXPAT_HOME),-I$(EXPAT_HOME)/include)
EXPAT_LIBS              = $(if $(EXPAT_HOME),-L$(EXPAT_HOME)/$(libsubdir)) -lexpat
EXPAT_RPATH_LINK        = $(if $(EXPAT_HOME),$(call rpathlink,$(EXPAT_HOME)/$(libsubdir)))

MCPP_LIBS              = $(if $(MCPP_HOME),-L$(MCPP_HOME)/$(libsubdir)) -lmcpp
MCPP_RPATH_LINK        = $(if $(MCPP_HOME),$(call rpathlink,$(MCPP_HOME)/$(libsubdir)))

ifeq ($(PLATFORM_HAS_READLINE),yes)
    ifeq ($(USE_READLINE),yes)
        READLINE_FLAGS  = -DHAVE_READLINE $(if $(READLINE_HOME),-I$(READLINE_HOME)/include)
        READLINE_LIBS   = $(if $(READLINE_HOME),-L$(READLINE_HOME)/$(libsubdir)) -lreadline -lncurses        
    endif
endif

ifneq ($(DB_HOME),)
endif

ICECPPFLAGS		= -I$(slicedir)
SLICE2CPPFLAGS		= $(ICECPPFLAGS)

ifeq ($(ice_dir), /usr) 
    CPPFLAGS		= 
    LDFLAGS		= $(LDPLATFORMFLAGS) $(CXXFLAGS)
else
    CPPFLAGS	= -I$(includedir)
    ifdef ice_src_dist
        LDFLAGS		= $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(libdir) 
    else
        LDFLAGS		= $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(ice_dir)/$(libsubdir) 
    endif
endif

ifeq ($(FLEX_NOLINE),yes)
    FLEXFLAGS	       := -L
else
    FLEXFLAGS	       :=
endif

ifeq ($(BISON_NOLINE),yes)
    BISONFLAGS		:= -dvtl
else
    BISONFLAGS		:= -dvt
endif

ifeq ($(mkshlib),)
    $(error You need to define mkshlib in Make.rules.$(UNAME)) 
endif

ifdef ice_src_dist
    SLICEPARSERLIB	= $(libdir)/$(call mklibfilename,Slice,$(VERSION))
    SLICE2CPP		= $(bindir)/slice2cpp
    SLICE2FREEZE	= $(bindir)/slice2freeze
else
    SLICEPARSERLIB	= $(ice_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION))
    SLICE2CPP		= $(ice_dir)/$(binsubdir)/slice2cpp
    SLICE2FREEZE	= $(ice_dir)/$(binsubdir)/slice2freeze
endif

EVERYTHING		= all depend clean install 

.SUFFIXES:
.SUFFIXES:		.cpp .c .o

.cpp.o:
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<

.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<


$(HDIR)/%F.h: $(SDIR)/%F.ice $(SLICE2CPP) $(SLICEPARSERLIB)
	rm -f $(HDIR)/$(*F)F.h $(*F)F.cpp
	$(SLICE2CPP) $(SLICE2CPPFLAGS) $<
	mv $(*F)F.h $(HDIR)
	rm -f $(*F)F.cpp

$(HDIR)/%.h %.cpp: $(SDIR)/%.ice $(SLICE2CPP) $(SLICEPARSERLIB)
	rm -f $(HDIR)/$(*F).h $(*F).cpp
	$(SLICE2CPP) $(SLICE2CPPFLAGS) $<
	mv $(*F).h $(HDIR)

%.h %.cpp: %.ice $(SLICE2CPP) $(SLICEPARSERLIB)
	rm -f $(*F).h $(*F).cpp
	$(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice	

#%.h %.cpp: %.y
#	rm -f $(*F).h $(*F).cpp
#	bison $(BISONFLAGS) $<
#	mv $(*F).tab.c $(*F).cpp
#	mv $(*F).tab.h $(*F).h
#	rm -f $(*F).output

#%.cpp: %.l
#	flex $(FLEXFLAGS) $<
#	rm -f $@
#	echo '#include <IceUtil/Config.h>' > $@
#	cat lex.yy.c >> $@
#	rm -f lex.yy.c

all:: $(SRCS) $(TARGETS)

depend:: $(SRCS)  $(patsubst $(SDIR)/%.ice,$(HDIR)/%.h,$(wildcard $(SDIR)/*F.ice)) $(SLICE_SRCS)
	-rm -f .depend .depend.mak
	if test -n "$(SRCS)" ; then \
	    $(CXX) -DMAKEDEPEND -M $(CXXFLAGS) $(CPPFLAGS) $(SRCS) | $(ice_dir)/config/makedepend.py; \
	fi
	if test -n "$(SLICE_SRCS)" ; then \
	    $(SLICE2CPP) --depend $(SLICE2CPPFLAGS) $(SLICE_SRCS) | $(ice_dir)/config/makedepend.py; \
	fi

clean::
	-rm -f $(TARGETS)
	-rm -f core *.o *.bak

ifneq ($(SLICE_SRCS),)
clean::
	rm -f $(addsuffix .cpp, $(basename $(notdir $(SLICE_SRCS))))
	rm -f $(addsuffix .h, $(basename $(notdir $(SLICE_SRCS))))
endif

ifneq ($(HDIR),)
clean::
	rm -f $(addprefix $(HDIR), $(addsuffix .h, $(basename $(subst $(SDIR),, \
	$(filter $(SDIR)/%.ice, $(SLICE_SRCS))))))
endif

ifneq ($(TEMPLATE_REPOSITORY),)
clean::
	rm -fr $(TEMPLATE_REPOSITORY)
endif

install::

for subdir in * ; \ do \ echo "Copying slice/$$subdir to $(install_slicedir)..." ; \ cp -fpr $$subdir $(install_slicedir) ; \ done ; \ fi@if test ! -f $(prefix)/ICE_LICENSE ; \then \ $(call installdata,$(top_srcdir)/../ICE_LICENSE,$(prefix)) ; \fi@if test ! -f $(prefix)/LICENSE ; \then \ $(call installdata,$(top_srcdir)/../LICENSE,$(prefix)) ; \fi


2. Ice-3.4.2\cpp\config\Make.rules

# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

#
# Select an installation base directory. The directory will be created
# if it does not exist.
#
prefix			?= /opt/Ice-$(VERSION)

#
# The "root directory" for runpath embedded in executables. Can be unset
# to avoid adding a runpath to Ice executables.
#
embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)

#
# Define create_runpath_symlink as yes if you would like 'make install'
# to automatically create a symbolic link for the embedded runpath
# directory. Only applies if embedded_runpath_prefix is also set.
#
create_runpath_symlink	?= no

#
# Define OPTIMIZE as yes if you want to build with
# optimization. Otherwise Ice is build with debug information.
#
#OPTIMIZE		= yes

#
# Define LP64 as yes or no if you want force a 32 or 64 bit. The
# default is platform-dependent
#
#LP64			?= yes

#
# Define USE_READLINE as yes if you want to build parts of Ice using
# readline on platforms where readline is available (see
# PLATFORM_HAS_READLINE in Make.rules.$(UNAME))
#
# readline is used by a number of Ice admin programs to provide
# command history, an optional feature.
#
# readline is licensed by the Free Software Foundation under the GNU
# Public License v2, and cannot be combined with GPL-incompatible
# software in any program. In particular the OpenSSL license is
# GPL-incompatible.
#
# If you combine Ice with more GPL-incompatible software, or have
# licensed Ice under a commercial (non-GPL) license, you should ponder
# the licensing implications of using readline.
# 

USE_READLINE		?= no

#
# If libbzip2 is not installed in a standard location where the
# compiler can find it, set BZIP2_HOME to the bzip2 installation
# directory.
#
#BZIP2_HOME		?= /opt/bzip2


#
# If Berkeley DB is not installed in a standard location where the
# compiler can find it, set DB_HOME to the Berkeley DB installation
# directory.
#
#DB_HOME		?= /opt/db

#
# If expat is not installed in a standard location where the compiler
# can find it, set EXPAT_HOME to the expat installation directory.
#
#EXPAT_HOME		?= /opt/expat

#
# If OpenSSL is not installed in a standard location where the
# compiler can find it, set OPENSSL_HOME to the OpenSSL installation
# directory.
#
#OPENSSL_HOME		?= /opt/openssl

#
# If MCPP is not installed in a standard location where the compiler 
# can find it, set MCPP_HOME to the Mcpp installation directory.
#
#MCPP_HOME		?= /opt/mcpp

#
# If libiconv is not installed in a standard location where the compiler 
# can find it, set ICONV_HOME to the libiconv installation directory.
#
#ICONV_HOME		?= /opt/libiconv

#
# If readline is not installed in a standard location where the
# compiler can find it, AND you want to use readline, set
# READLINE_HOME to the readline installation directory.
#
#READLINE_HOME		?= /opt/readline

#
# If you want to build the SQL database plugins for IceStorm and
# IceGrid, set QT_HOME to the Qt installation directory.
#
#
#QT_HOME	= /usr/local/Trolltech/Qt-4.5.3
#QT_HOME	= /Library/Frameworks

#
# Generate position independent code unless GENPIC is set to no
#
#GENPIC                     ?= yes

#
# The build architectures for gcc based builds. The format of these
# build flags are OS dependent. For example, under Mac OS X to build
# binaries which support both i386 and x86_64 you would use "-arch
# i386 -arch x86_64".  The default is OS version dependent. Be aware
# that this value may conflict with the setting of LP64 above.
#
#CXXARCHFLAGS		     = -arch i386 -arch x86_64

# ----------------------------------------------------------------------
# Don't change anything below this line!
# ----------------------------------------------------------------------

#
# Common definitions
#
ice_language     = cpp
ifneq ($(shell test "$(USE_BIN_DIST)" != "yes" -a -d $(top_srcdir)/../$(ice_language) && echo 0),0)
    slice_translator = slice2cpp
    ice_require_cpp  = 1
endif

ifeq ($(shell test -f $(top_srcdir)/config/Make.common.rules && echo 0),0)
    include $(top_srcdir)/config/Make.common.rules
else
    include $(top_srcdir)/../config/Make.common.rules
endif

bindir			= $(top_srcdir)/bin
libdir			= $(top_srcdir)/lib
headerdir		= $(top_srcdir)/include

#
# includedir is not handled the same as bindir and libdir
# because it is used in the .depend files
#
ifdef ice_src_dist
    includedir		= $(top_srcdir)/include
else
    includedir		= $(ice_dir)/include
endif

#
# Platform specific definitions
#
include	 $(top_srcdir)/config/Make.rules.$(UNAME)

install_includedir	:= $(prefix)/include
install_docdir		:= $(prefix)/doc
install_bindir	  	:= $(prefix)/$(binsubdir)
install_libdir	  	:= $(prefix)/$(libsubdir)
install_configdir 	:= $(prefix)/config

ifneq ($(embedded_runpath_prefix),)
    runpath_libdir	:= $(embedded_runpath_prefix)/$(libsubdir)
else
    create_runpath_symlink = no
endif

OPENSSL_FLAGS           = $(if $(OPENSSL_HOME),-I$(OPENSSL_HOME)/include)
OPENSSL_LIBS            = $(if $(OPENSSL_HOME),-L$(OPENSSL_HOME)/$(libsubdir)) -lssl -lcrypto
OPENSSL_RPATH_LINK      = $(if $(OPENSSL_HOME),$(call rpathlink,$(OPENSSL_HOME)/$(libsubdir)))

BZIP2_FLAGS             = $(if $(BZIP2_HOME),-I$(BZIP2_HOME)/include)
BZIP2_LIBS              = $(if $(BZIP2_HOME),-L$(BZIP2_HOME)/$(libsubdir)) -lbz2
BZIP2_RPATH_LINK        = $(if $(BZIP2_HOME),$(call rpathlink,$(BZIP2_HOME)/$(libsubdir)))

ICONV_LIBS              = $(if $(ICONV_HOME),-L$(ICONV_HOME)/$(libsubdir)) $(ICONV_LIB)

ifneq ($(DB_HOME),)
   DB_FLAGS             = -I$(DB_HOME)/include
   DB_LIBS              = -L$(DB_HOME)/$(libsubdir) -ldb_cxx
   DB_RPATH_LINK        = $(call rpathlink,$(DB_HOME)/$(libsubdir))
else
   ifeq ($(shell if [ -d /usr/include/db48 -a -d /usr/$(libsubdir)/db48 ] ; then echo yes; fi), yes)
      DB_FLAGS          = -I/usr/include/db48
      DB_LIBS           = -L/usr/$(libsubdir)/db48 -ldb_cxx
   else
      DB_LIBS           = -ldb_cxx
   endif
endif

EXPAT_FLAGS             = $(if $(EXPAT_HOME),-I$(EXPAT_HOME)/include)
EXPAT_LIBS              = $(if $(EXPAT_HOME),-L$(EXPAT_HOME)/$(libsubdir)) -lexpat
EXPAT_RPATH_LINK        = $(if $(EXPAT_HOME),$(call rpathlink,$(EXPAT_HOME)/$(libsubdir)))

MCPP_LIBS              = $(if $(MCPP_HOME),-L$(MCPP_HOME)/$(libsubdir)) -lmcpp
MCPP_RPATH_LINK        = $(if $(MCPP_HOME),$(call rpathlink,$(MCPP_HOME)/$(libsubdir)))

ifeq ($(PLATFORM_HAS_READLINE),yes)
    ifeq ($(USE_READLINE),yes)
        READLINE_FLAGS  = -DHAVE_READLINE $(if $(READLINE_HOME),-I$(READLINE_HOME)/include)
        READLINE_LIBS   = $(if $(READLINE_HOME),-L$(READLINE_HOME)/$(libsubdir)) -lreadline -lncurses        
    endif
endif

ifneq ($(DB_HOME),)
endif

ICECPPFLAGS		= -I$(slicedir)
SLICE2CPPFLAGS		= $(ICECPPFLAGS)

ifeq ($(ice_dir), /usr) 
    CPPFLAGS		= 
    LDFLAGS		= $(LDPLATFORMFLAGS) $(CXXFLAGS)
else
    CPPFLAGS	= -I$(includedir)
    ifdef ice_src_dist
        LDFLAGS		= $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(libdir) 
    else
        LDFLAGS		= $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(ice_dir)/$(libsubdir) 
    endif
endif

ifeq ($(FLEX_NOLINE),yes)
    FLEXFLAGS	       := -L
else
    FLEXFLAGS	       :=
endif

ifeq ($(BISON_NOLINE),yes)
    BISONFLAGS		:= -dvtl
else
    BISONFLAGS		:= -dvt
endif

ifeq ($(mkshlib),)
    $(error You need to define mkshlib in Make.rules.$(UNAME)) 
endif

ifdef ice_src_dist
    SLICEPARSERLIB	= $(libdir)/$(call mklibfilename,Slice,$(VERSION))
    SLICE2CPP		= $(bindir)/slice2cpp
    SLICE2FREEZE	= $(bindir)/slice2freeze
else
    SLICEPARSERLIB	= $(ice_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION))
    SLICE2CPP		= $(ice_dir)/$(binsubdir)/slice2cpp
    SLICE2FREEZE	= $(ice_dir)/$(binsubdir)/slice2freeze
endif

EVERYTHING		= all depend clean install 

.SUFFIXES:
.SUFFIXES:		.cpp .c .o

.cpp.o:
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<

.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<


$(HDIR)/%F.h: $(SDIR)/%F.ice $(SLICE2CPP) $(SLICEPARSERLIB)
	rm -f $(HDIR)/$(*F)F.h $(*F)F.cpp
	$(SLICE2CPP) $(SLICE2CPPFLAGS) $<
	mv $(*F)F.h $(HDIR)
	rm -f $(*F)F.cpp

$(HDIR)/%.h %.cpp: $(SDIR)/%.ice $(SLICE2CPP) $(SLICEPARSERLIB)
	rm -f $(HDIR)/$(*F).h $(*F).cpp
	$(SLICE2CPP) $(SLICE2CPPFLAGS) $<
	mv $(*F).h $(HDIR)

%.h %.cpp: %.ice $(SLICE2CPP) $(SLICEPARSERLIB)
	rm -f $(*F).h $(*F).cpp
	$(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice	

#%.h %.cpp: %.y
#	rm -f $(*F).h $(*F).cpp
#	bison $(BISONFLAGS) $<
#	mv $(*F).tab.c $(*F).cpp
#	mv $(*F).tab.h $(*F).h
#	rm -f $(*F).output

#%.cpp: %.l
#	flex $(FLEXFLAGS) $<
#	rm -f $@
#	echo '#include <IceUtil/Config.h>' > $@
#	cat lex.yy.c >> $@
#	rm -f lex.yy.c

all:: $(SRCS) $(TARGETS)

depend:: $(SRCS)  $(patsubst $(SDIR)/%.ice,$(HDIR)/%.h,$(wildcard $(SDIR)/*F.ice)) $(SLICE_SRCS)
	-rm -f .depend .depend.mak
	if test -n "$(SRCS)" ; then \
	    $(CXX) -DMAKEDEPEND -M $(CXXFLAGS) $(CPPFLAGS) $(SRCS) | $(ice_dir)/config/makedepend.py; \
	fi
	if test -n "$(SLICE_SRCS)" ; then \
	    $(SLICE2CPP) --depend $(SLICE2CPPFLAGS) $(SLICE_SRCS) | $(ice_dir)/config/makedepend.py; \
	fi

clean::
	-rm -f $(TARGETS)
	-rm -f core *.o *.bak

ifneq ($(SLICE_SRCS),)
clean::
	rm -f $(addsuffix .cpp, $(basename $(notdir $(SLICE_SRCS))))
	rm -f $(addsuffix .h, $(basename $(notdir $(SLICE_SRCS))))
endif

ifneq ($(HDIR),)
clean::
	rm -f $(addprefix $(HDIR), $(addsuffix .h, $(basename $(subst $(SDIR),, \
	$(filter $(SDIR)/%.ice, $(SLICE_SRCS))))))
endif

ifneq ($(TEMPLATE_REPOSITORY),)
clean::
	rm -fr $(TEMPLATE_REPOSITORY)
endif

install::

3. Ice-3.4.2\cpp\config\Make.rules.Linux

# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

#
# This file is included by Make.rules when uname is Linux.
#

USE_SPARC_ASM           = irrelevant
MACHINE                 = $(shell uname -m)
SUSE_i586		= $(shell grep i586 /etc/SuSE-release 2>/dev/null)

ifneq ($(shell grep 'release 4' /etc/redhat-release 2>/dev/null),)
   NPTL_LIB		= -L/usr/$(libsubdir)/nptl
   NPTL_FLAGS		= -I/usr/include/nptl
endif

#
# Default compiler is c++ (aka g++).
#
ifeq ($(CXX),)
   CXX			= c++
endif

ifeq ($(CXX),g++)
   CXX			= c++
endif

ifeq ($(CXX),c++)

    ifneq ($(SUSE_i586),)
        CXXARCHFLAGS	+= -march=i586
    endif

   ifeq ($(MACHINE),sparc64)
      #
      # We are an ultra, at least, and so have the atomic instructions
      #
      $(warning ===================================================================) 
      $(warning Linux on SPARC is currently unsupported. The Ice team does not)
      $(warning maintain SPARC specific portions of the source code or build)
      $(warning system. Contact sales@zeroc.com if you wish to sponsor official)
      $(warning support.)
      $(warning ===================================================================) 
      USE_SPARC_ASM	= yes
      CXXARCHFLAGS	+= -mcpu=ultrasparc -pipe -Wno-deprecated -DUSE_SPARC_ASM
   endif

   ifeq ($(MACHINE),sparc)
      #
      # We are a sun4m or sun4c
      # On sun4m, there is a bug in some CPU/kernel/gcc configurations which
      # prevent us from using '-mcpu=v8'
      #
      $(warning ===================================================================) 
      $(warning Linux on SPARC is currently unsupported. The Ice team does not)
      $(warning maintain SPARC specific portions of the source code or build)
      $(warning system. Contact sales@zeroc.com if you wish to sponsor official)
      $(warning support.)
      $(warning ===================================================================) 
      USE_SPARC_ASM	= no
      CXXARCHFLAGS	+= -mtune=v8 -pipe -Wno-deprecated -DICE_USE_MUTEX_SHARED
   endif

   ifeq ($(MACHINE),x86_64)
      ifeq ($(LP64),yes)
         CXXARCHFLAGS	+= -m64
      else
         CXXARCHFLAGS	+= -m32
      endif
   endif

   CXXFLAGS		= $(CXXARCHFLAGS) -Wall -D_REENTRANT

   ifneq ($(GENPIC),no)
      CXXFLAGS		+= -fPIC
   endif

   ifeq ($(OPTIMIZE),yes)
      CXXFLAGS		+= -O2 -DNDEBUG
   else
      CXXFLAGS		+= -g 
   endif

   #
   # C++ run-time libraries, necessary for linking some shared libraries.
   #
   CXXLIBS		=

   mkshlib		= $(CXX) -shared $(LDFLAGS) -o $(1) -Wl,-h,$(2) $(3) $(4) -lpthread -lrt

   mklib		= ar cr $(1) $(2)

   rpathlink            = -Wl,-rpath-link,$(1) 

   ifneq ($(embedded_runpath_prefix),)
      LDPLATFORMFLAGS      = -Wl,--enable-new-dtags -Wl,-rpath,$(runpath_libdir)
   else
      LDPLATFORMFLAGS      = -Wl,--enable-new-dtags
   endif

   LDPLATFORMFLAGS	+= -rdynamic

endif

ifeq ($(CXX),icpc)
   $(warning ===================================================================) 
   $(warning Intel C++ is currently not supported. The Ice team does not)
   $(warning maintain Intel C++ specific portions of the source code or build)
   $(warning system.  Contact sales@zeroc.com if you wish to sponsor official)
   $(warning support.)
   $(warning ===================================================================) 
   CXXFLAGS		= -D_REENTRANT    

   ifneq ($(GENPIC),no)
      CXXFLAGS		+= -fPIC
   endif

   ifeq ($(OPTIMIZE),yes)
      CXXFLAGS		+= -O2 -DNDEBUG
   else
      CXXFLAGS		+= -g
   endif

   #
   # C++ run-time libraries, necessary for linking some shared libraries.
   #
   CXXLIBS		=

   mkshlib		= $(CXX) -shared $(LDFLAGS) -o $(1) -Wl,-h,$(2) $(3) $(4) -lpthread -lrt

   mklib		= ar cr $(1) $(2)

   rpathlink            = -Wl,-rpath-link,$(1) 

endif

BASELIBS		= -lIceUtil -lpthread -lrt
ifneq ($(NPTL_LIB),)
    CXXFLAGS		+= $(NPTL_FLAGS)
    BASELIBS		:= $(NPTL_LIB) $(BASELIBS)
endif

LIBS			= $(BZIP2_RPATH_LINK) -lIce $(BASELIBS)

ifneq ($(QT_HOME),)
   QT_FLAGS             = -I$(QT_HOME)/include
   QT_LIBS              = -L$(QT_HOME)/$(libsubdir) -lQtCore -lQtSql
   QT_RPATH_LINK        = $(call rpathlink,$(QT_HOME)/$(libsubdir))
endif

ICEUTIL_OS_LIBS         = 
ICE_OS_LIBS             = -ldl

PLATFORM_HAS_READLINE   = yes

4. Ice-3.4.2\cpp\src\IceUtil\Makefile

# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

top_srcdir	= ../..

LIBFILENAME     = $(call mklibfilename,IceUtil,$(VERSION))
SONAME          = $(call mksoname,IceUtil,$(SOVERSION))  
LIBNAME		= $(call mklibname,IceUtil)

TARGETS		= $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))

OBJS		= ArgVector.o \
		  Cond.o \
		  ConvertUTF.o \
		  CountDownLatch.o \
		  CtrlCHandler.o \
		  Exception.o \
		  FileUtil.o \
		  InputUtil.o \
		  Options.o \
		  OutputUtil.o \
		  Random.o \
		  RWRecMutex.o \
		  RecMutex.o \
		  StaticMutex.o \
		  Shared.o \
		  StringUtil.o \
		  Thread.o \
		  ThreadException.o \
		  Time.o \
		  Timer.o \
		  UUID.o \
		  Unicode.o \
		  MutexProtocol.o

SRCS		= $(OBJS:.o=.cpp)

include $(top_srcdir)/config/Make.rules

CPPFLAGS        := $(CPPFLAGS) -DICE_UTIL_API_EXPORTS -I..

LINKWITH        := $(STLPORT_LIBS) $(ICEUTIL_OS_LIBS)

ifeq ($(STATICLIBS),yes)
$(libdir)/$(LIBNAME): $(OBJS)
	rm -f $@
	$(call mklib,$@,$(OBJS))
else
$(libdir)/$(LIBFILENAME): $(OBJS)
	rm -f $@
	$(call mkshlib,$@,$(SONAME),$(OBJS),$(LINKWITH))

$(libdir)/$(SONAME): $(libdir)/$(LIBFILENAME)
	rm -f $@
	ln -s $(LIBFILENAME) $@

$(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
	rm -f $@
	ln -s $(SONAME) $@
endif

install:: all
	$(call installlib,$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))

include .depend

parser: parser.o
	rm -f $@
	$(CXX) $(LDFLAGS) -o $@ parser.o $(BASELIBS)

6. Ice-3.4.2\cpp\Makefile

# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

top_srcdir	= .

include $(top_srcdir)/config/Make.rules

SUBDIRS		= config src include test demo

INSTALL_SUBDIRS	= $(install_bindir) $(install_libdir) $(install_includedir) $(install_configdir)

install:: install-common
	@for subdir in $(INSTALL_SUBDIRS); \
	do \
	    if test ! -d $$subdir ; \
	    then \
		echo "Creating $$subdir..." ; \
		mkdir -p $$subdir ; \
		chmod a+rx $$subdir ; \
	    fi ; \
	done
ifeq ($(create_runpath_symlink),yes)
	@if test -h $(embedded_runpath_prefix) ; \
	then \
	     if `\rm -f $(embedded_runpath_prefix) 2>/dev/null`; \
              then echo "Removed symbolic link $(embedded_runpath_prefix)"; fi \
        fi
	@if ! test -d $(embedded_runpath_prefix) ; \
	then \
	     if `ln -s $(prefix) $(embedded_runpath_prefix) 2>/dev/null`; \
              then echo "Created symbolic link $(embedded_runpath_prefix) --> $(prefix)"; fi \
	fi
endif

$(EVERYTHING)::
	@for subdir in $(SUBDIRS); \
	do \
	    echo "making $@ in $$subdir"; \
	    ( cd $$subdir && $(MAKE) $@ ) || exit 1; \
	done

test::
	@python $(top_srcdir)/allTests.py



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值