
    擖g                       S SK r S SKrS SKrS SKrS SKrS SKrS SKJr  S SKrSSSSSSSSS	S
SSSSS.r\R                  R                  5       rSq/ q/ q/ qSqS rS rSrSrSrSrSrSrSrS\-   S-   \-   S-   \-   S-   \-   S-   \-   S-   rS rS! rS"rS#rS$rS%r S&r!S'S(S(S(S'S'S).r"S* r#S+ r$S, r%S- r&S. r'S/ r(S0 r)S1 r*Sq+S2 r,S:S3 jr-S4 r.0 r/0 r0 " S5 S65      r1S7 r2S8 r3S9 r4g);    N)GetEnvironFallback lib.az $(obj).$(TOOLSET)/$(TARGET)/geniz
$(obj)/gen$(builddir)%(INPUT_ROOT)s%(INPUT_DIRNAME)sz$(abspath $<)z$(suffix $<)z$(notdir $<)$(BUILDTYPE))EXECUTABLE_PREFIXEXECUTABLE_SUFFIXSTATIC_LIB_PREFIXSHARED_LIB_PREFIXSTATIC_LIB_SUFFIXINTERMEDIATE_DIRSHARED_INTERMEDIATE_DIRPRODUCT_DIRRULE_INPUT_ROOTRULE_INPUT_DIRNAMERULE_INPUT_PATHRULE_INPUT_EXTRULE_INPUT_NAMECONFIGURATION_NAMEFc                    [         R                  R                  U5      nUS:X  a  U R                  SS5        U R                  SS5        U R                  S[        S   5        U R                  S[        S   5        SS	KJs  Jn  [        US
/ 5      q	[        US/ 5      q
[        US/ 5      q[        R                  SSS.5        g	UnUS:X  a  SnU R                  SU5        US:X  a  U R                  SS5        OBUS:X  a*  U R                  SS5        [        R                  SS05        OU R                  SS5        U R                  SS5        U R                  SS5        g	)zDCalculate additional variables for use in the build (called by gyp).macOSSHARED_LIB_SUFFIXz.dylibSHARED_LIB_DIRr   LIB_DIRr   N+generator_additional_non_configuration_keys"generator_additional_path_sections!generator_extra_sources_for_rulesobjcobjcxx)z.mz.mmandroidlinuxaixr   zos.xz.plipli.soz$(builddir)/lib.$(TOOLSET)z$(obj).$(TOOLSET))gypcommon	GetFlavor
setdefaultgenerator_default_variablesgyp.generator.xcode	generatorxcodegetattrr   r    r!   COMPILABLE_EXTENSIONSupdate)default_variablesparamsflavorxcode_generatoroperating_systems        4/usr/lib/python3/dist-packages/gyp/generator/make.pyCalculateVariablesr<   A   si   ZZ!!&)F$$T51$$%8(C$$9-H	
 	$$2=A	
 	65 7>JB7
3 .5A2.
* -4@"-
) 	$$F8%DE!Y&$$T+;<U?(()<dCu_(()<dC!((&%9(()<eD$$%57ST$$Y0CD    c                 j   U R                  S0 5      nUR                  SS5      nU(       a  SqU S   R                  =(       d    U S   R                  nUR                  SS5      n[        R
                  R                  [        R
                  R                  X4S5      5      nU S   R                  US	.qg)
zMCalculate the generator specific info that gets fed to input (called by
gyp).generator_flagsandroid_ndk_versionNToptions
output_diroutgypfiles)toplevelqualified_out_dir)	get#generator_wants_sorted_dependenciesgenerator_outputtoplevel_dirospathnormpathjoingenerator_filelist_paths)r7   r?   r@   rB   builddir_namerF   s         r;   CalculateGeneratorInputInforQ   o   s     jj!2B7O)--.CTJ.2+	"33Uvi7H7U7UJ#''e<M((
Z
; 9%22. r=   ?a	  quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)

quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)

# Due to circular dependencies between libraries :(, we wrap the
# special "figure out circular dependencies" flags around the entire
# input list during linking.
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group

# Note: this does not handle spaces in paths
define xargs
  $(1) $(word 1,$(2))
$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2))))
endef

define write-to-file
  @: >$(1)
$(call xargs,@printf "%s\n" >>$(1),$(2))
endef

OBJ_FILE_LIST := ar-file-list

define create_archive
        rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
        $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
endef

define create_thin_archive
        rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
        $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
endef

# We support two kinds of shared objects (.so):
# 1) shared_library, which is just bundling together many dependent libraries
# into a link line.
# 2) loadable_module, which is generating a module intended for dlopen().
#
# They differ only slightly:
# In the former case, we want to package all dependent code into the .so.
# In the latter case, we want to package just the API exposed by the
# outermost module.
# This means shared_library uses --whole-archive, while loadable_module doesn't.
# (Note that --whole-archive is incompatible with the --start-group used in
# normal linking.)

# Other shared-object link notes:
# - Set SONAME to the library filename so our binaries don't reference
# the local, absolute paths used on the link command-line.
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
ah  quiet_cmd_alink = LIBTOOL-STATIC $@
cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)

quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)

quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
a  quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)

quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)

# Note: this does not handle spaces in paths
define xargs
  $(1) $(word 1,$(2))
$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2))))
endef

define write-to-file
  @: >$(1)
$(call xargs,@printf "%s\n" >>$(1),$(2))
endef

OBJ_FILE_LIST := ar-file-list

define create_archive
        rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
        $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
endef

define create_thin_archive
        rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
        $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
        $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
endef

# Due to circular dependencies between libraries :(, we wrap the
# special "figure out circular dependencies" flags around the entire
# input list during linking.
quiet_cmd_link = LINK($(TOOLSET)) $@
quiet_cmd_link_host = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)

# Other shared-object link notes:
# - Set SONAME to the library filename so our binaries don't reference
# the local, absolute paths used on the link command-line.
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
a  quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^)

quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^)

quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
a  quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)

quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)

quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
a  quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)

quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)

quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
ad	  # We borrow heavily from the kernel build setup, though we are simpler since
# we don't have Kconfig tweaking settings on us.

# The implicit make rules have it looking for RCS files, among other things.
# We instead explicitly write all the rules we care about.
# It's even quicker (saves ~200ms) to pass -r on the command line.
MAKEFLAGS=-r

# The source directory tree.
srcdir := %(srcdir)s
abs_srcdir := $(abspath $(srcdir))

# The name of the builddir.
builddir_name ?= %(builddir)s

# The V=1 flag on command line makes us verbosely print command lines.
ifdef V
  quiet=
else
  quiet=quiet_
endif

# Specify BUILDTYPE=Release on the command line for a release build.
BUILDTYPE ?= %(default_configuration)s

# Directory all our build output goes into.
# Note that this must be two directories beneath src/ for unit tests to pass,
# as they reach into the src/ directory for data with relative paths.
builddir ?= $(builddir_name)/$(BUILDTYPE)
abs_builddir := $(abspath $(builddir))
depsdir := $(builddir)/.deps

# Object output directory.
obj := $(builddir)/obj
abs_obj := $(abspath $(obj))

# We build up a list of every single one of the targets so we can slurp in the
# generated dependency rule Makefiles in one pass.
all_deps :=

%(make_global_settings)s

CC.target ?= %(CC.target)s
CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS)
CXX.target ?= %(CXX.target)s
CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS)
LINK.target ?= %(LINK.target)s
LDFLAGS.target ?= $(LDFLAGS)
AR.target ?= $(AR)
PLI.target ?= %(PLI.target)s

# C++ apps need to be linked with g++.
LINK ?= $(CXX.target)

# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
# to replicate this environment fallback in make as well.
CC.host ?= %(CC.host)s
CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host)
CXX.host ?= %(CXX.host)s
CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host)
LINK.host ?= %(LINK.host)s
LDFLAGS.host ?= $(LDFLAGS_host)
AR.host ?= %(AR.host)s
PLI.host ?= %(PLI.host)s

# Define a dir function that can handle spaces.
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
# "leading spaces cannot appear in the text of the first argument as written.
# These characters can be put into the argument value by variable substitution."
empty :=
space := $(empty) $(empty)

# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
replace_spaces = $(subst $(space),z ,$1)
unreplace_spaces = $(subst aC  ,$(space),$1)
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))

# Flags to make gcc output dependency info.  Note that you need to be
# careful here to use the flags that ccache and distcc can understand.
# We write to a dep file on the side first and then rename at the end
# so we can't end up with a broken dep file.
depfile = $(depsdir)/$(call replace_spaces,$@).d
DEPFLAGS = %(makedep_args)s -MF $(depfile).raw

# We have to fixup the deps output in a few ways.
# (1) the file output should mention the proper .o file.
# ccache or distcc lose the path to the target, so we convert a rule of
# the form:
#   foobar.o: DEP1 DEP2
# into
#   path/to/foobar.o: DEP1 DEP2
# (2) we want missing files not to cause us to fail to build.
# We want to rewrite
#   foobar.o: DEP1 DEP2 \
#               DEP3
# to
#   DEP1:
#   DEP2:
#   DEP3:
# so if the files are missing, they're just considered phony rules.
# We have to do some pretty insane escaping to get those backslashes
# and dollar signs past make, the shell, and sed at the same time.
# Doesn't work with spaces, but that's fine: .d files have spaces in
# their names replaced with other characters.
define fixup_dep
# The depfile may not exist if the input file didn't have any #includes.
touch $(depfile).raw
# Fixup path as in (1).
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
# Add extra rules as in (2).
# We remove slashes and replace spaces with new lines;
# remove blank lines;
# delete the first line and append a colon to the remaining lines.
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
  grep -v '^$$'                             |\
  sed -e 1d -e 's|$$|:|'                     \
    >> $(depfile)
rm $(depfile).raw
endef

# Command definitions:
# - cmd_foo is the actual command to run;
# - quiet_cmd_foo is the brief-output summary of the command.

quiet_cmd_cc = CC($(TOOLSET)) $@
cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c

