Skip to content

Commit

Permalink
Update build system
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed May 23, 2016
1 parent 27ff320 commit af8ca00
Show file tree
Hide file tree
Showing 82 changed files with 2,871 additions and 4,444 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
64 changes: 25 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,38 @@
#
# 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.
#
# **********************************************************************

SUBDIRS = cpp java
CLEAN_SUBDIRS = java cpp
DEPEND_SUBDIRS = cpp
INSTALL_SUBDIRS = cpp java

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

clean::
@for subdir in $(CLEAN_SUBDIRS); \
do \
echo "making clean in $$subdir"; \
( cd $$subdir && $(MAKE) clean ) || exit 1; \
done
include $(top_srcdir)/config/Make.rules

depend::
@for subdir in $(DEPEND_SUBDIRS); \
define make-global-rule
$1::
@for subdir in $2; \
do \
echo "making depend in $$subdir"; \
( cd $$subdir && $(MAKE) depend ) || exit 1; \
echo "making all in $$$$subdir"; \
( cd $$$$subdir && $(MAKE) $1 ) || exit 1; \
done
endef

install::
@for subdir in $(INSTALL_SUBDIRS); \
do \
echo "making install in $$subdir"; \
( cd $$subdir && $(MAKE) install ) || exit 1; \
done
$(eval $(call make-global-rule,srcs,$(languages)))
$(eval $(call make-global-rule,tests,$(languages)))
$(eval $(call make-global-rule,all,$(languages)))
$(eval $(call make-global-rule,clean,$(languages)))
$(eval $(call make-global-rule,distclean,$(languages)))
$(eval $(call make-global-rule,install,$(languages)))

test::
@for subdir in $(SUBDIRS); \
do \
echo "making test in $$subdir"; \
( cd $$subdir && $(MAKE) test ) || exit 1; \
done
#
# Install documentation and slice files
#
install:: install-doc install-slice

