This file, 'phpc.mkh', is the 'header makefile' containing variables and macros used to process *.phpc source files.
define XME_phpc_require_once
$$XME_phpc_required_file=$(1); \
$$XME_phpc_error_message=$(2);\
if (empty($$XME_phpc_error_message)){\
$$XME_phpc_error_message="XME_phpc_require_once: failed \
including file: \n";\
}\
$$success=include_once($(1)); \
if (!$$success){\
trigger_error($$XME_phpc_error_message." \
".$$XME_phpc_required_file."\n", E_USER_ERROR); \
}
endef
define XME_phpc_cmd_options
$(if $(XMAKE_EXT_PHPC_PHP_INI),-c \
$(XMAKE_EXT_PHPC_PHP_INI)) \
-d log_errors=1 \
-d error_log= \
-d display_errors=0 \
-d display_startup_errors=0
endef
define XME_phpc_highlight_files_command
outfile="$(2)"; \
$(XME_phpc_cmd) \
$(XME_phpc_cmd_options) \
-r '\
$(call XME_phpc_require_once,\
getenv("XMAKE_HOME")."/config/XMExtensions/phpc.inc",\
"XME_phpc_highlight_files_command: failed including file: \
\n") \
$$XMAKE_XME_PHPC_ERROR_REPORTING_MASK = \
getenv("XMAKE_XME_PHPC_ERROR_REPORTING_MASK"); \
error_reporting($$XMAKE_XME_PHPC_ERROR_REPORTING_MASK); \
set_error_handler("phpc_error_handler"); \
highlight_file("$(1)"); \
' \
1>$(XMAKE_TMP_DIR)/XME_phpc_highlight_files_command.$$$$ \
\
|| \
{ echo '*** FAILURE (XME_phpc_highlight_files_command): \
processing source file: ' >&2; \
echo '$(1)' >&2; \
if test -s \
"$(XMAKE_TMP_DIR)/XME_phpc_highlight_files_command.$$$$"; \
then \
echo 'Standard Output follows:' >&2; \
cat \
$(XMAKE_TMP_DIR)/XME_phpc_highlight_files_command.$$$$ \
>&2; \
fi; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null; exit 1; \
}; \
cat \
$(XMAKE_TMP_DIR)/XME_phpc_highlight_files_command.$$$$ \
1>"$$outfile" 2>/dev/null; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null
endef
XME_phpc_cmd:=$(XMAKE_XME_PHPC)
define XME_phpc_dependCmd
cd $(dir $(1)); \
export \
XMAKE_XME_phpc_result=$(XMAKE_TMP_DIR)/phpc_dependCmd_result.$$$$; \
\
$(XME_phpc_cmd) \
$(XME_phpc_cmd_options) \
-r '\
$(call XME_phpc_require_once,\
getenv("XMAKE_HOME")."/config/XMExtensions/phpc.inc",\
"XME_phpc_dependCmd: failed including file: \n") \
$$XMAKE_XME_PHPC_FATAL_ERROR_MASK=0; \
error_reporting(0); \
phpc_setenv( "$(1)"); \
set_error_handler("phpc_error_handler"); \
$(call XME_phpc_require_once,\
"$(1)",\
"XME_phpc_dependCmd: failed including source file: \n") \
$$XMAKE_XME_phpc_result = \
getenv("XMAKE_XME_phpc_result"); \
$$files = phpc_get_prerequisites();\
$$str = join(" ",$$files); \
$$fp = @fopen( $$XMAKE_XME_phpc_result, "w"); \
fputs( $$fp, $$str ); \
' \
1>$(XMAKE_TMP_DIR)/phpc_dependCmd_out.$$$$ \
|| \
{ echo '*** FAILURE (XME_phpc_dependCmd): processing \
source file: ' >&2; \
echo '$(1)' >&2; \
if test -s "$(XMAKE_TMP_DIR)/phpc_dependCmd_out.$$$$"; \
then \
echo 'Standard Output follows:' >&2; \
cat $(XMAKE_TMP_DIR)/phpc_dependCmd_out.$$$$ >&2 ; \
fi; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null; exit 1; \
}; \
cat $$XMAKE_XME_phpc_result 2>/dev/null; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null;
endef
define XME_phpc_lintCmd
$(XME_phpc_cmd) \
$(XME_phpc_cmd_options) \
-r '\
$(call XME_phpc_require_once,\
getenv("XMAKE_HOME")."/config/XMExtensions/phpc.inc",\
"XME_phpc_lintCmd: failed including file: \n") \
$$XMAKE_XME_PHPC_FATAL_ERROR_MASK=$(XMAKE_XME_PHPC_LINT_FATAL_ERROR_MASK); \
\
phpc_setenv( "$(1)"); \
set_error_handler("phpc_error_handler"); \
$$$(1)=getenv("$(1)"); \
$(call XME_phpc_require_once,\
$$$(1),\
"XME_phpc_lintCmd: failed including source file: \n") \
' \
1>$(XMAKE_TMP_DIR)/XME_phpc_lintCmd.$$$$ \
|| \
{ echo '*** FAILURE (XME_phpc_lintCmd): processing source \
file: ' >&2; \
echo "$$$(1)" >&2; \
if test -s "$(XMAKE_TMP_DIR)/XME_phpc_lintCmd.$$$$"; then \
\
echo 'Standard Output follows:' >&2; \
cat $(XMAKE_TMP_DIR)/XME_phpc_lintCmd.$$$$ >&2; \
fi; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null; exit 1; \
}; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null
endef
XM_finalTargets+=$(XMAKE_EXTENSIONS_DIR)/phpc.inc
define XME_phpc_dependencies
$(call XME_phpc_dependCmd,$(1)) $(2)
endef
define XME_phpc_outfileMap
$(patsubst %.phpc,%,$(filter %.phpc,$(1)))
endef
define XME_phpc_outfileMacro
outfile="$(call XME_outfile,phpc,$(1),$(3))"; \
cd $(dir $(1)); \
$(XME_phpc_cmd) \
$(XME_phpc_cmd_options) \
-r '\
$(call XME_phpc_require_once,\
getenv("XMAKE_HOME")."/config/XMExtensions/phpc.inc",\
"phpc_outfileMacro: failed including file: \n") \
$$XMAKE_XME_PHPC_ERROR_REPORTING_MASK = \
getenv("XMAKE_XME_PHPC_ERROR_REPORTING_MASK"); \
error_reporting($$XMAKE_XME_PHPC_ERROR_REPORTING_MASK); \
phpc_setenv( "$(1)"); \
set_error_handler("phpc_error_handler"); \
/* execute any PHP code passed in: */ \
$(2) \
$(call XME_phpc_require_once,\
"$(1)",\
"XM_phpc_outfileMacro: failed including source file: \n") \
\
' 1>$(XMAKE_TMP_DIR)/phpc_outfileMacro.$$$$ \
|| \
{ echo '*** FAILURE (XME_phpc_outfileMacro): processing \
source file: ' >&2; \
echo '$(1)' >&2; \
if test -s "$(XMAKE_TMP_DIR)/phpc_outfileMacro.$$$$"; \
then \
echo 'Standard Output follows:' >&2; \
cat $(XMAKE_TMP_DIR)/phpc_outfileMacro.$$$$ >&2; \
fi; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null; exit 1; \
}; \
cat $(XMAKE_TMP_DIR)/phpc_outfileMacro.$$$$ 1>"$$outfile" \
2>/dev/null; \
rm -f $(XMAKE_TMP_DIR)/*.$$$$ 2>/dev/null
endef
XM_finalTargets+=$(XME_phpc_cmd)
define XME_phpc_highlight_files
_XME_phpc_highlighted_files:=$(patsubst %,%$(2),$(1))
$(call XM_externalTargetsHandler,$(1))
$(call \
XM_append,XM_outfiles,$$(_XME_phpc_highlighted_files))
$$(_XME_phpc_highlighted_files): %$(2) : % \
$$(XM_makefiles) $$(XME_phpc_makefiles)
@$(XM_silent) || echo 'file: \
$(XMAKE_EXTENSIONS_DIR)/phpc.mkh'
@$(XM_silent) || echo 'rule: XME_phpc_highlight_files'
@$(XM_silent) || echo 'target: $$@'
@$$(call XME_phpc_highlight_files_command,$$<,$$@)
endef
define XME_phpc_highlight_file
$(call XM_externalTargetsHandler,$(1))
$(call XM_append,XM_outfiles,$(2))
$(2): $(1) $$(XM_makefiles) $$(XME_phpc_makefiles)
@$(XM_silent) || echo 'file: \
$(XMAKE_EXTENSIONS_DIR)/phpc.mkh'
@$(XM_silent) || echo 'rule: XME_phpc_highlight_file'
@$(XM_silent) || echo 'target: $$@'
@$$(call XME_phpc_highlight_files_command,$$<,$$@)
endef