quiet_cmd_cxx = CXX($(TOOLSET)) $@
cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c
%(extra_commands)s
quiet_cmd_touch = TOUCH $@
cmd_touch = touch $@

quiet_cmd_copy = COPY $@
# send stderr to /dev/null to ignore messages when linking directories.
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@")

quiet_cmd_symlink = SYMLINK $@
cmd_symlink = ln -sf "$<" "$@"

%(link_commands)s

# Define an escape_quotes function to escape single quotes.
# This allows us to handle quotes properly as long as we always use
# use single quotes and escape_quotes.
escape_quotes = $(subst ','\'',$(1))
# This comment is here just to include a ' to unconfuse syntax highlighting.
# Define an escape_vars function to escape '$' variable syntax.
# This allows us to read/write command lines with shell variables (e.g.
# $LD_LIBRARY_PATH), without triggering make substitution.
escape_vars = $(subst $$,$$$$,$(1))
# Helper that expands to a shell command to echo a string exactly as it is in
# make. This uses printf instead of echo because printf's behaviour with respect
# to escape sequences is more portable than echo's across different shells
# (e.g., dash, bash).
exact_echo = printf '%%s\n' '$(call escape_quotes,$(1))'

# Helper to compare the command we're about to run against the command
# we logged the last time we ran the command.  Produces an empty
# string (false) when the commands match.
# Tricky point: Make has no string-equality test function.
# The kernel uses the following, but it seems like it would have false
# positives, where one string reordered its arguments.
#   arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
#                       $(filter-out $(cmd_$@), $(cmd_$(1))))
# We instead substitute each for the empty string into the other, and
# say they're equal if both substitutions produce the empty string.
# .d files contain aa   instead of spaces, take that into account.
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
                       $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))

# Helper that is non-empty when a prerequisite changes.
# Normally make does this implicitly, but we force rules to always run
# so we can check their command lines.
#   $? -- new prerequisites
#   $| -- order-only dependencies
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))

# Helper that executes all postbuilds until one fails.
define do_postbuilds
  @E=0;\
  for p in $(POSTBUILDS); do\
    eval $$p;\
    E=$$?;\
    if [ $$E -ne 0 ]; then\
      break;\
    fi;\
  done;\
  if [ $$E -ne 0 ]; then\
    rm -rf "$@";\
    exit $$E;\
  fi
endef

# do_cmd: run a command via the above cmd_foo names, if necessary.
# Should always run for a given target to handle command-line changes.
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
# Third argument, if non-zero, makes it do POSTBUILDS processing.
# Note: We intentionally do NOT call dirx for depfile, since it contains z* for
# spaces already and dirx strips the a   characters.
define do_cmd
$(if $(or $(command_changed),$(prereq_changed)),
  @$(call exact_echo,  $($(quiet)cmd_$(1)))
  @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
  $(if $(findstring flock,$(word %(flock_index)d,$(cmd_$1))),
    @$(cmd_$(1))
    @echo "  $(quiet_cmd_$(1)): Finished",
    @$(cmd_$(1))
  )
  @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
  @$(if $(2),$(fixup_dep))
  $(if $(and $(3), $(POSTBUILDS)),
    $(call do_postbuilds)
  )
)
endef

# Declare the "%(default_target)s" target first so it is the default,
# even though we don't have the deps yet.
.PHONY: %(default_target)s
%(default_target)s:

# make looks for ways to re-generate included makefiles, but in our case, we
# don't have a direct way. Explicitly telling make that it has nothing to do
# for them makes it go faster.
%%.d: ;

# Use FORCE_DO_CMD to force a target to run.  Should be coupled with
# do_cmd.
.PHONY: FORCE_DO_CMD
FORCE_DO_CMD:

a  
quiet_cmd_objc = CXX($(TOOLSET)) $@
cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<

quiet_cmd_objcxx = CXX($(TOOLSET)) $@
cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<

# Commands for precompiled header files.
quiet_cmd_pch_c = CXX($(TOOLSET)) $@
cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
quiet_cmd_pch_cc = CXX($(TOOLSET)) $@
cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
quiet_cmd_pch_m = CXX($(TOOLSET)) $@
cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
quiet_cmd_pch_mm = CXX($(TOOLSET)) $@
cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<

# gyp-mac-tool is written next to the root Makefile by gyp.
# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
# already.
quiet_cmd_mac_tool = MACTOOL $(4) $<
cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@"

quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)

