# ********************************************************************** # # Copyright (c) 2003-2016 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) # # Define OPTIMIZE as yes if you want to build with # optimization. Otherwise Ice is build with debug information. # #OPTIMIZE = yes # # The "root directory" for runpath embedded in executables. Can be set # to change the runpath added to Ice executables. The default is # platform dependent (Linux only, on OS X the embedded runpath is # always @loader_path/../lib). # #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 embedded_runpath as no if you don't want any RPATH added to # the executables (Linux only, on OS X we always add a runpath). # embedded_runpath ?= yes # # Define new_dtags as yes if you want the linker to enable the new style # dtags, this will cause the linker to add a runpath entry instead of # a rpath entry. This only aplly to gcc builds on linux # new_dtags ?= no # # Define LP64 as yes or no if you want force a 32 or 64 bit. The # default is platform-dependent. This property has no effect on # OS X. On OS X, use CXXARCHFLAGS bellow to establish the build # architectures. # #LP64 ?= yes # # The build architectures for gcc/llvm based builds. The format of # these build flags are OS dependent. For example, under 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 # # 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 # # Generate position independent code unless GENPIC is set to no # #GENPIC ?= yes # # Default Mutex protocol: one of PrioNone or PrioInherit. # #DEFAULT_MUTEX_PROTOCOL ?= PrioNone # # Define CPP11 as yes if you want to enable C++11 features in GCC or # Clang. # #CPP11 ?= yes # ---------------------------------------------------------------------- # Don't change anything below this line! # ---------------------------------------------------------------------- # # Compile scanner and grammar files? # #BISON_FLEX ?= yes # # 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)/$(libsubdir) 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_bindir := $(prefix)/$(binsubdir)$(cpp11suffix) install_libdir := $(prefix)/$(libsubdir)$(cpp11suffix) ifndef usr_dir_install install_mandir := $(prefix)/man/man1 install_configdir := $(prefix)/config else install_configdir := $(prefix)/share/Ice-$(VERSION) install_mandir := $(prefix)/share/man/man1 endif ifeq ($(DEFAULT_MUTEX_PROTOCOL), PrioInherit) ICEUTIL_FLAGS = -DICE_PRIO_INHERIT endif OPENSSL_FLAGS += $(if $(OPENSSL_HOME),-I$(OPENSSL_HOME)/include) ifeq ($(OPENSSL_LIBS),) OPENSSL_LIBS = $(if $(OPENSSL_HOME),-L$(OPENSSL_HOME)/$(libsubdir)) -lssl -lcrypto endif OPENSSL_RPATH_LINK = $(if $(OPENSSL_HOME),$(call rpathlink,$(OPENSSL_HOME)/$(libsubdir))) ifeq ($(SSL_OS_LIBS),) SSL_OS_LIBS = $(OPENSSL_LIBS) endif ifneq ($(UNAME),MINGW) ifneq ($(BZIP2_HOME),) BZIP2_FLAGS = -I$(BZIP2_HOME)/include) endif ifeq ($(BZIP2_LIBS),) BZIP2_LIBS = $(if $(BZIP2_HOME),-L$(BZIP2_HOME)/$(libsubdir)) -lbz2 endif BZIP2_RPATH_LINK = $(if $(BZIP2_HOME),$(call rpathlink,$(BZIP2_HOME)/$(libsubdir))) endif ifeq ($(ICONV_LIBS),) ICONV_LIBS = $(if $(ICONV_HOME),-L$(ICONV_HOME)/$(libsubdir)) $(ICONV_LIB) endif ifneq ($(DB_HOME),) DB_FLAGS = -I$(DB_HOME)/include ifeq ($(DB_LIBS),) DB_LIBS = -L$(DB_HOME)/$(libsubdir) -ldb_cxx endif DB_RPATH_LINK = $(call rpathlink,$(DB_HOME)/$(libsubdir)) else ifeq ($(shell if [ -d /usr/include/db53 -a -d /usr/$(libsubdir)/db53 ] ; then echo yes; fi), yes) DB_FLAGS = -I/usr/include/db53 DB_LIBS = -L/usr/$(libsubdir)/db53 -ldb_cxx else ifeq ($(shell if [ -d /usr/local/include/db53 -a -d /usr/local/$(libsubdir)/db53 ] ; then echo yes; fi), yes) DB_FLAGS = -I/usr/local/include/db53 DB_LIBS = -L/usr/local/$(libsubdir)/db53 -ldb_cxx else DB_LIBS = -ldb_cxx endif endif endif EXPAT_FLAGS = $(if $(EXPAT_HOME),-I$(EXPAT_HOME)/include) ifeq ($(EXPAT_LIBS),) EXPAT_LIBS = $(if $(EXPAT_HOME),-L$(EXPAT_HOME)/$(libsubdir)) -lexpat endif EXPAT_RPATH_LINK = $(if $(EXPAT_HOME),$(call rpathlink,$(EXPAT_HOME)/$(libsubdir))) ifeq ($(MCPP_LIBS),) ifeq ($(MCPP_HOME),) # # If libmcpp.a is in the third-party subdirectory, we are building the core C++ distribution # and we used that mcpp package. # ifneq ($(wildcard ../../../third-party/mcpp/lib/libmcpp.a),) MCPP_HOME = ../../../third-party/mcpp endif endif MCPP_LIBS = $(if $(MCPP_HOME),-L$(MCPP_HOME)/$(libsubdir)) -lmcpp endif 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 endif endif ICECPPFLAGS = -I$(slicedir) SLICE2CPPFLAGS = $(ICECPPFLAGS) ifeq ($(ice_dir), $(usr_dir)) LDFLAGS = $(LDPLATFORMFLAGS) $(CXXFLAGS) ifeq ($(CPP11),yes) LDFLAGS = $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(ice_dir)/$(libsubdir)$(cpp11libdirsuffix) endif else CPPFLAGS += -I$(includedir) ifdef ice_src_dist LDFLAGS = $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(libdir)$(cpp11libdirsuffix) else LDFLAGS = $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(ice_dir)/$(libsubdir)$(cpp11libdirsuffix) 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 ifeq ($(mktestname),) mktestname = $(1)$(EXE_EXT) endif ifeq ($(mktest),) mktest = $(CXX) $(LDFLAGS) $(LDEXEFLAGS) -o $(@) $(2) $(3) endif ifdef ice_src_dist ifeq ($(STATICLIBS),yes) SLICEPARSERLIB = else SLICEPARSERLIB = $(libdir)/$(call mklibfilename,Slice,$(VERSION)) endif SLICE2CPP = $(bindir)/slice2cpp SLICE2FREEZE = $(bindir)/slice2freeze else SLICEPARSERLIB = $(ice_dir)/$(libsubdir)/$(subst $(cpp11libsuffix),,$(call mklibfilename,Slice,$(VERSION))) ifeq ($(wildcard $(SLICEPARSERLIB)),) SLICEPARSERLIB = $(ice_dir)/$(lib64subdir)/$(subst $(cpp11libsuffix),,$(call mklibfilename,Slice,$(VERSION))) endif SLICE2CPP = $(ice_dir)/$(binsubdir)/slice2cpp SLICE2FREEZE = $(ice_dir)/$(binsubdir)/slice2freeze endif ifeq ($(SLICE_LIBS),) ifeq ($(STATICLIBS),yes) SLICE_LIBS = -lSlice $(MCPP_LIBS) $(BASELIBS) else SLICE_LIBS = -lSlice $(BASELIBS) endif endif ifeq ($(ICESSL_LIBS),) ICESSL_LIBS = -lIceSSL endif EVERYTHING = all clean install compile-slice EVERYTHING_EXCEPT_ALL = clean install compile-slice .SUFFIXES: .SUFFIXES: .cpp .c .o ifneq ($(SLICE_OBJS),) -include $(addprefix .depend/, $(SLICE_OBJS:.o=.ice.d)) endif # # If dependencies haven't been created yet make all OBJS depend on all # SRCS, Slice generated files will be created before C++ compilation # starts. This prevents issues parallel make. # ifneq ($(OBJS),) ifeq ($(wildcard .depend/*.d),) $(OBJS):$(OBJS:.o=.cpp) else -include $(addprefix .depend/, $(OBJS:.o=.d)) # # OBJS depend on the non existing sources so generated files are created # before compilation takes place. # $(OBJS):$(filter-out $(wildcard $(OBJS:.o=.cpp)) ,$(OBJS:.o=.cpp)) clean:: rm -rf .depend endif endif all:: $(TARGETS) .cpp.o: $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< @mkdir -p .depend @$(CXX) -DMAKEDEPEND -MM $(CPPFLAGS) $< > .depend/$(*F).d .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) @touch $(*F)F.cpp @mkdir -p .depend @$(SLICE2CPP) $(SLICE2CPPFLAGS) --depend $< | sed 's/\(.*: \\\)/\$$(HDIR)\/\1/' > .depend/$(*F)F.ice.d $(HDIR)/%.h %.cpp: $(SDIR)/%.ice $(SLICE2CPP) $(SLICEPARSERLIB) rm -f $(HDIR)/$(*F).h $(*F).cpp $(SLICE2CPP) $(SLICE2CPPFLAGS) $< mv $(*F).h $(HDIR) @touch $(*F).cpp @mkdir -p .depend @$(SLICE2CPP) $(SLICE2CPPFLAGS) --depend $< | sed 's/\(.*: \\\)/\$$(HDIR)\/\1/' > .depend/$(*F).ice.d #%.h %.cpp: %.ice $(SLICE2CPP) $(SLICEPARSERLIB) %.h %.cpp: %.ice $(SLICE2CPP) rm -f $(*F).h $(*F).cpp $(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice @touch $(*F).cpp @mkdir -p .depend @$(SLICE2CPP) $(SLICE2CPPFLAGS) --depend $(*F).ice > .depend/$(*F).ice.d ifeq ($(BISON_FLEX),yes) %.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 ' >> $@ cat lex.yy.c >> $@ rm -f lex.yy.c endif clean:: -rm -f $(TARGETS) -rm -f core *.o *.bak -rm -rf .depend ifneq ($(SLICE_OBJS),) clean:: rm -f $(addsuffix .cpp, $(basename $(notdir $(SLICE_OBJS)))) rm -f $(addsuffix .h, $(basename $(notdir $(SLICE_OBJS)))) endif ifneq ($(HDIR),) clean:: rm -f $(addprefix $(HDIR)/, $(addsuffix .h, $(basename $(SLICE_OBJS)))) endif ifneq ($(SLICE_OBJS),) compile-slice:: $(SLICE_OBJS:.o=.cpp) else compile-slice:: endif install::