# # Copyright (c) ZeroC, Inc. All rights reserved. # # # Use specific PHP version # PHP_CONFIG ?= php-config # # The extension is by default built with namespaces enabled # it is possible to build the PHP extension with namespaces # disabled by setting `USE_NAMESPACES` property to `no` # USE_NAMESPACES ?= yes # ---------------------------------------------------------------------- # Don't change anything below this line! # ---------------------------------------------------------------------- ifneq ($(USE_NAMESPACES),yes) slice2php_flags = --no-namespace endif # # $(call make-php-test-project,$1=testdir) # define make-php-test-project $1/.depend/%.ice.d: | $1/.depend ; $1/.depend: $(Q)$(MKDIR) -p $$@ .PRECIOUS: $1/.depend/%.ice.d ifeq ($(filter %clean,$(MAKECMDGOALS)),) # Include the dependencies -include $(addprefix $1/.depend/,$(call source-to-dependency,$(wildcard $1/*.ice))) endif $1/%.php: $1/%.ice $1/.depend/%.ice.d $(slice2php_path) $(E) "Compiling $$<" $(Q)$(slice2php_path) $(slice2php_flags) -I$(slicedir) -I$1 --output-dir $1 $$($1_sliceflags) --depend $$< | \ sed 's/\(.*: \\\)/$(subst /,\/,$2)\/$3\/\1/' > $1/.depend/$$(*F).ice.d $(Q)$(slice2php_path) $(slice2php_flags) -I$(slicedir) -I$1 --output-dir $1 $$($1_sliceflags) $$< distclean clean:: $(E) "Cleaning $1" $(Q)$(RM) -r $1/.depend $(Q)$(RM) $(patsubst $1/%.ice,$1/%.php,$(wildcard $1/*.ice)) tests generate-srcs srcs all:: $(patsubst $1/%.ice,$1/%.php,$(wildcard $1/*.ice)) endef # Configuration for building IcePHP sources ifeq ($(filter all php,$(ICE_BIN_DIST)),) ifneq ($(shell type $(PHP_CONFIG) > /dev/null 2>&1 && echo 0),0) $(error $(PHP_CONFIG) not found review your PHP installation and ensure $(PHP_CONFIG) is in your PATH) endif php_cppflags = $(shell $(PHP_CONFIG) --includes) ifeq ($(USE_NAMESPACES),yes) php_cppflags := $(php_cppflags) -DICEPHP_USE_NAMESPACES endif # PHP 5.3 does not compile with C++11 due to an issue with # user defined literals. PHP 5.4 and up do not have this issue. ifeq ($(shell [ $$($(PHP_CONFIG) --vernum) -lt 50400 ] && echo 0),0) php_cppflags := -std=c++98 $(php_cppflags) endif ifeq ($(os),Darwin) php_cppflags := $(php_cppflags) -Wno-unused-parameter -Wno-missing-field-initializers php_ldflags := ${wl}-flat_namespace ${wl}-undefined ${wl}suppress endif ifeq ($(os),Linux) cppflags := $(filter-out -Wshadow,$(cppflags)) php_cppflags := $(php_cppflags) -Wno-unused-parameter -Wno-missing-field-initializers allow-undefined-symbols := yes endif # # On the default platform, always write/install the module in the lib directory. # $(foreach p,$(supported-platforms),$(eval $$p_targetdir[IcePHP] := /$$p)) $(firstword $(supported-platforms))_targetdir[IcePHP] := $(firstword $(supported-platforms))_installdir[IcePHP] := # # PHP installation directory # install_phpdir ?= $(if $(usr_dir_install),$(prefix)/share/php,$(prefix)/php) install_phplibdir ?= $(if $(usr_dir_install),$(shell $(PHP_CONFIG) --extension-dir),$(prefix)/php) # # Rules to build a php module. We just compute the name of the php module # and delegate to make-shared-module. # mkphpmodulename ?= $(patsubst lib%,%,$(call mkshlibname,$(1))) make-shared-php-module = $(call make-shared-module,$(call mkphpmodulename,$1),$2,$3,$4,$5,$6,$7,$8,$9) get-shared-php-module-targets = $(call get-shared-module-targets,$(call mkphpmodulename,$1),$2,$3,$4) install-shared-php-module = $(call install-shared-module,$(call mkphpmodulename,$1),$2,$3,$4,$5) $(DESTDIR)$(install_phpdir): $(Q)$(MKDIR) -p $@ installdirs += $(install_phpdir) # # $(call make-php-package,$1=slicedir,$2=generateddir,$3=package,$4=sliceflags) # # Compile slice files from $(slicedir)/ to php/. # define make-php-package ifeq ($(filter all php, $(ICE_BIN_DIST)),) $2/$3/.depend/%.ice.d: | $2/$3/.depend ; $2/$3/.depend: $(Q)$(MKDIR) -p $$@ .PRECIOUS: $2/$3/.depend/%.ice.d ifeq ($(filter %clean,$(MAKECMDGOALS)),) # Include the dependencies -include $(addprefix $2/$3/.depend/,$(call source-to-dependency,$(wildcard $1/$3/*.ice))) endif $2/$3/%.php: $1/$3/%.ice $2/$3/.depend/%.ice.d $(slice2php_path) $(E) "Compiling $$<" $(Q)$(slice2php_path) $(slice2php_flags) -I$1 --output-dir $2/$3 $4 --depend $$< | \ sed 's/\(.*: \\\)/$(subst /,\/,$2)\/$3\/\1/' > $2/$3/.depend/$$(*F).ice.d $(Q)$(slice2php_path) $(slice2php_flags) -I$1 --output-dir $2/$3 $4 $$< distclean clean:: $(E) "Cleaning package $3" $(Q)$(RM) -r $2/$3/.depend $(Q)$(RM) $(patsubst $1/$3/%.ice,$2/$3/%.php,$(wildcard $1/$3/*.ice)) generate-srcs srcs all:: $(patsubst $1/$3/%.ice,$2/$3/%.php,$(wildcard $1/$3/*.ice)) $$(eval $$(call install-data-files,$(patsubst $1/$3/%.ice,$2/$3/%.php,$(wildcard $1/$3/*.ice)),$2,$(install_phpdir),install)) endif endef endif