PHP Pre-Processing with XMake: XMake Internals |
>> << C Language XMExtension makefile: c.mkh |
# This file is:
# $(XMAKE_EXTENSIONS_DIR)/c.$(XMAKE_MAKEFILE_SUFFIX_HEADER)
### PRIVATE VARIABLES ##################################
### PUBLIC VARIABLES & MACROS
# ##################################
# Command for generating output files from source files
# XMake.conf set the environmental variable defining the
# command
XME_c_cmd:=$(XMAKE_XME_C)
# Command to generate a list of dependencies from a
# source file (including the source file)
# $(1) - source file
# remove the leading 'outputFile.o :' since this is added
# automatically in XME_patternRules
define XME_c_dependCmd
{ $(XME_c_cmd) -M $(1)|sed -n 's%^\(.*:\)\?\(.*\)%\2% \
p;'; } || { echo '*** FAILURE: XME_c_dependCmd' >&2; exit \
1; }
endef
# XME_c_dependencies
# Called from DEPENDENCY MAKEFILES rule
# $(1) - source file
# $(2) - additional prerequisites
# Generates a list of prerequisites of ALL output files
# of this type
# Additional prerequisites can be added using
# XME_explicitRule
define XME_c_dependencies
$(call XME_c_dependCmd,$(1)) $(2)
endef
# XME_c_outfileMap
# $(1) - source file names
# returns the names of the output files for valid source
# file names in $(1);
define XME_c_outfileMap
$(patsubst %.c,%.o,$(filter %.c,$(1)))
endef
# XME_c_outfileMacro
# Called from OUTPUT FILE rule
# also used by XME_patternRules to pass custom options to
# the command
# $(1) - source file
# $(2) - options to XME_c_cmd
# $(3) - output file; optional: defaults to $(call
# XME_c_outfileMap,$(1))
define XME_c_outfileMacro
outfile="$(call XME_outfile,c,$(1),$(3))"; \
$(XME_c_cmd) $(2) -o "$$outfile" $(1) \
|| { echo "XME_c_outfileMacro: failed compiling $(1)" \
>&2; exit 1 ; }
endef
>> << Copyright (c) 2003, Gregory Keranen. All rights reserved. |