178cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# compiler-rt Library Info
278cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#
378cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# This should be included once the subdirectory information has been loaded, and
478cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# uses the utilities in 'util.mk'.
578cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#
678cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# This defines the following variables describing compiler-rt:
778cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#   AvailableFunctions   - The entire list of function names (unmangled) the
878cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#                          library can provide.
978cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#   CommonFunctions      - The list of generic functions available.
1078cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#   ArchFunctions.<arch> - The list of functions commonly available for
1178cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#                          'arch'. This does not include any config specific
1278cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#                          functions.
1378cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#
1478cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#   AvailableIn.<function> - The list of subdir keys where 'function' is
1578cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar#                            defined.
1678cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
17f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar# Determine the set of available modules.
18f06648acf50b17b4a90abb46eb4515947f96fecdDaniel DunbarAvailableModules := $(sort $(foreach key,$(SubDirKeys),\
19f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar	$($(key).ModuleName)))
20f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar
21f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar# Build a per-module map of subdir keys.
22f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar$(foreach key,$(SubDirKeys),\
23f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar	$(call Append,ModuleSubDirKeys.$($(key).ModuleName),$(key)))
24f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar
2578cfbc57c62949e16fa7b4a69775aa6450343a00Daniel DunbarAvailableArchs := $(sort $(foreach key,$(SubDirKeys),\
2678cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar	$($(key).OnlyArchs)))
2778cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
2878cfbc57c62949e16fa7b4a69775aa6450343a00Daniel DunbarAvailableFunctions := $(sort $(foreach key,$(SubDirKeys),\
2978cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar	$(basename $($(key).ObjNames))))
3078cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
3178cfbc57c62949e16fa7b4a69775aa6450343a00Daniel DunbarCommonFunctions := $(sort\
32f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar  $(foreach key,$(ModuleSubDirKeys.builtins),\
3378cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar    $(if $(call strneq,,$(strip $($(key).OnlyArchs) $($(key).OnlyConfigs))),,\
3478cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar         $(basename $($(key).ObjNames)))))
3578cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
3678cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# Compute common arch functions.
37f06648acf50b17b4a90abb46eb4515947f96fecdDaniel Dunbar$(foreach key,$(ModuleSubDirKeys.builtins),\
3878cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar  $(if $(call strneq,,$($(key).OnlyConfigs)),,\
3978cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar    $(foreach arch,$($(key).OnlyArchs),\
4078cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar      $(call Append,ArchFunctions.$(arch),$(sort \
4178cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar        $(basename $($(key).ObjNames)))))))
4278cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
4378cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# Compute arch only functions.
4478cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar$(foreach arch,$(AvailableArchs),\
4578cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar  $(call Set,ArchFunctions.$(arch),$(sort $(ArchFunctions.$(arch))))\
4678cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar  $(call Set,ArchOnlyFunctions.$(arch),\
4778cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar    $(call set_difference,$(ArchFunctions.$(arch)),$(CommonFunctions))))
4878cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar
4978cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar# Compute lists of where each function is available.
5078cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar$(foreach key,$(SubDirKeys),\
5178cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar  $(foreach fn,$(basename $($(key).ObjNames)),\
5278cfbc57c62949e16fa7b4a69775aa6450343a00Daniel Dunbar    $(call Append,AvailableIn.$(fn),$(key))))
5348464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar
5448464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel Dunbar# The names of all the available options.
5548464e0ee1c2de5bcbf0d609348f55d0c301085dDaniel DunbarAvailableOptions := AR ARFLAGS \
568bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar                    CC CFLAGS LDFLAGS FUNCTIONS OPTIMIZED \
576a571fb3c515c5ea53308ba0eda750e8dd76ef6bDaniel Dunbar                    RANLIB RANLIBFLAGS \
588bc01cbd099b48d6c77d07e145d97104b43f4d38Daniel Dunbar                    VISIBILITY_HIDDEN KERNEL_USE \
59c0973d683aca4dad4cefbb23bb0134f01f804016Nick Kledzik                    SHARED_LIBRARY SHARED_LIBRARY_SUFFIX STRIP LIPO DSYMUTIL
60