1b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel DunbarSubDirs := lib
2b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
3b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Set default rule before anything else.
448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarall: help
5b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
6b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarinclude make/config.mk
7b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarinclude make/util.mk
8557a6eace292091d14419a334e8d62d9ec9e772bDaniel Dunbar# If SRCROOT is defined, assume we are doing an Apple style build. We should be
9557a6eace292091d14419a334e8d62d9ec9e772bDaniel Dunbar# able to use RC_XBS for this but that is unused during "make installsrc".
10b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarifdef SRCROOT
11b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar  include make/AppleBI.mk
12b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarendif
13b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
14b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Make sure we don't build with a missing ProjObjRoot.
15b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarifeq ($(ProjObjRoot),)
16b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar$(error Refusing to build with empty ProjObjRoot variable)
17b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarendif
18b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
19b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar##############
20b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
21b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar###
22b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Rules
23b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
24b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar###
25b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Top level targets
26b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
27f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar# FIXME: Document the available subtargets.
28f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbarhelp:
29f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "usage: make [{VARIABLE=VALUE}*] target"
30f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo
31f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "User variables:"
32f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "  VERBOSE=1: Use to show all commands [default=0]"
33f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo
34f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "Available targets:"
3548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  <platform name>: build the libraries for 'platform'"
3648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  clean:           clean all configurations"
3748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  test:            run unit tests"
3848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo
3948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  info-platforms:  list available platforms"
4048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  help-devel:      print additional help for developers"
41f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo
42f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar
439edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbarhelp-devel: help
449edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@echo "Development targets:"
4548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  <platform name>-<config name>:"
4648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "    build the libraries for a single platform config"
4748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  <platform name>-<config name>-<arch name>:"
4848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "    build the libraries for a single config and arch"
499edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@echo "  info-functions: list available compiler-rt functions"
5048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "  help-hidden: print help for Makefile debugging"
519edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@echo
529edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar
539edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbarhelp-hidden: help-devel
54f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "Debugging variables:"
55faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbar	@echo "  DEBUGMAKE=1: enable some Makefile logging [default=]"
56faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbar	@echo "           =2: enable more Makefile logging"
57f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo
58f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "Debugging targets:"
59f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo "  make-print-FOO: print information on the variable 'FOO'"
60f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar	@echo
61f5722759b8fd2ae65042fe6f87908e3569dbfdf0Daniel Dunbar
629edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbarinfo-functions:
639edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@echo "compiler-rt Available Functions"
649edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@echo
659edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@echo "All Functions: $(AvailableFunctions)"
669edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	@$(foreach fn,$(AvailableFunctions),\
679edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	  printf "  %-20s - available in (%s)\n" $(fn)\
689edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar	    "$(foreach key,$(AvailableIn.$(fn)),$($(key).Dir))";)
699edf5cdd69d2d2a74b37ec14e475c5d6367e6eecDaniel Dunbar
7048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarinfo-platforms:
7148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "compiler-rt Available Platforms"
7248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo
7348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@echo "Platforms:"
7448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	@$(foreach key,$(PlatformKeys),\
7548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	  printf "  %s - from '%s'\n" $($(key).Name) $($(key).Path);\
7648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	  printf "    %s\n" "$($(key).Description)";\
7748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	  printf "    Configurations: %s\n\n" "$($(key).Configs)";)
7848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
79b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Provide default clean target which is extended by other templates.
80b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar.PHONY: clean
81b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarclean::
82b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
83b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Test
84b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar.PHONY: test
85b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbartest:
86b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	cd test/Unit && ./test
87b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
88b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar###
89b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Directory handling magic.
90b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
91b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Create directories as needed, and timestamp their creation.
92b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar%/.dir:
93b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	$(Summary) "  MKDIR:     $*"
94b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	$(Verb) $(MKDIR) $* > /dev/null
953ecda6189a53400da2e342bac5571bfa63022da3Daniel Dunbar	$(Verb) echo 'Created.' > $@
96b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
97b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Remove directories
98b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar%/.remove:
99b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	$(Verb) $(RM) -r $*
100b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
101b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar###
102b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar# Include child makefile fragments
103b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
104faf0150036689985ecea64e78f2637093857cd7bDaniel DunbarDir := .
105faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbarinclude make/subdir.mk
10678cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbarinclude make/lib_info.mk
10778cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbarinclude make/lib_util.mk
10848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarinclude make/lib_platforms.mk
10948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
11048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar###
11148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Define Platform Rules
11248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
11348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbardefine PerPlatform_template
11448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Key,$(1))
11548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Name,$($(Tmp.Key).Name))
11648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Configs,$($(Tmp.Key).Configs))
11748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name))
11848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
11948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Top-Level Platform Target
1208bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(Tmp.Name):: $(Tmp.Configs:%=$(Tmp.Name)-%)
12148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar.PHONY: $(Tmp.Name)
12248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
12348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarclean::
12448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Verb) rm -rf $(Tmp.ObjPath)
12548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
12648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Per-Config Libraries
12748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(foreach config,$(Tmp.Configs),\
12848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call PerPlatformConfig_template,$(config)))
12948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarendef
13048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
13148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbardefine PerPlatformConfig_template
13248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Config,$(1))
13348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config))
1348bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(call Set,Tmp.SHARED_LIBRARY,$(strip \
1358bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar  $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
136a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov$(call Set,Tmp.SHARED_LIBRARY_SUFFIX,$(strip \
137a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov  $(call GetCNAVar,SHARED_LIBRARY_SUFFIX,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
1388bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar
1398bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar# Compute the library suffix.
1408bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)),
141a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov  $(call Set,Tmp.LibrarySuffix,$(Tmp.SHARED_LIBRARY_SUFFIX)),
1428bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar  $(call Set,Tmp.LibrarySuffix,a))
14348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
14448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Compute the archs to build, depending on whether this is a universal build or
14548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# not.
14648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.ArchsToBuild,\
14748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),\
14806f38e5fc22bbeadabc1be11eb77f6d27cd3140cDaniel Dunbar       $(strip \
14906f38e5fc22bbeadabc1be11eb77f6d27cd3140cDaniel Dunbar         $(or $($(Tmp.Key).UniversalArchs.$(Tmp.Config)),\
15006f38e5fc22bbeadabc1be11eb77f6d27cd3140cDaniel Dunbar              $($(Tmp.Key).UniversalArchs))),\
15148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar       $(call VarOrDefault,$(Tmp.Key).Arch.$(Tmp.Config),$($(Tmp.Key).Arch))))
15248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
15348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Copy or lipo to create the per-config library.
1548bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(call Set,Tmp.Inputs,$(Tmp.ArchsToBuild:%=$(Tmp.ObjPath)/%/libcompiler_rt.$(Tmp.LibrarySuffix)))
1558bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix): $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
15648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Summary) "  FINAL-ARCHIVE: $(Tmp.Name)/$(Tmp.Config): $$@"
15748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	-$(Verb) $(RM) $$@
15848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(if $(call streq,1,$(words $(Tmp.ArchsToBuild))), \
15948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	  $(Verb) $(CP) $(Tmp.Inputs) $$@, \
16048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	  $(Verb) $(LIPO) -create -output $$@ $(Tmp.Inputs))
16148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar.PRECIOUS: $(Tmp.ObjPath)/.dir
16248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
16348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Per-Config Targets
1648bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(Tmp.Name)-$(Tmp.Config):: $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix)
16548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar.PHONY: $(Tmp.Name)-$(Tmp.Config)
16648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
16748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Per-Config-Arch Libraries
16848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(foreach arch,$(Tmp.ArchsToBuild),\
16948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call PerPlatformConfigArch_template,$(arch)))
17048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarendef
17148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
17248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbardefine PerPlatformConfigArch_template
17348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Arch,$(1))
17448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch))
17548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Functions,$(strip \
176401f693a874c0f2fd9e37173e3ab7045a1bdeb3dDaniel Dunbar  $(AlwaysRequiredModules) \
17748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,FUNCTIONS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
17848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Optimized,$(strip \
17948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,OPTIMIZED,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
18048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.AR,$(strip \
18148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,AR,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
18248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.ARFLAGS,$(strip \
18348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,ARFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
1848bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(call Set,Tmp.CC,$(strip \
1858bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar  $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
1868bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(call Set,Tmp.LDFLAGS,$(strip \
1878bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar  $(call GetCNAVar,LDFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
18848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.RANLIB,$(strip \
18948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,RANLIB,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
19048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.RANLIBFLAGS,$(strip \
19148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,RANLIBFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
1928bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(call Set,Tmp.SHARED_LIBRARY,$(strip \
1938bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar  $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
1948bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar
1958bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar# Compute the library suffix.
1968bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)),
197a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov  $(call Set,Tmp.LibrarySuffix,$(Tmp.SHARED_LIBRARY_SUFFIX)),
1988bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar  $(call Set,Tmp.LibrarySuffix,a))
19948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
20048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Compute the object inputs for this library.
20148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Inputs,\
20248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(foreach fn,$(sort $(Tmp.Functions)),\
20348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar    $(call Set,Tmp.FnDir,\
20448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar      $(call SelectFunctionDir,$(Tmp.Config),$(Tmp.Arch),$(fn),$(Tmp.Optimized)))\
20548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar    $(Tmp.ObjPath)/$(Tmp.FnDir)/$(fn).o))
20648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(Tmp.ObjPath)/libcompiler_rt.a: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
20748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Summary) "  ARCHIVE:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@"
20848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	-$(Verb) $(RM) $$@
20948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Verb) $(Tmp.AR) $(Tmp.ARFLAGS) $$@ $(Tmp.Inputs)
21048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Verb) $(Tmp.RANLIB) $(Tmp.RANLIBFLAGS) $$@
2118bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(Tmp.ObjPath)/libcompiler_rt.dylib: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
2128bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar	$(Summary) "  DYLIB:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@"
2138bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar	$(Verb) $(Tmp.CC) -arch $(Tmp.Arch) -dynamiclib -o $$@ \
2148bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar	  $(Tmp.Inputs) $(Tmp.LDFLAGS)
215a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov$(Tmp.ObjPath)/libcompiler_rt.so: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
216a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov	$(Summary) "  SO:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@"
217a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov	$(Verb) $(Tmp.CC) -shared -o $$@ \
218a69eb9a1a0b111a4776a9bd727f4d551ec308261Evgeniy Stepanov	  $(Tmp.Inputs) $(Tmp.LDFLAGS)
21948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar.PRECIOUS: $(Tmp.ObjPath)/.dir
22048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
22148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Per-Config-Arch Targets
2228bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch):: $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix)
22348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar.PHONY: $(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch)
22448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
22548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Per-Config-Arch-SubDir Objects
22648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(foreach key,$(SubDirKeys),\
22748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call PerPlatformConfigArchSubDir_template,$(key)))
22848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarendef
22948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
23048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbardefine PerPlatformConfigArchSubDir_template
23148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.SubDirKey,$(1))
23248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.SubDir,$($(Tmp.SubDirKey).Dir))
23348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.SrcPath,$(ProjSrcRoot)/$(Tmp.SubDir))
23448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch)/$(Tmp.SubDirKey))
23548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.Dependencies,$($(Tmp.SubDirKey).Dependencies))
23648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.CC,$(strip \
23748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
238d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar$(call Set,Tmp.KERNEL_USE,$(strip \
239d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar  $(call GetCNAVar,KERNEL_USE,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
240d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar$(call Set,Tmp.VISIBILITY_HIDDEN,$(strip \
241d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar  $(call GetCNAVar,VISIBILITY_HIDDEN,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
24248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(call Set,Tmp.CFLAGS,$(strip \
2436a571fb3c515c5ea53308ba0eda750e8dd76ef6bDaniel Dunbar  $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),-arch $(Tmp.Arch),)\
244d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar  $(if $(call streq,$(Tmp.VISIBILITY_HIDDEN),1),\
2456a571fb3c515c5ea53308ba0eda750e8dd76ef6bDaniel Dunbar       -fvisibility=hidden -DVISIBILITY_HIDDEN,)\
246d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar  $(if $(call streq,$(Tmp.KERNEL_USE),1),\
247d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6Daniel Dunbar       -mkernel -DKERNEL_USE,)\
24848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(call GetCNAVar,CFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
24948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
25048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
25148464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Summary) "  ASSEMBLE:  $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
2526a571fb3c515c5ea53308ba0eda750e8dd76ef6bDaniel Dunbar	$(Verb) $(Tmp.CC) $(Tmp.CFLAGS)  -c -o $$@ $$<
25348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.S $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
25448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Summary) "  ASSEMBLE:  $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
2556a571fb3c515c5ea53308ba0eda750e8dd76ef6bDaniel Dunbar	$(Verb) $(Tmp.CC) $(Tmp.CFLAGS) -c -o $$@ $$<
25648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.c $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
25748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar	$(Summary) "  COMPILE:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
258f5225d5f82525abad202997ffce19dfc3023c5edAlexander Potapenko	$(Verb) $(Tmp.CC) $(COMMON_CFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$<
259a6fd8452b557b9bc8350d343da2bea2b0b5dc28aDaniel Dunbar$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.cc $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
260a6fd8452b557b9bc8350d343da2bea2b0b5dc28aDaniel Dunbar	$(Summary) "  COMPILE:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
261f5225d5f82525abad202997ffce19dfc3023c5edAlexander Potapenko	$(Verb) $(Tmp.CC) $(COMMON_CXXFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$<
26248464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar.PRECIOUS: $(Tmp.ObjPath)/.dir
26348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
26448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbarendef
26548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
26648464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# Run templates.
26748464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar$(foreach key,$(PlatformKeys),\
26848464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar  $(eval $(call PerPlatform_template,$(key))))
26948464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
27048464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar###
27178cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
272faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbarifneq ($(DEBUGMAKE),)
273faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbar  $(info MAKE: Done processing Makefile)
274faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbar  $(info  )
275faf0150036689985ecea64e78f2637093857cd7bDaniel Dunbarendif
276