quiet_cmd_infoplist = INFOPLIST $@
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
c                 0   [        [        R                  5       [        R                  S9nU R                  S5        U H2  nU R                  SU-  5        U R                  S[        U   -  5        M4     U R                  S5        U H2  nU R                  SU-  5        U R                  S[        U   -  5        M4     U R                  S5        U H2  nU R                  SU-  5        U R                  S[        U   -  5        M4     U R                  S5        g )	N)key1# Suffix rules, putting all outputs into $(obj).
z4$(obj).$(TOOLSET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD
z	@$(call do_cmd,%s,1)
z,
# Try building from generated source, too.
z<$(obj).$(TOOLSET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD

z1$(obj).$(TOOLSET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
)sortedr4   keysstrlowerwrite)writer
extensionsexts      r;   WriteRootHeaderSuffixRulesr_   e  s    -224#))DJ
LLEFLsRS/2G2LLM  LLABKcQ	
 	/2G2LLM	 
 LLICOP/2G2LLM  LLr=   a4  
PLIFLAGS.target ?= -qlp=64 -qlimits=extname=31  $(PLIFLAGS)
PLIFLAGS.host ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS)

quiet_cmd_pli = PLI($(TOOLSET)) $@
cmd_pli = $(PLI.$(TOOLSET)) $(GYP_PLIFLAGS) $(PLIFLAGS.$(TOOLSET)) -c $< &&           if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi
rU   z+# Try building from generated source, too.
a  # "all" is a concatenation of the "all" targets from all the included
# sub-makefiles. This is just here to clarify.
all:

# Add in dependency-tracking rules.  $(all_deps) is the list of every single
# target in our tree. Only consider the ones with .d (dependency) info:
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
ifneq ($(d_files),)
  include $(d_files)
endif
z/# This file is generated by gyp; do not edit.

cccxx)z.c.cc.cpp.cxxz.sz.Sc                 D   ^  [        S U 4S j[         5        5       5      $ )z:Return true if the file is compilable (should be in OBJS).c              3   $   #    U  H  ov   M     g 7fN ).0ress     r;   	<genexpr>Compilable.<locals>.<genexpr>  s     TSssSs   c              3   F   >#    U  H  nTR                  U5      v   M     g 7frg   endswith)ri   efilenames     r;   rk   rl     s!     S=Rx0033=Rs   !)anyr4   rq   s   `r;   
Compilablert     s    TS=RSTTTr=   c                 $    U R                  S5      $ )zAReturn true if the file is linkable (should be on the link line)..orn   rs   s    r;   Linkablerw     s    T""r=   c                 L    [         R                  R                  U 5      S   S-   $ )z1Translate a compilable filename to its .o target.r   rv   )rK   rL   splitextrs   s    r;   Targetrz     s!    77H%a(4//r=   c                 2    SU R                  SS5      -   S-   $ )zQuotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
'z'\''replacess    r;   EscapeShellArgumentr     s    
 3((3..r=   c                 &    U R                  SS5      $ )zmMake has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally.$z$$r}   r   s    r;   EscapeMakeVariableExpansionr     s     99S$r=   c                 R    [        U 5      n [        U 5      n U R                  SS5      $ )zBEscapes a CPP define so that it will reach the compiler unaltered.#z\#)r   r   r~   r   s    r;   EscapeCppDefiner     s)    AA#A&A 99S%  r=   c                 B    SU ;   a  SU R                  SS5      -   S-   n U $ )zNTODO: Should this ideally be replaced with one or more of the above
functions?"z\"r}   strings    r;   QuoteIfNecessaryr     s*     f}v~~c511C7Mr=   c                 2    [         R                  " SSU 5      $ )zGConvert a string to a value that is acceptable as a make variable name.z[^a-zA-Z0-9_]_resubr   s    r;   StringToMakefileVariabler     s    66/3//r=   c                 p    SU ;   a  U $ [         R                  R                  U 5      (       a  U $ [        U -   $ )z,Convert a path to its source directory form.$()rK   rL   isabssrcdir_prefixrL   s    r;   	Sourceifyr     s1    t|	ww}}T4r=   c                 &    U R                  SU5      $ )N r}   )r   quotes     r;   QuoteSpacesr     s    99S%  r=   c                 *    [        [        U 5      5      $ )z=Convert a path to its source directory form and quote spaces.)r   r   r   s    r;   SourceifyAndQuoteSpacesr     s    y''r=   c                      \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rSS\4S jr S'S jr      S(S jrS rS)S jrS*S jrS r S  r!S! r"S" r#S# r$S$ r%S% r&S&r'g)+MakefileWriteri  zMakefileWriter packages up the writing of one target-specific foobar.mk.

Its only real entry point is Write(), and is mostly used for namespacing.
c           	      n   Xl         X l        0 U l        0 U l        0 U l        [
         H  nU R                  R                  USU< S[
        U   < S305        U R                  R                  USU< S[
        U   < S305        U R                  R                  USU< S[
        U   < S305        M     g )Nz,$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%z FORCE_DO_CMD
	@$(call do_cmd,z,1)
z4$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%z)$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%)r?   r8   suffix_rules_srcdirsuffix_rules_objdir1suffix_rules_objdir2r4   r5   )selfr?   r8   r^   s       r;   __init__MakefileWriter.__init__  s    .#% $&!$&! )C$$++
  5c :	<
 %%,,
  5c :	<
 %%,,
  5c :	<
5 )r=   c                 
  ^  [         R                  R                  U5        [        US5      T l        T R                  R                  [        5        UT l        UT l        US   T l	        US   T l
        US   T l        [         R                  R                  T R                  U5      T l        T R                  S:X  a%  [         R                  R!                  U5      T l        OST l        T R%                  U5      u  px/ n	/ n
/ n/ n/ nT R                  (       a-  T R'                  U5      T l        T R+                  U5      T l        OT R/                  U5      =T l        T l        [1        UR3                  SS5      5      T l        S	T l        T R4                  (       d  T R                  T R6                  ;   a?  [8        R                  R;                  T R(                  5      T l        T R?                  5       nOT R(                  T l        T R(                  nT RA                  S
T R                  -   5        T RA                  ST R                  -   5        SU;   a  T RC                  US   U
U	UU5        SU;   a  T RE                  US   U
U	UU5        SU;   a  T RG                  US   X5        T R                  (       a7  UR3                  S/ 5      U-   nT RI                  X5        T RK                  U5        UR3                  S/ 5      U
-   nU(       Ga  T RM                  UUUU	UU[         R                  RO                  T R"                  U 4S jT RP                  5      5        U Vs/ s H  n[S        U5      (       d  M  UPM     nnU(       GaD  T RA                  [T        5        U Vs1 s H%  n[8        R                  RW                  U5      S   iM'     nnU H3  nUT RX                  ;   d  M  T RA                  T RX                  U   5        M5     T RA                  [Z        5        U H3  nUT R\                  ;   d  M  T RA                  T R\                  U   5        M5     U H3  nUT R^                  ;   d  M  T RA                  T R^                  U   5        M5     T RA                  S5        T R                  (       a  URa                  T R,                  5        T Rc                  UUUX-   UU	U5        U[d        U'   T R                  S;   a  T R,                  [f        U'   T Rh                  R3                  SS5      (       a  T Rk                  T R                  UU5        T R                  Rm                  5         gs  snf s  snf )al  The main entry point: writes a .mk file for a single target.

Arguments:
  qualified_target: target we're generating
  base_path: path relative to source root we're building in, used to resolve
             target-relative paths
  output_filename: output .mk file name to write
  spec, configs: gyp info
  part_of_all: flag indicating this target is part of 'all'
wtarget_nametypetoolsetr   Nstandalone_static_libraryr   )
executableloadable_moduleshared_libraryzTOOLSET := z
TARGET := actionsrulescopiesmac_bundle_resourcessourcesc                 8   > [        TR                  U 5      5      $ rg   r   
Absolutifypr   s    r;   <lambda>&MakefileWriter.Write.<locals>.<lambda>  s    i(:;r=      z!# End of this set of suffix rules)static_libraryr   r@   )7r+   r,   EnsureDirExistsopenfpr[   headerqualified_targetrL   targetr   r   xcode_emulationIsMacBundler8   is_mac_bundleXcodeSettingsxcode_settingsComputeDepsComputeMacBundleOutputoutputComputeMacBundleBinaryOutputoutput_binaryComputeOutputboolrG   is_standalone_static_library_INSTALLABLE_TARGETSrK   basenamealias_InstallableTargetInstallPathWriteLnWriteActions
WriteRulesWriteCopiesWriteMacBundleResourcesWriteMacInfoPlistWriteSourcesMacPrefixHeaderPchifyrt   #SHARED_HEADER_SUFFIX_RULES_COMMENT1ry   r   #SHARED_HEADER_SUFFIX_RULES_COMMENT2r   r   appendWriteTargettarget_outputstarget_link_depsr?   WriteAndroidNdkModuleRuleclose)r   r   	base_pathoutput_filenamespecconfigspart_of_alldeps	link_depsextra_outputsextra_sourcesextra_link_depsextra_mac_bundle_resourcesmac_bundle_depsinstall_pathall_mac_bundle_resourcesall_sourcesxr   r   r]   r^   s   `                     r;   WriteMakefileWriter.Write0  s    	

""?3,f 0	=)L	I 00<<T[[$O;;%"%"5"5"C"CD"ID"&D**40
 %'"55d;DK!%!B!B4!HD/3/A/A$/GGDK$,,0HH0!4-
) %X!,,		T=V=V0V))$++6DJ==?LDJ;;L]T\\12\DKK/0 Y* d?OOW* tT(^]H /47QQ % (()AS""?3 hhy"-=##33'';KK #.?+QAq+G?@A>EFgbgg..q1!4g
F%Cd666T%=%=c%BC & @A%Cd777T%>%>s%CD & &Cd777T%>%>s%CD & @A %%#**4+=+=>'	
 ,8'( 99<<151C1C-. ##$94@@**4;;YOU @ Gs   U"0U",U'c                 0   [         R                  R                  U5        [        US5      U l        U R                  R                  [        5        U R                  S[        R                  R                  [        R                  R                  U5      U5      -  5        U R                  S5        U R                  S5        U(       a  SU-   nU R                  SR                  USR                  U5      5      5        U R                  R                  5         g)	a  Write a "sub-project" Makefile.

This is a small, wrapper Makefile that calls the top-level Makefile to build
the targets from a single gyp file (i.e. a sub-project).

Arguments:
  output_filename: sub-project Makefile name to write
  makefile_path: path to the top-level Makefile
  targets: list of "all" targets for this sub-project
  build_dir: build output directory, relative to the sub-project
r   zexport builddir_name ?= %sz.PHONY: allzall:z -C z	$(MAKE){} {}r   N)r+   r,   r   r   r   r[   r   r   rK   rL   rN   dirnameformatr   )r   r   makefile_pathtargets	build_dirs        r;   WriteSubMakeMakefileWriter.WriteSubMake  s     	

""?3,f 	(ggll277???;YGH	
 	]#V"]2M%,,]CHHW<MNOr=   c                    U R                  5       nU GH  n[        SR                  U R                  US   5      5      nU R	                  SUS   -  5        US   n	US   n
[        5       nU
 H?  n[        R                  R                  U5      S   nU(       d  M.  UR                  U5        MA     [        UR                  SS5      5      (       a  X*-  n[        UR                  S	S5      5      (       a  XJ-  nUS
   nU R                  S:X  a/  U Vs/ s H"  n[        R                  R                  X5      PM$     nn[        R                   R#                  U5      nSU;   a$  U R	                  SR                  XS   5      5        OU R	                  SU SU S35        [%        U5      S:  a  SSR'                  U5      -  S-   U-   nS[)        U R                  =(       d    S5      -  nUR+                  SU R,                  5      nUR+                  SU R,                  5      nU R                  S;   a  U R	                  SU< SU< U< 35        OU R	                  SU< SU< U< 35        U R	                  5         U
 Vs/ s H  nU R/                  U5      PM     n
nU R	                  S[1        U
S   5      -  5        U R	                  S[1        U
S   5      -  5        U R3                  U
S   U R                  5       5        U	 H  nSU;  a  M   SU-  5       e   U
 H  nSU;  a  M   SU-  5       e   U
 Vs/ s H#  n[        R                  R                  UU5      PM%     n
nU	 Vs/ s H#  n[        R                  R                  UU5      PM%     n	nU R5                  U
U	 Vs/ s H  n[)        U R/                  U5      5      PM     snUUS9  S U-  nU R	                  S!R                  USR'                  U
5      5      5        UR7                  S"U-  5        U R	                  5         GM     U R	                  5         g#s  snf s  snf s  snf s  snf s  snf )$a  Write Makefile code for any 'actions' from the gyp input.

extra_sources: a list that will be filled in with newly generated source
               files, if any
extra_outputs: a list that will be filled in with any outputs of these
               actions (used to make other pieces dependent on these
               actions)
part_of_all: flag indicating this target is part of 'all'
{}_{}action_namez### Rules for action "%s":inputsoutputsr   process_outputs_as_sourcesF'process_outputs_as_mac_bundle_resourcesactionr   messagezquiet_cmd_{} = ACTION {} $@
quiet_cmd_z
 = ACTION z $@zmkdir -p %sr   z; cd %s; .	$(TARGET)>   r&   r'   cmd_zR = LIBPATH=$(builddir)/lib.host:$(builddir)/lib.target:$$LIBPATH; export LIBPATH; zj = LD_LIBRARY_PATH=$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; %s: obj := $(abs_obj)%s: builddir := $(abs_builddir)z3Spaces in action input filenames not supported (%s)z4Spaces in action output filenames not supported (%s))r   commandzaction_%s_outputsz{} := {}$(%s)N)GetSortedXcodeEnvr   r   r   r   setrK   rL   splitaddintrG   r8   r+   r   ExpandEnvVarsr,   EncodePOSIXShellListlenrN   r   r~   r   r   r   WriteSortedXcodeEnv
WriteDoCmdr   )r   r   r   r   r   r   envr  namer  r  dirsrC   diraction_commandsr  	cd_actionoinputr   ioutputs_variables                         r;   r   MakefileWriter.WriteActions  s
   " $$&F+t44f]6KLD LL5}8MMNH%FY'G 5DggmmC(+3HHSM  6:::EBCC(6::GOPP*5* %X.O{{e# $3##2 ''55gC#2   # jj55oFGF"188i?PQ z$z$sCD4y1}'#((4.84?'I!Idii.>3$??I
 ook4;;?G!))+t{{CI {{n, #Iw8  #Iw8 LLN3:;7atq)7G; LL0;wqz3JJKLL:[QR=TTU$$WQZ1G1G1IJ%' IEQ'   "&( JVS( " KRR'Qs**88C@'GRIOPAc))773?FPOO8>?14??1-.?'	    3T9LL**+;SXXg=NOP  +;!;<LLNO R 	e#V <. SP @s   )P7;P<1*Q!*Q$Qc                 	   U R                  5       nU GH  n[        SR                  U R                  US   5      5      nSn	U R	                  SU-  5        / n
UR                  S/ 5       GH  n[        5       n[        R                  R                  U5      u  p[        R                  R                  U5      u  nnUS    Vs/ s H  nU R                  UX5      PM     nnU H<  n[        R                  R                  U5      nU(       d  M+  UR                  U5        M>     [        UR                  SS5      5      (       a  UU-  n[        UR                  S	S5      5      (       a  UU-  nU/UR                  S
/ 5      -    Vs/ s H  n[        U R!                  U5      5      PM     nnSX4-  /nUS:X  a  US/-  nU Vs/ s H#  n["        R$                  R'                  UU5      PM%     nnU Vs/ s H#  n["        R$                  R'                  UU5      PM%     nnU Vs/ s H  nU R!                  U5      PM     nnU
U-  n
U R	                  SUS   -  5        U R	                  SUS   -  5        U R)                  UUUSX4-  S9  [*        R,                  " S5      nU H+  n[*        R.                  " USU5      nSU;  a  M#   SU-  5       e   U R	                  SSR1                  U5      -  5        US    Vs/ s H  nU R                  UX5      PM     nnSn[3        U5      S:  a  SSR1                  U5      -  nS[        U R                  =(       d    S5      -  nU R4                  S:X  a0  U Vs/ s H#  n["        R$                  R'                  UU5      PM%     nn["        R6                  R9                  U5      nUR;                  SU R<                  5      nUR;                  SU R<                  5      nUR;                  SU R<                  5      nU R	                  SUUU	UUS.-  5        U R	                  SXS .-  5        U R	                  5         U	S!-  n	GM     S"U-  nU R?                  U
U5        URA                  S#U-  5        U R	                  S$U-  5        U R	                  5         GM     U R	                  S%5        U R	                  S5        g&s  snf s  snf s  snf s  snf s  snf s  snf s  snf )'aj  Write Makefile code for any 'rules' from the gyp input.

extra_sources: a list that will be filled in with newly generated source
               files, if any
extra_outputs: a list that will be filled in with any outputs of these
               rules (used to make other pieces dependent on these rules)
part_of_all: flag indicating this target is part of 'all'
r  	rule_namer   z### Generated for rule %s:rule_sourcesr  r  Fr  r  z$(call do_cmd,%s_%d)resources_gritz@touch --no-create $@r  r  z%s_%d)r  z\$\([^ ]* \$<\)r   r   z/Spaces in rule filenames not yet supported (%s)all_deps += %sr  zmkdir -p %s; r  r  r   r  zcmd_%(name)s_%(count)d = LD_LIBRARY_PATH=$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; %(cd_action)s%(mkdirs)s%(action)s)r  r"  countmkdirsr  z9quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@)r-  r  r   zrule_%s_outputsr  z$### Finished generating for rule: %sz%### Finished generating for all rulesN)!r  r   r   r   r   rG   r  rK   rL   r  ry   ExpandInputRootr   r  r  r   r   r+   r   r  WriteMakeRuler   compiler   rN   r  r8   r,   r  r~   r   	WriteListr   ) r   r   r   r   r   r   r  ruler  r-  all_outputsrule_sourcer  rule_source_dirnamerule_source_basenamerule_source_rootrule_source_extrC   r  r   r%  r  r   r#  variables_with_spacesr   acr  r.  r"  r  r&  s                                    r;   r   MakefileWriter.WriteRulesb  s     $$&D+t44d;6GHD ELL5<=K#xx;u>@ggmmK>X;$68gg6F6F(73!?  $I. ((.>T.  
 #C''//#.Cs # txx <eDEE!W,Mtxx I5QRR.'9. *]TXXh-CCC dooa01C   2TMAB++  788G OVVg3..<<QDgVMSTV#--;;AsCVT7>?w!4??1-w?w& 4wqzAB>KL""VWg6M #  )+

3E(F%%FVV$92vFFf, IFR, &
 -0AAB #8n, ((-=S,   t9q=,sxx~=F%	$))2Bs(CC	
 ;;%' (.'-G ++99'3G'-   88@T[[A%--k4;;G	T[[A 8
 #)%.!&"( $	
 O %45 
W  <Z  147NN;(89  +;!;<LL?$FGLLNw x 	<=R[  WT?,s*   S$S *S0*S S#7S(/*S-c           
         U R                  S5        [        U R                  S-   5      n/ nU H  nUS    H  n[        U R	                  U5      5      n[
        R                  R                  U5      S   n[        U R	                  [
        R                  R                  US   U5      5      5      n	U R                  5       n
[        R                  R                  X5      n	[        R                  R                  Xz5      nU R                  U	/U/SU5        UR                  U	5        M     M     U R                  SR                  USR                  S	 U 5       5      5      5        UR                  S
U-  5        U R                  5         g)a  Write Makefile code for any 'copies' from the gyp input.

extra_outputs: a list that will be filled in with any outputs of this action
               (used to make other pieces dependent on this action)
part_of_all: flag indicating this target is part of 'all'
z### Generated for copy rule._copiesfilesr   destinationcopyz{} = {}r   c              3   8   #    U  H  n[        U5      v   M     g 7frg   r   )ri   r#  s     r;   rk   -MakefileWriter.WriteCopies.<locals>.<genexpr>  s     /P1A   r  N)r   r   r   r   r   rK   rL   r  rN   r  r+   r   r  r  r   r   )r   r   r   r   variabler  rA  rL   rq   r   r  s              r;   r   MakefileWriter.WriteCopies  s@    	34+D,A,AI,MNDW !6777==.q1"OOBGGLLm1Dh$OP ,,.,,::6G**88C4&&+Fv&+ & . 	Xsxx/P/P'PQ	
 	Wx/0r=   c                    U R                  S5        [        R                  R                  [        S   U R
                  U Vs/ s H  n[        U R                  U5      5      PM     sn5       HS  u  pE[        R                  R                  U5      u  pgUS:w  d  M.  U R                  U/U/SSS9  UR                  U5        MU     gs  snf )z0Writes Makefile code for 'mac_bundle_resources'.z&### Generated for mac_bundle_resourcesr   z	.xcassetszmac_tool,,,copy-bundle-resourceTr   N)r   r+   r   GetMacBundleResourcesr/   r   r   r   rK   rL   ry   r  r   )r   	resourcesbundle_depsrr   rj   r   r^   s           r;   r   &MakefileWriter.WriteMacBundleResources  s    =>..DD'64=>IqYtq)*I>
KF
 WW%%f-FAk!Hse%FTX    ""6*
 ?s   $Cc                   ^  [         R                  R                  [        S   T R                  U 4S j5      u  p#pEU(       d  gU(       aT  S[
        R                  R                  U5      -   nT R                  UUS-   S[        S9  T R                  U/U/SS	/5        UnT R                  UT R                  US
95        T R                  U/U/SSS9  UR                  U5        g)z0Write Makefile code for bundle Info.plist files.r   c                 8   > [        TR                  U 5      5      $ rg   r   r   s    r;   r   2MakefileWriter.WriteMacInfoPlist.<locals>.<lambda>0  s    i 23r=   Nz$(obj).$(TOOLSET)/$(TARGET)/z: INFOPLIST_DEFINES-D)quoterz$(call do_cmd,infoplist)z@plutil -convert xml1 $@ $@additional_settingszmac_tool,,,copy-info-plistTrI  )r+   r   GetMacInfoPlistr/   r   rK   rL   r   r2  r   r0  r  r  r  r   )r   rL  
info_plistrC   defines	extra_envintermediate_plists   `      r;   r    MakefileWriter.WriteMacInfoPlist+  s   .1.A.A.Q.Q'63/
+

 !?"''BRBRC " NN"%::&	   #$. 2		 ,J  ''I'F	
 	EJ<!=4 	 	
 	3r=   c           
      	   [        UR                  5       5       GH,  nX   n	U R                  U	R                  S5      SU-  S[        S9  U R
                  S:X  a  U R                  R                  XR                  S5      S9n
U R                  R                  U5      nU R                  R                  U5      nU R                  R                  U5      nU R                  R                  U5      nO3U	R                  S5      n
U	R                  S	5      nU	R                  S
5      nU R                  S5        U R                  U
SU-  5        U R                  S5        U R                  USU-  5        U R                  S5        U R                  USU-  5        U R
                  S:X  aL  U R                  S5        U R                  WSU-  5        U R                  S5        U R                  WSU-  5        U	R                  S5      nU(       a*  U Vs/ s H  n[        U R                  U5      5      PM     nnU R                  USU-  SS9  GM/     [        [!        ["        U5      5      nU Vs/ s H,  nU R%                  U R                  ['        U5      5      5      PM.     nnU R                  US5        U H  nSU;  a  M   SU-  5       e   U R                  S5        U R                  S5        U R                  5         U(       a  U R)                  S/USS S!9  U(       a  U R)                  S/US"S S!9  UR+                  UU5      nU(       aE  U R                  S#5        U H  u  nnnU R                  U S$U 35        M     U R                  S%5        U(       a  UR-                  S5        U R                  S&5        U R                  S'5        U R                  S(UR/                  S)5      -  S*-   5        U R                  S+UR/                  S,5      -  S--   5        U R
                  S:X  aL  U R                  S.UR/                  S/5      -  S0-   5        U R                  S1UR/                  S25      -  S3-   5        U R1                  UR3                  5       5        XS Vs/ s H  n[5        U5      (       d  M  UPM     sn-  nU R                  5         g4s  snf s  snf s  snf )5a  Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.

configs, deps, sources: input from gyp.
extra_outputs: a list of extra outputs this action should be dependent on;
               used to serialize action/rules before compilation
extra_link_deps: a list that will be filled in with any outputs of
                 compilation (to be used in link lines)
part_of_all: flag indicating this target is part of 'all'
rX  zDEFS_%srR  )prefixrS  r   xcode_configuration_platformarchcflagscflags_c	cflags_ccz## Flags passed to all source files.z	CFLAGS_%sz# Flags passed to only C files.zCFLAGS_C_%sz!# Flags passed to only C++ files.zCFLAGS_CC_%sz"# Flags passed to only ObjC files.zCFLAGS_OBJC_%sz$# Flags passed to only ObjC++ files.zCFLAGS_OBJCC_%sinclude_dirszINCS_%sz-I)r]  OBJSr   z-Spaces in object filenames not supported (%s)z?# Add to the list of files we specially track dependencies for.zall_deps += $(OBJS)z$(OBJS)z6Make sure our dependencies are built before any of us.Tcomment
order_onlyz1Make sure our actions/rules run before any of us.z:# Dependencies from obj files to their precompiled headers: z%# End precompiled header dependencieszn# CFLAGS et al overrides must be target-local.
# See "Target-specific Variable Values" in the GNU Make manual.z$(OBJS): TOOLSET := $(TOOLSET)zD$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) %s cz/$(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))zF$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) %s r`   z0$(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))zG$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) %s mzK$(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))zI$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) %s mmzM$(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))N)rW   rX   r2  rG   r   r8   r   	GetCflags
GetCflagsCGetCflagsCCGetCflagsObjCGetCflagsObjCCr   r   r   listfilterrt   	Objectifyrz   r0  GetObjDependenciesr   
GetIncludeWritePchTargetsGetPchBuildCommandsrw   )r   r   r   r   r   r   r   precompiled_header
confignameconfigra  rb  rc  cflags_objccflags_objccincludesr%  
compilablerj  objsobjpchdepssourcegchs                           r;   r   MakefileWriter.WriteSourcesS  s   , !0J(FNN

9%J&&	   {{e#,,66ZZ0N%O 7   ..99*E //;;JG	"11??
K#22AA*MH-!::j1"JJ{3	LL>?NN6;#;<LL:;NN8]Z%?@LL<=NN9nz&AB{{e#AB{,<z,IJCD|->-KLzz.1HCKL8aIdooa&898LNN8Y%;DNII 1L &W56
DNOJqtvay9:JOtV$Cc>X#RUX#XX> P	
 	*+ S	   N	   %77
DILLUV$+ SuBse_- %,LL@A""9-LLC
 LL9:LL +55c:;>++ LL +55d;<?,, {{e# /99#>?2	2  /99$?@3	3 	/CCEF 	MvHV<LFMMu M Ph Ns   $S(3S
S)Sc           	      v   U(       d  gU H  u  p#pESSSSS.U   nSSS	S
S.U   nU R                  U SU SU S3S-   U-   5        U R                  U SU S35        U R                  SU-  5        U R                  S5        SU;  d
   SU-  5       eU R                  SU-  5        U R                  S5        M     g)z,Writes make rules to compile prefix headers.Nz$(CFLAGS_C_$(BUILDTYPE))z$(CFLAGS_CC_$(BUILDTYPE))z4$(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))z6$(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)))rj  r`   rk  rl  GYP_PCH_CFLAGSGYP_PCH_CXXFLAGSGYP_PCH_OBJCFLAGSGYP_PCH_OBJCXXFLAGSri   := r   zA$(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE))  FORCE_DO_CMDz	@$(call do_cmd,pch_%s,1)r   z*Spaces in gch filenames not supported (%s)r,  )r   )r   pch_commandsr  	lang_flaglangr$  extra_flagsvar_names           r;   rw  MakefileWriter.WritePchTargets  s    +7'CD/1KN	
 K &((+	
 H LL%r(4	{!4 8* *,78 LLC55'78LL5<=LLc>U#ORU#UU>LL)C/0LL1 ,8r=   c                    U R                   (       a   eU R                  S:X  a*  U R                  S;   a  U R                  R	                  5       $ US   nSnSnU R                  S:X  a  USS S:X  a  USS nSnS	nOU R                  S
;   a9  USS S:X  a  USS nSnU R                  S:X  a  S	nOUU R                  S:X  a  SnOBSnO?U R                  S:X  a  SU-  nO)U R                  S:w  a  [        SSU R                  SU5        UR                  SU5      nUR                  SU5      nUR                  S5      nU(       a  SU-   nX2-   U-   $ )zReturn the 'output basename' of a gyp spec.

E.g., the loadable module 'foobar' in directory 'baz' will produce
  'libfoobar.so'
r   r   r   r   r   r   r   r   N   r   r   )r   r   r&   r'   r(   r*   nonez%s.stampr   z,ERROR: What output file should be generated?r   r   product_prefixproduct_nameproduct_extensionr  )r   r8   r   r   GetExecutablePathprintrG   )r   r   r   target_prefix
target_extproduct_exts         r;   ComputeOutputBasename$MakefileWriter.ComputeOutputBasename  sf    %%%%;;%DII 2
 %
 &&88::m$
99((bqzU"!MJYY??bqzU"!M{{e#!
%!
"
YY& &(FYY,&>		 !1=A.&1hh23{*J%
22r=   c                 x    U R                   S:H  =(       a%    U R                  S:H  =(       a    U R                  S;   $ )Nr   r   r  )r   r8   r   r   s    r;   _InstallImmediately"MakefileWriter._InstallImmediately<  s;    LLH$ Uu$U		TU	
r=   c                 d   U R                   (       a   e[        R                  R                  SU R                  -   U R                  5      nU R
                  S:X  d  U R                  5       (       a  SnUR                  SU5      n[        R                  R                  X R                  U5      5      $ )zReturn the 'output' (full output path) of a gyp spec.

E.g., the loadable module 'foobar' in directory 'baz' will produce
  '$(obj)/baz/libfoobar.so'
$(obj).r   r   product_dir)	r   rK   rL   rN   r   r   r  rG   r  r   r   rL   s      r;   r   MakefileWriter.ComputeOutputD  s     %%%%ww||I4dii@99$(@(@(B(B Dxxt,ww||D"<"<T"BCCr=   c                     U R                   (       d   e[        S   n[        R                  R	                  X R
                  R                  5       5      $ )zDReturn the 'output' (full output path) to a bundle output directory.r   )r   r/   rK   rL   rN   r   GetWrapperNamer  s      r;   r   %MakefileWriter.ComputeMacBundleOutputR  s=    !!!!*=9ww||D"5"5"D"D"FGGr=   c                     [         S   n[        R                  R                  X R                  R                  5       5      $ )zAReturn the 'output' (full output path) to the binary in a bundle.r   )r/   rK   rL   rN   r   r  r  s      r;   r   +MakefileWriter.ComputeMacBundleBinaryOutputX  s.    *=9ww||D"5"5"G"G"IJJr=   c                    / n/ nSU;   a}  UR                  US    Vs/ s H  n[        U   (       d  M  [        U   PM     sn5        US    H'  nU[        ;   d  M  UR                  [        U   5        M)     UR                  U5        [        R
                  R                  U5      [        R
                  R                  U5      4$ s  snf )zCompute the dependencies of a gyp spec.

Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
dependencies)extendr   r   r   r+   r,   uniquer)r   r   r   r   deps        r;   r   MakefileWriter.ComputeDeps]  s     	T!KK  $N33%c* (N3'3 N+**$$%5c%:; , KK	" 

""4(#***<*<Y*GHHs
   CCc                 2    [         R                  " SSU5      $ )0Return the shared object files based on sidedeckz\.x$r*   r   r   sidedecks     r;   GetSharedObjectFromSidedeck*MakefileWriter.GetSharedObjectFromSidedeckw  s    vvguh//r=   c                 2    [         R                  " SSU5      $ )r  z	\.\d+\.x$r(   r   r  s     r;   "GetUnversionedSidedeckFromSidedeck1MakefileWriter.GetUnversionedSidedeckFromSidedeck{  s    vvlD(33r=   c                 >    U R                  U R                  /USSS9  g )Nz Build our special outputs first.Trf  )r0  r   )r   r   r   s      r;   WriteDependencyOnExtraOutputs,MakefileWriter.WriteDependencyOnExtraOutputs  s*     6	 	 	
r=   c                 p  ^  T R                  S5        U(       a.  T R                  T R                  U5        T R                  UUSSS9  0 nT R                  S:w  Ga  [        UR                  5       5       GH  n	X)   n
T R                  S:X  Ga$  T R                  R                  U	[        S   U 4S jU
R                  S	5      S
9n[        R                  R                  T R                  5      nT R                  R!                  U	[#        [$        R                  R'                  [$        R                  R)                  UT R*                  5      5      5      [#        [$        R                  R'                  [$        R                  R)                  UT R                  5      5      5      5      nU(       a  XU	'   OKU
R                  S/ 5      n[-        S U 5       5      (       a"  UR/                  S5        UR/                  S5        U
R                  S/ 5      nX Vs/ s H  nSU-  PM
     sn-  nT R1                  USU	-  5        T R                  S:X  d  GM  T R1                  T R                  R3                  U	5      SU	-  5        GM     UR                  S5      nU(       aJ  [        R                  R5                  U5      nT R                  S:X  a  T R                  R7                  U5      nT R1                  US5        T R                  S[#        T R                  5      -  5        T R                  S[#        T R                  5      -  5        T R                  S:X  a'  T R                  S[#        T R                  5      -  5        / nT R                  S:X  aF  U(       a  UR/                  S5        UR9                  [        R:                  R=                  U5      5        U(       GaX  T R?                  T R*                  T RA                  5       5        U HQ  n	T R                  [#        T R*                  5      < SU	< S[        R                  RC                  X   5      < 35        MS     URE                  S[        R                  RC                  ST R                  /5      5        [G        U5       H,  u  nnURI                  S5      (       a  M  [K        U5      UU'   M.     T R                  S[#        T R*                  5      -  5        T R                  [#        T R*                  5      < SS R)                  U5      < 35        T RL                  (       a  T R                  T R*                  U5        T R1                  U Vs/ s H  n[#        U5      PM     snS!5        T R                  S"[#        T R*                  5      -  5        T R                  S#;   a,  T R                  S$T R                  RO                  5       -  5        U(       a  T R                  S%5        / nT R                  S&5        T R                  S'[#        T R*                  5      -  5        U(       a2  T RL                  (       a   S(T RP                  -  5       eS)U;  d   S*5       eT R                  S+:X  a  T R                  [#        T R                  5      < S,S R)                  S- U 5       5      < 35        T RR                  S.:X  a0  T R                  S/:X  a   T RU                  T R                  /US0UUS19  GOT RU                  T R                  /US2UUS19  GOT R                  S3:X  a  U H  nS U;  a  M   S4U-  5       e   T R                  S5;  a`  T RV                  (       dO  T R                  S6;   a  T R                  T R                  /US7/S89  GOT RU                  T R                  /US9UUS19  GOT R                  S6;   a  T R                  T R                  /US:/S89  GOT RU                  T R                  /US;UUS19  GOT R                  S<:X  a  T R                  [#        T R                  5      < S,S R)                  S= U 5       5      < 35        T RU                  T R                  /US>UUS19  T R                  S?:X  aM  T R                  [#        T RY                  T R                  5      5      < S@[#        T R                  5      < 35        OT R                  SA:X  aw  U H  nS U;  a  M   SBU-  5       e   T RR                  S.:X  a/  T R                  S/:X  a  T RU                  T R                  /USCUUS19  OoT RU                  T R                  /USDUUS19  OPT R                  S:X  a  T RU                  T R                  /USEUUS19  O![[        SFT R                  T RP                  5        T R*                  (       a  T R*                  T RP                  :w  ag  T R                  T R\                  ;  aM  T R                  T RP                  /T R*                  /SGSSH9  U(       a  T R                  SI/T RP                  /SJSSH9  T R                  T R\                  ;   d  T RV                  (       Ga  T R                  S<:X  a  SKnOT R                  S3:X  a  SLnOS+nT R_                  5       n/ nT R                  S?:w  a  UR/                  T R*                  5        T R                  S:X  a<  S)U;  a6  T RR                  SM:X  a&  UT R*                  :X  d   U SNT R*                   35       eT R                  T RP                  /U/SGSSH9  UT R*                  :w  aV  T RL                  (       a   eT RU                  U/T R*                  /SOSPU-  USQ9  T R                  S?:w  a  UR/                  U5        T R                  S?:X  a  T R                  S<:X  a  T RU                  T RY                  U5      /T RY                  T R*                  5      /SOSPU-  USQ9  T RU                  T Ra                  U5      /U/SRSSU-  USQ9  UR/                  T RY                  U5      5        UR/                  T Ra                  U5      5        T Rb                  T R*                  T RP                  4;  a   T R                  T Rb                  /USTU-  SSH9  T R                  S?:X  aG  T R                  S<:X  a7  T R                  SI/T Ra                  U5      T RY                  U5      /SUU-  SSH9  gVU(       a  T R                  SI/U/SUU-  SSH9  gVgVgVs  snf s  snf )Wa  Write Makefile code to produce the final target of the gyp spec.

spec, configs: input from gyp.
deps, link_deps: dependency lists; see ComputeDeps()
extra_outputs: any extra outputs that our target should depend on
part_of_all: flag indicating this target is part of 'all'
z### Rules for final target.z4Preserve order dependency of special output on deps.Trf  r  r   r   c                 8   > [        TR                  U 5      5      $ rg   r   r   s    r;   r   ,MakefileWriter.WriteTarget.<locals>.<lambda>  s    )DOOA,>"?r=   r^  r_  ldflagsc              3   Z   #    U  H!  oR                  S 5      =(       d    SU;   v   M#     g7f)r*   z.so.Nrn   ri   r  s     r;   rk   -MakefileWriter.WriteTarget.<locals>.<genexpr>  s#     P4C<<.?&C-?4s   )+z-Wl,-rpath=\$$ORIGIN/z-Wl,-rpath-link=\$(builddir)/library_dirsz-L%sz
LDFLAGS_%szLIBTOOLFLAGS_%s	librariesLIBSz*%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))z%s: LIBS := $(LIBS)z4%s: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))z!$(TARGET_POSTBUILDS_$(BUILDTYPE))z: TARGET_POSTBUILDS_r  r   cdr   r  z: POSTBUILDS := r   BUNDLE_DEPSz%s: $(BUNDLE_DEPS))r   r   z+	@$(call do_cmd,mac_package_framework,,,%s)z	@$(call do_postbuilds)z	@true  # No-op, used by testsz	@touch -c %szQPostbuilds for bundles should be done on the bundle, not the binary (target '%s')r  z.Postbuilds do not work with custom product_dirr   z: LD_INPUTS := c              3   8   #    U  H  n[        U5      v   M     g 7frg   rC  r  s     r;   rk   r  2       C#[--rE  hostr$   	link_host)
postbuildslinkr   z2Spaces in alink input filenames not supported (%s))r   openbsdnetbsdwin)r%   r$   z!$(call create_thin_archive,$@,$^))r   
alink_thinz$(call create_archive,$@,$^)alinkr   c              3   8   #    U  H  n[        U5      v   M     g 7frg   rC  r  s     r;   rk   r  q  r  rE  solinkr'   ri  r   z3Spaces in module input filenames not supported (%s)solink_module_hostsolink_moduletouchzWARNING: no output forzAdd target alias)rg  phonyallz!Add target alias to "all" target.zshared libraryzstatic libraryr   z != rA  z Copy this to the %s output path.)rg  r   symlinkz"Symlnk this to the %s output path.z!Short alias for building this %s.zAdd %s to "all" target.N)2r   r  r   r0  r   rW   rX   r8   r   
GetLdflagsr/   rG   r+   r,   InvertRelativePathrL   AddImplicitPostbuildsr   rK   rM   rN   r   rr   r   r2  GetLibtoolflagsr  AdjustLibrariesr  r   GetSpecPostbuildCommandsr  GetSortedXcodePostbuildEnvr  insert	enumerate
startswithr   r   GetFrameworkVersionr   r   r  r   r  r  r   r   r  r   )r   r   r   r   r   rL  r   r   target_postbuildsrz  r{  r  gyp_to_buildtarget_postbuildr  library_dirr  r  r%  	postbuildr  link_dep	file_descr   installable_depss   `                        r;   r   MakefileWriter.WriteTarget  s/    	23..t/A/A=QR	   99$W\\^4
 ,;;%'"11<<"3MB?#ZZ(FG	 = G $'::#@#@#KL'+':':'P'P"#GG,,RWW\\,-TU $GG,, "\4;M;M N
($ (8H*5$jjB7GP4PPP  '?@'GH%zz."=lSl{Vk1lSSwz(AB;;%'NN++;;JG)J6K 5R -IJJ..y9	;;%' $ 3 3 C CI NINN9f-LL<d0012 LL.T=O=O1PPQ{{e#J!$"4"456 
;;% !!"EFc11JJ4PQ $$T[[$2Q2Q2ST/
 $DKK0"

778I8UV	 0 a!@!@$		AR!ST )* 59 ++C00$7	$BJqM !6 LL:[=UUVLLt{{+SXXj-AC  ..t{{MJ NNDK,DmTLL-DKK0HHI yyAAB))==?@ 78J LL:; LL)K,DDE)) >@DL) !, C, 99$LL   2 23HHCCC ||v%$++*B''()    ''()    YY**%(* H8S* &
 #FF99;;"66&&++,!!D E '  OO++,!$##- $  ;;"66&&++,!!? @ '  OO++,!##- $  YY**LL   2 23HHCCC OO##$%   {{e# $ <<T=O=OP $D$6$67 YY++%(* IHT* & ||v%$++*B''(()    ''(#)    YY& OO##$dG[Z   *DIIt{{C KKDKK4;;6IIT666}6HPT   ""G[[M?	 #  99111T5V5V5Vyy,,,	..,	(	==?L!{{e# ''4u$!-LLH, $t{{2V|nD4VV2 ~7IQU   t{{*----!N[[M>J +    ;;%'$++L9{{e#		5E(E55lCD55dkkBC>J +    <<\JK!N@9L +    !''(H(H(VW '';;LI zz$++t{{!;;""ZZL$?)K	 #  {{e#		5E(E""G??M88F 6	A #  ""G!N5	A	 #  U 6Wm TP Es   t..t3Nr   c                     SnU(       a-  U Vs/ s H  od" X6-   5      PM     nnSSR                  U5      -   nU R                  R                  U SU S35        gs  snf )zWrite a variable definition that is a list of values.

E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
     foo = blaha blahb
but in a pretty-printed style.
r   z \
	z :=z

N)rN   r   r[   )r   
value_listrF  r]  rS  valuesvalues          r;   r2  MakefileWriter.WriteList	  s]     >HIjU&0jJI
!;;F
#fXT23 Js   Ac           	          SnU(       a
  SU;  d   eSnU R                  UUSU U S3/UUSS9  U Vs/ s H  n[        U[        5      PM     nnU R                  SS	R	                  U5      -  5        g
s  snf )zWrite a Makefile rule that uses do_cmd.

This makes the outputs dependent on the command line that was run,
as well as support the V= make command line flag.
r   ,z,,1z$(call do_cmd,)T)r   rg  r  forcer,  r   N)r0  r   SPACE_REPLACEMENTr   rN   )	r   r  r  r  r   rg  r  suffixr#  s	            r;   r  MakefileWriter.WriteDoCmd  s     g%%%F%gYvha89 	 	
 ?FFg;q"34gF%(99: Gs   A3c	                    U V	s/ s H  n	[        U	5      PM     nn	U V
s/ s H  n
[        U
5      PM     nn
U(       a  U R                  SU-   5        U(       a#  U R                  SSR                  U5      -   5        U(       a  U R                  SUS   -  5        U(       a  SOSnU(       aB  U R                  SR                  SR                  U5      SR                  U5      U5      5        GO7[	        U5      S	:X  a5  U R                  S
R                  US   SR                  U5      U5      5        O[
        R                  " U=(       d    U R                  R                  S5      5      R                  5       nSU-  nU R                  SR                  SR                  U5      U5      5        U R                  SS-  5        U R                  SR                  SU5      5        U R                  S
R                  USR                  U5      U5      5        UR                  SS5        U(       a  U H  nU R                  SU-  5        M     U R                  5         gs  sn	f s  sn
f )a  Write a Makefile rule, with some extra tricks.

outputs: a list of outputs for the rule (note: this is not directly
         supported by make; see comments below)
inputs: a list of inputs for the rule
actions: a list of shell commands to run for the rule
comment: a comment to put in the Makefile above the rule (also useful
         for making this Python script's code self-documenting)
order_only: if true, makes the dependency order-only
force: if true, include FORCE_DO_CMD as an order-only dep
phony: if true, the rule does not actually generate the named output, the
       output is just a name to run the rule
command: (optional) command name to generate unambiguous labels
z# z.PHONY: r   z%s: TOOLSET := $(TOOLSET)r   r  r   z
{}: | {}{}r   z{}: {}{}zutf-8z%s.intermediatez{}: {}z	%sz@:z.INTERMEDIATEz$(call do_cmd,touch)N)r   r   rN   r   r  hashlibsha1r   encode	hexdigestr  )r   r  r  r   rg  rh  r  r  r  r#  r%  force_append	cmddigestintermediater  s                  r;   r0  MakefileWriter.WriteMakeRule1  s   2 ,337a;q>73*01&Q+a.&1LL(LLchhw&778LL4wqzAB*/R LL##CHHW$5sxx7GV \QLL**71:sxx7GVW  'DKK//8ik  -y8LLL'):LIJLL$'LL,GHLL!!,0@,O NN145!Vf_- "] 41s
   IIc                    U R                   S;  a  gU R                  S5        U R                  S5        U R                  SU-   5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        S
S
S
S.nSnU HF  n[        R                  R	                  U5      S   nXt;   d  M,  XG==   S-  ss'   XG   XE   :  d  MD  UnMH     U R                  SU-   5        U R                  [        [        U R                  [        [        U5      5      5      S5        S nSS0n	0 n
[        X5        U R                  U" U[        S   U
S   5      S5        U R                  U" U[        S   [        S   5      S5        U R                   S:X  a  U R                  S5        OCU R                   S:X  a  U R                  S5        O!U R                   S:X  a  U R                  S5        U R                  5         g)a  Write a set of LOCAL_XXX definitions for Android NDK.

These variable definitions will be used by Android NDK but do nothing for
non-Android applications.

Arguments:
  module_name: Android NDK module name, which must be unique among all
      module names.
  all_sources: A list of source files (will be filtered by Compilable).
  link_deps: A list of link dependencies, which must be sorted in
      the order from dependencies to dependents.
)r   r   r   Nz/# Variable definitions for Android applicationszinclude $(CLEAR_VARS)zLOCAL_MODULE := ziLOCAL_CFLAGS := $(CFLAGS_$(BUILDTYPE)) $(DEFS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))z+LOCAL_CPPFLAGS := $(CFLAGS_CC_$(BUILDTYPE))zLOCAL_C_INCLUDES :=z/LOCAL_LDLIBS := $(LDFLAGS_$(BUILDTYPE)) $(LIBS)r   )rb   rc   rd   rc   r   zLOCAL_CPP_EXTENSION := LOCAL_SRC_FILESc                    / nU  Hy  n[         R                  R                  U5      nUR                  U5      (       d  M:  UR	                  U5      (       d  MR  UR                  U[        U5      [        U5      *  5        M{     U$ rg   )rK   rL   r   r  ro   r   r  )r   r]  r  modulesfilepathrq   s         r;   DepsToModules?MakefileWriter.WriteAndroidNdkModuleRule.<locals>.DepsToModules  sj    G 77++H5&&v..83D3DV3L3LNN8CK3v;,#GH ! Nr=   r8   r%   r   r   LOCAL_SHARED_LIBRARIESr   r   LOCAL_STATIC_LIBRARIESr   zinclude $(BUILD_EXECUTABLE)r   zinclude $(BUILD_SHARED_LIBRARY)r   zinclude $(BUILD_STATIC_LIBRARY))r   r   rK   rL   ry   r2  rr  mapr   rs  rt   r<   r/   )r   module_namer   r   cpp_extdefault_cpp_extrq   r^   r  r7   r6   s              r;   r   (MakefileWriter.WriteAndroidNdkModuleRulez  s    99NNFG,-'+56	#	
 	BC*+FG Q2 #H''""8,Q/C~!<'"::&)O $ 	.@AT__fZ&EFG	
	 G$,5+,?@!"56
 %	
 	+,?@+,?@
 %	
 99$LL67YY**LL:;YY**LL:;r=   c                 @    U R                   R                  US-   5        g )NrV   )r   r[   )r   texts     r;   r   MakefileWriter.WriteLn  s    dTk"r=   c                     [         R                  R                  U R                  S[        R
                  R                  SU R
                  5      SU5      $ )Nz$(abs_builddir)z$(abs_srcdir)r
   )r+   r   r  r   rK   rL   rN   )r   rU  s     r;   r   MakefileWriter.GetSortedXcodeEnv  sC    ""44GGLL$))4
 	
r=   c                 \    U R                   R                  SS5      nU R                  SU0S9$ )NCHROMIUM_STRIP_SAVE_FILEr   rT  )r   GetPerTargetSettingr  )r   strip_save_files     r;   r  )MakefileWriter.GetSortedXcodePostbuildEnv  sA     --AA&

 %%!;_ M & 
 	
r=   c                 ^    U H'  u  p4U R                  [        U5       SU SU 35        M)     g )Nz	: export r  )r   r   )r   r   r  kvs        r;   r  "MakefileWriter.WriteSortedXcodeEnv  s3    DA LLK/0	!DDE r=   c                     SU;   a  UR                  SSU R                  -  5      nSU;  a  SU R                   SU 3nU$ )z,Convert a path to its output directory form.r   $(obj)/z$(obj).%s/$(TARGET)/z$(obj)r  z/$(TARGET)/)r~   r   r   rL   s     r;   rt  MakefileWriter.Objectify  sF    4<<<	+ADLL+PQD4T\\N+dV<Dr=   c                     U R                  U5      nSU;   a$  UR                  SSU R                   SU 35      nU$ SU R                   SU SU 3$ )z:Convert a prefix header path to its output directory form.r   r&  r  z/$(TARGET)/pch-/)r   r~   r   )r   rL   r  s      r;   r   MakefileWriter.Pchify 	  s_    t$4<<<WT\\N/$HD KodV1TFCCr=   c                     SU;   a  UR                  S5      $ [        R                  R                  [        R                  R	                  U R                  U5      5      $ )zhConvert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables.r   r*  )rstriprK   rL   rM   rN   r'  s     r;   r   MakefileWriter.Absolutify
	  sD     4< ;;s##wwTYY =>>r=   c                 2    SU;  a  SU;  a  U$ UUUS.-  nU$ )Nr   r	   )
INPUT_ROOTINPUT_DIRNAMErh   )r   template	expansionr   rL   s        r;   r/  MakefileWriter.ExpandInputRoot	  s3    8+0C80SO#$
 
 r=   c                     U R                   S:X  a.  U R                  S:X  a  SU R                  < SU R                  < 3$ SU R                  -   $ )zCReturns the location of the final output for an installable target.r'   r   z$(builddir)/lib.r*  z$(builddir)/)r8   r   r   r   r  s    r;   r   ,MakefileWriter._InstallableTargetInstallPath	  s>     ;;%DII1A$A.2llDJJGG

**r=   )r   r   r8   r   r?   r   r   r   r   rL   r   r   r   r   r   r   r   r   )NF)NNFFFN)r   rg   )(__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r   r   r   r   rw  r  r  r   r   r   r   r  r  r  r   r   r2  r  r0  r   r   r  r  r  rt  r   r   r/  r   __static_attributes__rh   r=   r;   r   r     s    
-^Wr8{zN`&P+"& PSj>33j
DHK
I404
@D .2"EU 4 OT;> GRZx#


FD?+r=   r   c                 @   U S   nU S    Vs/ s H,  n[         R                  R                  XTR                  5      PM.     nn[         R                  R	                  U S   UR                  5      nUR                  [        R                  5      (       d   [        R                  R                  SU5      nUR                  SUSR                  S U 5       5      [         R                  R                  US/[         R                  " U5      -   U-   5      S	.-  5        g
s  snf )z,Write the target to regenerate the Makefile.rA   build_files_arg
gyp_binaryr  zquiet_cmd_regen_makefile = ACTION Regenerating $@
cmd_regen_makefile = cd $(srcdir); %(cmd)s
%(makefile_name)s: %(deps)s
	$(call do_cmd,regen_makefile)

r   c              3   8   #    U  H  n[        U5      v   M     g 7frg   )r   )ri   bfs     r;   rk   ,WriteAutoRegenerationRule.<locals>.<genexpr>D	  s     O;R4R88;rE  z-fmake)makefile_namer   cmdN)r+   r,   RelativePathrJ   FixIfRelativePathr  rK   seprL   rN   r[   r  RegenerateFlags)r7   root_makefilerC  build_filesrA   rq   build_files_argsr?  s           r;   WriteAutoRegenerationRulerL  /	  s   YG 011H 	

*>*>?1  
 --|g22J   ((WW\\#z2
	.
 +HHO;OO::22X&)<)<W)EEHXX
	
	
s   3Dc                     US   nU Hs  nS/nUR                   (       a!  UR                   S:w  a  USUR                   4-  nUR                  SU-   5        [        SU SU 35        [        R                  " U5        Mu     g )NrA   maker  z-Cz
BUILDTYPE=z
Building [z]: )rJ   r   r  
subprocess
check_call)dataconfigurationsr7   rA   r{  	argumentss         r;   PerformBuildrT  L	  s~    YG H	G$8$8C$?w3333I./
6(#i[12i( !r=   c                   ^7 US   m7[         R                  R                  U5      nUR                  S0 5      nUR                  SS5      nUR                  SS 5      nUR                  SS5      nU74S jn	S n
U  Vs1 s H
  oU   S	   iM     nnU  H  nX   nUS
   S:w  d  M  US
   n
  O   U
(       d  Sn
SnST7R                  -   n[
        R                  R                  T7R                  U5      nT7R                  (       aa  [
        R                  R                  T7R                  T7R                  U5      n[         R                  R                  UT7R                  5      nSqSnSnSn0 SU_SU_S
U
_SU_SS_S[        _SS_SU_SU_SU_S[        SS5      _S[        SS 5      _S![        S"S#5      _S$[        S%S&5      _S'[        S(S)5      _S*[        S+S,5      _S-[        S.S/5      _[        S0S15      [        S2S35      [        S4S)5      S5.EnUS6:X  a"  S7nUR                  US8[        [         S9.5        GOUS::X  a  UR                  S["        05        GOyUS;:X  a  S<n[        SS=5      nSnUS>:X  a%  [        S+S>5      n[        S"S?5      n[        S0S?5      nO|US@:X  a%  [        S+S@5      n[        S"SA5      n[        S0SA5      nOQUSB:X  a%  [        S+SB5      n[        S"SC5      n[        S0SC5      nO&SDn[        S+S=5      n[        S"SE5      n[        S0SE5      nUR                  UU[$        [&        UUUUSF.5        OUSG:X  a  SHnUR                  USIS8SJ.5        O{USK:X  a  UR                  SSL05        OaUSM:X  a  SNnUR                  SU05        OEUSO:X  a  SNnUR                  U[(        SIS8SP.5        O"USQ:X  a  SNnUR                  U[*        SIS8SP.5        [         R                  R-                  U SR   5      u  n  nUU   R                  SS/ 5      n0 nU H3  u  nnUR/                  ST5      (       d  M  SUU-  UUS [1        ST5      *  '   M5     SnU H  u  nn[2        R4                  " SVU5      (       a  M$  USR   SW:w  a  SUU-  nUR                  U5      n U (       a
  U  SXU 3nUU	 USY;   aT  USZU-  -  nUR7                  SS[5      n!U![
        R8                  ;   a  [
        R8                  U!   nUS\U S]U S^3-  nUS_-  nM  UU S`U S^3-  nM     UUSS'   [         R                  R;                  U5        [=        USa5      n"U"R?                  [@        U-  5        U(       a  U"R?                  Sb5        U H"  n#U"R?                  ScU#-  5        [C        U"5        M$     [
        R                  RE                  U5      n$[         R                  RG                  UU$5        [I        5       n%USd    H;  n[         R                  RK                  XU5       H  nU%RM                  U5        M     M=     [I        5       n&[I        5       n'U  GH  n([         R                  R-                  U(5      u  nnn#UU   R                  SS/ 5      n)UU):X  d   SeU) SfU 35       eU&RM                  [         R                  R                  UT7R                  5      5        UU   Sg   n*U* H  n+[         R                  R                  [         R                  RO                  U+U5      T7R                  5      n,[
        R                  RQ                  U,5      n-USh   (       a,  U-RS                  USh   5      (       a  U&RM                  U-5        M  U&RM                  U,5        M     U	" UUS-   U#-   T7R                  -   Si-   5      u  n.n/UU(   nUSj   n0US6:X  a#  [         RT                  RW                  UU   U5        [Y        XT5      n1U1R[                  U(U.U/UU0U(U%;   Sk9  [         R                  R                  U/[
        R                  RE                  U5      5      n2U'RM                  U25        GM     [         R                  R                  T7R\                  [
        R^                  " 5       5      n3U& GH  n[
        R                  R                  U3U5      nU  V(s/ s H+  n(U(RS                  U5      (       d  M  U(U%;   d  M#  UU(   Sl   PM-     n4n(U4(       d  Me  U	" U[
        R                  Ra                  [
        R                  Rc                  U5      5      SR   Sm-   5      u  n.n/[         R                  R                  [
        R                  RE                  U5      [
        R                  RE                  U/5      5      n5W1Re                  U/U5U4U5        GM"     U"R?                  S^5        [g        U'5       HB  n6U"R?                  SnU6-   So-   5        U"R?                  SpU6-   S^-   5        U"R?                  S_5        MD     U"R?                  S^5        UR                  Sq5      (       d%  UR                  SrSs5      (       a  [i        UU"UU&5        U"R?                  [j        5        U"Rm                  5         g s  snf s  sn(f )tNrA   r?   rB   rC   r@   default_targetr  c                   > [         R                  R                  [        R                  R                  U 5      TR                  5      n[        R                  R                  TR                  X!5      nTR                  (       a5  [        R                  R                  TR                  TR                  X!5      n[         R                  R                  [        R                  R                  U 5      TR                  5      nX#4$ )z9Determine where to write a Makefile for a given gyp file.)
r+   r,   rE  rK   rL   r   depthrN   rI   rJ   )
build_file	base_namer   output_filerA   s       r;   CalculateMakefilePath-GenerateOutput.<locals>.CalculateMakefilePath_	  s     JJ++BGGOOJ,GW	ggll7==)G##'',,w77K JJ++GGOOJ')=)=
	 %%r=   r   default_configurationDefaultr  Makefilez
$(srcdir)/flockz-afz-MMDbuilddirflock_indexr   link_commandsextra_commandsr   srcdircopy_archive_argsmakedep_args	CC.target)	CC_targetCCz$(CC)z	AR.target)	AR_targetARz$(AR)
CXX.target)
CXX_targetCXXz$(CXX)zLINK.target)LINK_targetLINKz$(LINK)z
PLI.target)
PLI_targetPLIr)   CC.host)CC_hostrk  gcczAR.host)AR_hostrm  ar)CXX_hostrp  zg++)	LINK_hostrr  z$(CXX.host))PLI_hostrt  )CXX.hostz	LINK.hostzPLI.hostr   z./gyp-mac-tool flock   )ra  rc  rd  re  r$   r'   z-fPRnjscclangzclang++zibm-clang64zibm-clang++64z	ibm-clangzibm-clang++z-qmakedep=gccznjsc++)rg  rh  rd  re  ri  rn  ru  r}  solarisz-pPRf@z./gyp-flock-tool flock)rg  ra  rc  freebsdlockfr  z-pPRfr&   )rg  rd  ra  rc  os400r   make_global_settings_wrapperz$(abspath %s)z
.*_wrapperr   r   )rk  ru  rp  r}  z3ifneq (,$(filter $(origin %s), undefined default))
r   z  z = rV   zendif
z ?= r   zU# Define LOCAL_PATH for build of Android applications.
LOCAL_PATH := $(call my-dir)

zTOOLSET := %s
rJ  z:make_global_settings needs to be the same for all targets z vs. included_fileshome_dot_gypz.mkrR  rI  r   z	.Makefilezmifeq ($(strip $(foreach prefix,$(NO_LOAD),\
    $(findstring $(join ^,$(prefix)),\
                 $(join ^,z)))),)
z
  include 
standaloneauto_regenerationT)7r+   r,   r-   rG   r  rK   rL   rN   rJ   rI   rE  r   LINK_COMMANDS_LINUXr   r5   LINK_COMMANDS_MACSHARED_HEADER_MAC_COMMANDSLINK_COMMANDS_ANDROIDLINK_COMMANDS_OS390SHARED_HEADER_OS390_COMMANDSLINK_COMMANDS_AIXLINK_COMMANDS_OS400ParseQualifiedTargetro   r  r   matchr~   environr   r   r[   SHARED_HEADERr_   r   CopyToolr  
AllTargetsr  UnrelativePathabspathr  r   MergeGlobalXcodeSettingsToSpecr   r   rX  getcwdry   r   r   rW   rL  SHARED_FOOTERr   )8target_listtarget_dictsrQ  r7   r8   r?   rP   r@   rV  r\  r^  r   toolsetsr   rf  rC  r   flock_commandcopy_archive_argumentsmakedep_argumentsheader_paramsrj  rv  ro  rz  rY  r   make_global_settings_arraywrappersrT   r  r  wrapperenv_keyrI  r   	dest_pathneeded_targetsrJ  include_listr   this_make_global_settingsr  included_filerelative_include_fileabs_include_filer   r[  r   r\   mkfile_rel_pathdepth_rel_pathgyp_targetsmakefile_rel_pathinclude_filerA   s8                                                          @r;   GenerateOutputr  W	  s   YGZZ!!&)Fjj!2B7O#''e<M)--.CTJ$(()95AN&* !>IJkFV$Y/kHJ#'(I5$()@$A!	 
 ! )F/MGGLL!5!5}EM  '":":M
 ((1I1IJ$M".M 	 !6 		
 	q 	, 	" 	& 	3 	) 	'(;WE 	'(;WE 	()>I 	)*A9M 	()>F  	%&7?!" 	%&7>#$ '':EB'(=}M&':EB)M, .& !2"<		
 
9	o/DEF	5!'&':FC	"():GDG+,A9MJ)*=yIH-'():MJG+,A?SJ)*=OH+%():KHG+,A=QJ)*=}MH !0():FCG+,A8LJ)*=xHH%; 1!4">&("$		
 
9	!)%;1 	
 
9	gw/0	9	!(13IJK	5!(%;!21 		
 
7	!(%;!41 		
 zz66{1~FJ1!%j!1!5!56Lb!QH0
U<<
##0?%0GHS+C
O+,- 1 0
U88L#&&8s?#e+E,,s#iq(E66 FL  kk#s+G"**$

7+ bSr$::  I-  se4wb$99 ) 10 -AM()JJ}-,M56 	

 -78"=1 
 .IJJ	* UN]+
jj++KzRFv& S , %K5L'&)jj&E&EFV&W#
FG$($4$8$89OQS$T!)-FF 	
H()/C.DF	
F
 	

//
G<P<PQRj)*:;+M %(JJ$;$;

))-D$$%!  "ww/DE n%*:*E*E~&+ +  01 56! ,$ "7w.?%G"
	; ,-'(U?>>tJ?OQUV8(N: 	 	
 **117
 	)m (r ZZ,,W]]BIIKHN!
 WW\\.*=
 %0
$/ **:6 : !N2 :L)*=9$/ 	 
 !6(()9)9*)EFqIKW"
	;  JJ33GGOOM*BGGOOK,H
 	K):KW) ". |,
 	)+78:DE	

 	L<7$>?I& - |,,1D1DT2 2 	"&-T&E	 Kt
s   :i3#i8i8	i8)z\ )5rK   r   rO  r+   
gyp.commongyp.xcode_emulationr   r  r/   r,   CrossCompileRequested$generator_supports_multiple_toolsetsrH   r   r    r!   rO   r<   rQ   r  r  r  r  r  r  r  r  r  r_   r  r   r   r  r   r4   rt   rw   rz   r   r   r   r   r   r   r   r   r   r   r   r   rL  rT  r  rh   r=   r;   <module>r     s  2 
 	  
   )  :+ '-&$%( $ (+zz'G'G'I $ ', # /1 +%' "$& ! +E\B  ; z 2 j $ $ *J&V WKXYM\ ]N^a_pb cqdMeQMd eRf)gT)j kUl!mw v >*  ' #
' #

 

 U
#
0
/ !0
  !( 
  q+ q+h1:)@r=   