cpp::
echo "making all in cpp";
( cd cpp && $(MAKE) all ) || exit 1;
$(eval $(call install-data-files,$(wildcard $(slicedir)/*/*.ice),$(slicedir),$(install_slicedir),\
install-slice,"Installing slice files"))

java::
echo "making all in java";
( cd java && $(MAKE) all ) || exit 1;
$(eval $(call install-data-files,$(wildcard $(top_srcdir)/*LICENSE),$(top_srcdir),$(install_docdir),\
install-doc,"Installing documentation files"))
144 changes: 144 additions & 0 deletions config/Make.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

#
# 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 set
# to change the runpath added to Ice executables.
#
# If not set, a runpath relative to the path of the executable is
# embedded (using @loader_path on OS X and $ORIGIN on Linux).
#
#embedded_runpath_prefix ?= /opt/Ice-$(mmversion)

#
# Define embedded_runpath as no if you don't want any runpath added to
# the executables. If not set, defaults to to "yes"
#
embedded_runpath ?= yes

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

#
# Define PLATFORMS to the list of platforms to build. This defaults
# to the first supported platform for this system.
#
# Run `make print V=supported-platforms' to see the list of supported
# platforms on this system.
#
PLATFORMS ?= $(firstword $(supported-platforms))

#
# Configurations to build. This defaults to the first supported
# configuration.
#
# Run `make print V=supported-configs` to see the list of supported
# configurations.
#
CONFIGS ?= $(firstword $(supported-configs))

#
# Third-party libraries
#
# If a third-party library is not installed in a standard location
# where the compiler can find it, set the corresponding variable
# below to the installation directory of the library.
#
#DB_HOME ?= /opt/db
#EXPAT_HOME ?= /opt/expat
#BZ2_HOME ?= /opt/bz2
#MCPP_HOME ?= /opt/mcpp

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

os ?= $(shell uname)

include $(top_srcdir)/ice/config/Make.rules.$(os)
include $(top_srcdir)/ice/config/Make.project.rules
include $(top_srcdir)/ice/config/Make.tests.rules

-include $(top_srcdir)/config/Make.rules.$(os)

ifeq ($(USE_BIN_DIST),yes)
prefix := $(or $(ICE_HOME),$(if $(filter Darwin,$(os)),/usr/local,/usr))
bindir ?= $(install_bindir)
libdir ?= $(install_libdir)
slicedir ?= $(install_slicedir)
includedir ?= $(install_includedir)
else
bindir ?= $(call mappingdir,$(or $1,$(currentdir)),bin)
libdir ?= $(call mappingdir,$(or $1,$(currentdir)),lib)
slicedir ?= $(top_srcdir)/slice
includedir ?= $(call mappingdir,$(or $1,$(currentdir)),include)

ice_bindir ?= $(top_srcdir)/ice/cpp/bin
ice_libdir ?= $(top_srcdir)/ice/cpp/lib
ice_slicedir ?= $(top_srcdir)/ice/slice
ice_includedir ?= $(top_srcdir)/ice/cpp/include
endif

version = 3.7a0
soversion = 37a0
ice_src_dist := $(wildcard $(ice_home)/config/Make.rules)

usr_dir_install := $(filter /usr%,$(prefix))
install_bindir ?= $(prefix)/bin
install_libdir ?= $(prefix)/lib
install_slicedir ?= $(prefix)$(if $(usr_dir_install),/share/Ice-$(version))/slice
install_includedir ?= $(prefix)/include
install_docdir ?= $(prefix)$(if $(usr_dir_install),/share/Ice-$(version))
install_mandir ?= $(prefix)$(if $(usr_dir_install),/share)/man

#
# Languages, platforms and configurations to build
#
supported-languages ?= cpp java
supported-configs ?= shared static

#
# Support for 3rd party libraries
#
thirdparties := bz2 db expat mcpp
bz2_home := $(BZ2_HOME)
db_home := $(DB_HOME)
db_ldflags := -ldb_cxx
expat_home := $(EXPAT_HOME)
mcpp_home := $(MCPP_HOME)

define make-thirdparty
ifneq ($($1_home),)
# Check for 3rd party libraries either in home/lib<platform specific subdir> or home/lib
$1_libdir ?= $$(strip $$(if $$(wildcard $$($1_home)/lib$$(call platform-var,installdir,$$1,$$2,$$3)),\
$$($1_home)/lib$$(call platform-var,installdir,$$1,$$2,$$3),$$($1_home)/lib))
$1_includedir ?= $$($1_home)/include
endif
$1_ldflags ?= -l$1
endef
$(foreach l,$(thirdparties),$(eval $(call make-thirdparty,$l)))

#
# Support for Ice libraries
#
static_projects = %
shared_excludes = IceUtil Slice

$(eval $(call load-dependencies,$(addprefix $(top_srcdir)/ice/cpp/src/,IceUtil Slice Ice IceXML)))

# Create component dependency variables
ice_targetdir := $(top_srcdir)/ice/cpp/lib
$(foreach d,$(dependencies),$(eval $(call create-component-targets,ice,$d,library)))

11 changes: 11 additions & 0 deletions config/Make.rules.Darwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

ifeq ($(DB_HOME),)
ifneq ($(wildcard /usr/local/opt/berkeley-db53),)
DB_HOME = /usr/local/opt/berkeley-db53
endif
endif
67 changes: 27 additions & 40 deletions cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,35 @@
#
# **********************************************************************

top_srcdir = .
top_srcdir := ..
lang_srcdir := $(top_srcdir)/cpp

include $(top_srcdir)/make/Make.rules
include $(top_srcdir)/config/Make.rules
include $(lang_srcdir)/config/Make.rules

SUBDIRS = src include

ifneq ($(MAKECMDGOALS),install)
SUBDIRS := $(SUBDIRS) test demo
endif

INSTALL_SUBDIRS = $(install_bindir) $(install_libdir)$(cpp11libdirsuffix) $(install_includedir) \
$(install_mandir)

install:: install-common
@for subdir in $(INSTALL_SUBDIRS); \
do \
if test ! -d $(DESTDIR)$$subdir ; \
then \
echo "Creating $(DESTDIR)$$subdir..." ; \
mkdir -p $(DESTDIR)$$subdir ; \
chmod a+rx $(DESTDIR)$$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
#
# Create projects for all the Slice translators from src/slice2* and load source projects.
#
projects :=
include $(shell find $(lang_srcdir)/src -name Makefile.mk)
$(foreach t,$(wildcard $(lang_srcdir)/src/slice2*),$(eval $(call create-translator-project,$(call project,$t))))
$(call make-projects,$(projects),make-cpp-src-project)

$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
do \
echo "making $@ in $$subdir"; \
( cd $$subdir && $(MAKE) $@ ) || exit 1; \
done
#
# Create and load test projects.
#
projects :=
tests := $(tests-without-project-makefile)
include $(shell find $(lang_srcdir)/test -name Makefile.mk)
$(foreach t,$(tests),$(eval $(call create-cpp-test-project,$(t))))
$(call make-projects,$(projects),make-cpp-test-project)

test::
@python $(top_srcdir)/allTests.py
#
# Create and load demo projects.
#
projects :=
demos :=
include $(shell find $(lang_srcdir)/demo -name Makefile.mk)
$(foreach d,$(demos),$(eval $(call create-cpp-demo-project,$(d))))
$(call make-projects,$(projects),make-cpp-demo-project)
Loading

0 comments on commit af8ca00

Please sign in to comment.