rules.mk 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. .PHONY: before-$(THEOS_CURRENT_INSTANCE)-all after-$(THEOS_CURRENT_INSTANCE)-all internal-$(_THEOS_CURRENT_TYPE)-all \
  2. before-$(THEOS_CURRENT_INSTANCE)-stage after-$(THEOS_CURRENT_INSTANCE)-stage internal-$(_THEOS_CURRENT_TYPE)-stage
  3. __ALL_FILES = $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,FILES) $($(THEOS_CURRENT_INSTANCE)_OBJCC_FILES) $($(THEOS_CURRENT_INSTANCE)_LOGOS_FILES) $($(THEOS_CURRENT_INSTANCE)_OBJC_FILES) $($(THEOS_CURRENT_INSTANCE)_CC_FILES) $($(THEOS_CURRENT_INSTANCE)_C_FILES)
  4. __ON_FILES = $(filter-out -%,$(__ALL_FILES))
  5. __OFF_FILES = $(patsubst -%,%,$(filter -%,$(__ALL_FILES)))
  6. _FILES = $(strip $(filter-out $(__OFF_FILES),$(__ON_FILES)))
  7. OBJ_FILES = $(strip $(patsubst %,%.$(_THEOS_OBJ_FILE_TAG).o,$(_FILES)))
  8. SWIFT_FILES = $(filter %.swift,$(_FILES))
  9. _OBJC_FILE_COUNT = $(words $(filter %.m %.mm %.x %.xm %.xi %.xmi,$(_FILES)))
  10. _OBJCC_FILE_COUNT = $(words $(filter %.mm %.xm %.xmi,$(_FILES)))
  11. _SWIFT_FILE_COUNT = $(words $(filter %.swift %.xswift,$(_FILES)))
  12. # This is := because it would otherwise be evaluated immediately afterwards.
  13. _SUBPROJECTS := $(strip $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,SUBPROJECTS))
  14. ifneq ($(_SUBPROJECTS),)
  15. SUBPROJECT_OBJ_FILES = $(foreach d, $(_SUBPROJECTS), $(THEOS_BUILD_DIR)/$(firstword $(subst :, ,$(d)))/$(THEOS_OBJ_DIR_NAME)/$(or $(word 2,$(subst :, ,$(d))),*).$(THEOS_SUBPROJECT_PRODUCT))
  16. #SUBPROJECT_OBJ_FILES = $(addsuffix /$(THEOS_OBJ_DIR_NAME)/$(THEOS_SUBPROJECT_PRODUCT), $(addprefix $(THEOS_BUILD_DIR)/,$($(THEOS_CURRENT_INSTANCE)_SUBPROJECTS)))
  17. SUBPROJECT_LDFLAGS = $(shell sort $(foreach d,$(_SUBPROJECTS),$(THEOS_BUILD_DIR)/$(firstword $(subst :, ,$(d)))/$(THEOS_OBJ_DIR_NAME)/$(or $(word 2,$(subst :, ,$(d))),*).ldflags) | uniq)
  18. _THEOS_INTERNAL_LDFLAGS += $(SUBPROJECT_LDFLAGS)
  19. endif
  20. OBJ_FILES_TO_LINK = $(strip $(addprefix $(THEOS_OBJ_DIR)/,$(OBJ_FILES)) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,OBJ_FILES) $(SUBPROJECT_OBJ_FILES))
  21. _OBJ_DIR_STAMPS = $(sort $(foreach o,$(filter $(THEOS_OBJ_DIR)%,$(OBJ_FILES_TO_LINK)),$(dir $o).stamp))
  22. ADDITIONAL_CPPFLAGS += $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,CPPFLAGS)
  23. # If we have any Objective-C objects, link Foundation and libobjc.
  24. ifneq ($(_OBJC_FILE_COUNT)$(_SWIFT_FILE_COUNT),00)
  25. _THEOS_INTERNAL_LDFLAGS += -lobjc -framework Foundation -framework CoreFoundation
  26. endif
  27. # In addition, if we have any Objective-C++, add the ObjC++ linker flags.
  28. ifneq ($(_OBJCC_FILE_COUNT),0)
  29. _THEOS_INTERNAL_LDFLAGS += -ObjC++ -fobjc-exceptions -fobjc-call-cxx-cdtors
  30. endif
  31. # If we have any Swift objects, add Swift libraries to the linker search path.
  32. # Also tell the linker to find these libraries in /usr/lib/libswift/<version>.
  33. ifneq ($(_SWIFT_FILE_COUNT),0)
  34. _THEOS_INTERNAL_LDFLAGS += -L$(_THEOS_TARGET_SWIFT_LDPATH) -rpath /usr/lib/libswift/$(_THEOS_TARGET_SWIFT_VERSION)
  35. endif
  36. # Add all frameworks from the type and instance.
  37. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$($(_THEOS_CURRENT_TYPE)_FRAMEWORKS),-framework $(framework))
  38. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,FRAMEWORKS),-framework $(framework))
  39. # Add all libraries from the type and instance.
  40. _THEOS_INTERNAL_LDFLAGS += $(foreach library,$($(_THEOS_CURRENT_TYPE)_LIBRARIES),-l$(library))
  41. _THEOS_INTERNAL_LDFLAGS += $(foreach library,$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,LIBRARIES),-l$(library))
  42. # Add all private frameworks from the type and instance, as well as -F for the private framework dir.
  43. ifneq ($(words $($(_THEOS_CURRENT_TYPE)_PRIVATE_FRAMEWORKS)$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,PRIVATE_FRAMEWORKS)),0)
  44. _THEOS_INTERNAL_OBJCFLAGS += -F$(TARGET_PRIVATE_FRAMEWORK_INCLUDE_PATH)
  45. _THEOS_INTERNAL_SWIFTFLAGS += -F$(TARGET_PRIVATE_FRAMEWORK_INCLUDE_PATH)
  46. _THEOS_INTERNAL_LDFLAGS += -F$(TARGET_PRIVATE_FRAMEWORK_PATH)
  47. endif
  48. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$($(_THEOS_CURRENT_TYPE)_PRIVATE_FRAMEWORKS),-framework $(framework))
  49. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,PRIVATE_FRAMEWORKS),-framework $(framework))
  50. # Add extra frameworks (ones in $THEOS/lib).
  51. ifneq ($(words $($(_THEOS_CURRENT_TYPE)_EXTRA_FRAMEWORKS)$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,EXTRA_FRAMEWORKS)),0)
  52. _THEOS_INTERNAL_OBJCFLAGS += -F$(THEOS)/lib
  53. _THEOS_INTERNAL_SWIFTFLAGS += -F$(THEOS)/lib
  54. _THEOS_INTERNAL_LDFLAGS += -F$(THEOS)/lib
  55. endif
  56. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$($(_THEOS_CURRENT_TYPE)_EXTRA_FRAMEWORKS),-framework $(framework))
  57. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,EXTRA_FRAMEWORKS),-framework $(framework))
  58. # Add weak frameworks.
  59. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$($(_THEOS_CURRENT_TYPE)_WEAK_FRAMEWORKS),-framework $(framework))
  60. _THEOS_INTERNAL_LDFLAGS += $(foreach framework,$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,WEAK_FRAMEWORKS),-weak_framework $(framework))
  61. # Add weak libraries.
  62. _THEOS_INTERNAL_LDFLAGS += $(foreach library,$($(_THEOS_CURRENT_TYPE)_WEAK_LIBRARIES),-weak_library$(library))
  63. _THEOS_INTERNAL_LDFLAGS += $(foreach library,$(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,WEAK_LIBRARIES),-weak_library$(library))
  64. ifneq ($($(THEOS_CURRENT_INSTANCE)_$(_THEOS_TARGET_NAME_DEFINE)_ARCHS),)
  65. TARGET_ARCHS = $($(THEOS_CURRENT_INSTANCE)_$(_THEOS_TARGET_NAME_DEFINE)_ARCHS)
  66. else
  67. ifneq ($($(_THEOS_TARGET_NAME_DEFINE)_ARCHS),)
  68. TARGET_ARCHS = $($(_THEOS_TARGET_NAME_DEFINE)_ARCHS)
  69. else
  70. ifneq ($($(THEOS_CURRENT_INSTANCE)_ARCHS),)
  71. TARGET_ARCHS = $($(THEOS_CURRENT_INSTANCE)_ARCHS)
  72. else
  73. TARGET_ARCHS = $(ARCHS)
  74. endif
  75. endif
  76. endif
  77. ifeq ($(_THEOS_PLATFORM_LIPO),)
  78. ALL_ARCHFLAGS = $(foreach ARCH,$(TARGET_ARCHS),-arch $(ARCH))
  79. PREPROCESS_ARCH_FLAGS = $(foreach ARCH,$(NEUTRAL_ARCH),-arch $(ARCH))
  80. THEOS_CURRENT_ARCH = $(TARGET_ARCHS)
  81. else
  82. ALL_ARCHFLAGS = -arch $(THEOS_CURRENT_ARCH)
  83. PREPROCESS_ARCH_FLAGS = $(ALL_ARCHFLAGS)
  84. endif
  85. ALL_PFLAGS = $(_THEOS_INTERNAL_CFLAGS) $(_THEOS_TARGET_CFLAGS) $(ADDITIONAL_CFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,CFLAGS) $(call __schema_var_all,,CFLAGS) $($(<)_CFLAGS) -DTHEOS_INSTANCE_NAME="\"$(THEOS_CURRENT_INSTANCE)\""
  86. ifneq ($(_THEOS_PLATFORM_LIPO),)
  87. ALL_PFLAGS += $($(THEOS_CURRENT_ARCH)_CFLAGS)
  88. _THEOS_INTERNAL_LDFLAGS += $($(THEOS_CURRENT_ARCH)_LDFLAGS)
  89. endif
  90. ALL_CFLAGS = $(ALL_PFLAGS) $(ALL_ARCHFLAGS)
  91. ALL_CCFLAGS = $(_THEOS_INTERNAL_CCFLAGS) $(ADDITIONAL_CCFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,CCFLAGS) $(call __schema_var_all,,CCFLAGS)
  92. ALL_OBJCFLAGS = $(_THEOS_INTERNAL_OBJCFLAGS) $(_THEOS_TARGET_OBJCFLAGS) $(ADDITIONAL_OBJCFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,OBJCFLAGS) $(call __schema_var_all,,OBJCFLAGS)
  93. ALL_OBJCCFLAGS = $(_THEOS_INTERNAL_OBJCCFLAGS) $(ADDITIONAL_OBJCCFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,OBJCCFLAGS) $(call __schema_var_all,,OBJCCFLAGS)
  94. ALL_SWIFTFLAGS = $(_THEOS_INTERNAL_SWIFTFLAGS) $(_THEOS_TARGET_SWIFTFLAGS) $(ADDITIONAL_SWIFTFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,OBJCCFLAGS) $(call __schema_var_all,,SWIFTFLAGS)
  95. ALL_LOGOSFLAGS = $(_THEOS_INTERNAL_LOGOSFLAGS) $(ADDITIONAL_LOGOSFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,LOGOSFLAGS) $(call __schema_var_all,,LOGOSFLAGS)
  96. ALL_LDFLAGS = $(_THEOS_INTERNAL_LDFLAGS) $(ADDITIONAL_LDFLAGS) $(_THEOS_TARGET_LDFLAGS) $(ALL_ARCHFLAGS) $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,LDFLAGS) $(call __schema_var_all,,LDFLAGS)
  97. ifneq ($(TARGET_CODESIGN),)
  98. _THEOS_CODESIGN_COMMANDLINE = CODESIGN_ALLOCATE=$(TARGET_CODESIGN_ALLOCATE) $(ECHO_UNBUFFERED) $(TARGET_CODESIGN) $(or $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,CODESIGN_FLAGS),$(TARGET_CODESIGN_FLAGS))
  99. else
  100. _THEOS_CODESIGN_COMMANDLINE =
  101. endif
  102. ALL_STRIP_FLAGS = $(or $(call __schema_var_all,$(THEOS_CURRENT_INSTANCE)_,STRIP_FLAGS),$(TARGET_STRIP_FLAGS))
  103. _THEOS_OBJ_FILE_TAG = $(call __simplify,_THEOS_OBJ_FILE_TAG,$(shell echo "$(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $(ALL_LOGOSFLAGS)" | $(_THEOS_PLATFORM_MD5SUM) | cut -c1-8))
  104. _THEOS_OUT_FILE_TAG = $(call __simplify,_THEOS_OUT_FILE_TAG,$(shell echo "$(ALL_STRIP_FLAGS) $(_THEOS_CODESIGN_COMMANDLINE)" | $(_THEOS_PLATFORM_MD5SUM) | cut -c1-8))
  105. _THEOS_USE_MAKEDEPS := $(_THEOS_FALSE)
  106. ifeq ($(call __theos_bool,$(USE_MAKEDEPS)),$(_THEOS_TRUE))
  107. _THEOS_USE_MAKEDEPS := $(_THEOS_TRUE)
  108. endif
  109. ifneq ($(_THEOS_MAKE_PARALLEL_BUILDING)$(_THEOS_MAKE_PARALLEL),yesyes)
  110. ifneq ($(_THEOS_MAKE_PARALLEL_BUILDING),no)
  111. override _THEOS_OBJ_FILE_TAG := dummy
  112. _THEOS_USE_MAKEDEPS := $(_THEOS_FALSE)
  113. endif
  114. endif
  115. ifeq ($(_THEOS_USE_MAKEDEPS),$(_THEOS_TRUE))
  116. MAKEDEP_FILES = $(addprefix $(THEOS_OBJ_DIR)/,$(strip $(patsubst %,%.$(_THEOS_OBJ_FILE_TAG).md,$(_FILES))))
  117. -include $(MAKEDEP_FILES)
  118. endif
  119. before-$(THEOS_CURRENT_INSTANCE)-all after-$(THEOS_CURRENT_INSTANCE)-all::
  120. @for i in $(_FILES); do \
  121. if [ ! -f "$$i" ]; then \
  122. $(PRINT_FORMAT_ERROR) "File $$i does not exist." 2>&1; \
  123. exit 1; \
  124. fi; \
  125. done
  126. internal-$(_THEOS_CURRENT_TYPE)-all:: before-$(THEOS_CURRENT_INSTANCE)-all internal-$(_THEOS_CURRENT_TYPE)-all_ after-$(THEOS_CURRENT_INSTANCE)-all
  127. @:
  128. before-$(THEOS_CURRENT_INSTANCE)-stage after-$(THEOS_CURRENT_INSTANCE)-stage::
  129. @:
  130. internal-$(_THEOS_CURRENT_TYPE)-stage:: before-$(THEOS_CURRENT_INSTANCE)-stage internal-$(_THEOS_CURRENT_TYPE)-stage_ after-$(THEOS_CURRENT_INSTANCE)-stage
  131. @:
  132. .SUFFIXES:
  133. .SUFFIXES: .m .mm .c .cc .cpp .xm
  134. MDFLAGS = -MP -MT "$@ $(subst .md,.o,$@)" -MM
  135. $(THEOS_OBJ_DIR)/%.m.$(_THEOS_OBJ_FILE_TAG).o: %.m
  136. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  137. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) $< -o $@$(ECHO_END)
  138. $(THEOS_OBJ_DIR)/%.m.$(_THEOS_OBJ_FILE_TAG).md: %.m
  139. ifneq ($(THEOS_CURRENT_ARCH),)
  140. $(ECHO_NOTHING)$(TARGET_CXX) -x objective-c -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  141. endif
  142. $(THEOS_OBJ_DIR)/%.mi.$(_THEOS_OBJ_FILE_TAG).o: %.mi
  143. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  144. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c-cpp-output -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) $< -o $@$(ECHO_END)
  145. $(THEOS_OBJ_DIR)/%.mm.$(_THEOS_OBJ_FILE_TAG).o: %.mm
  146. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  147. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $< -o $@$(ECHO_END)
  148. $(THEOS_OBJ_DIR)/%.mm.$(_THEOS_OBJ_FILE_TAG).md: %.mm
  149. ifneq ($(THEOS_CURRENT_ARCH),)
  150. $(ECHO_NOTHING)$(TARGET_CXX) -x objective-c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  151. endif
  152. $(THEOS_OBJ_DIR)/%.mii.$(_THEOS_OBJ_FILE_TAG).o: %.mii
  153. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  154. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c++-cpp-output -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) $< -o $@$(ECHO_END)
  155. $(THEOS_OBJ_DIR)/%.c.$(_THEOS_OBJ_FILE_TAG).o: %.c
  156. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  157. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< -o $@$(ECHO_END)
  158. $(THEOS_OBJ_DIR)/%.c.$(_THEOS_OBJ_FILE_TAG).md: %.c
  159. ifneq ($(THEOS_CURRENT_ARCH),)
  160. $(ECHO_NOTHING)$(TARGET_CXX) -x c -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  161. endif
  162. $(THEOS_OBJ_DIR)/%.i.$(_THEOS_OBJ_FILE_TAG).o: %.i
  163. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  164. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c-cpp-output -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< -o $@$(ECHO_END)
  165. $(THEOS_OBJ_DIR)/%.s.$(_THEOS_OBJ_FILE_TAG).o: %.s
  166. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  167. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x assembler -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< -o $@$(ECHO_END)
  168. $(THEOS_OBJ_DIR)/%.S.$(_THEOS_OBJ_FILE_TAG).o: %.S
  169. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  170. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x assembler-with-cpp -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< -o $@$(ECHO_END)
  171. $(THEOS_OBJ_DIR)/%.S.$(_THEOS_OBJ_FILE_TAG).md: %.S
  172. ifneq ($(THEOS_CURRENT_ARCH),)
  173. $(ECHO_NOTHING)$(TARGET_CXX) -x assembler-with-cpp -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  174. endif
  175. $(THEOS_OBJ_DIR)/%.cc.$(_THEOS_OBJ_FILE_TAG).o: %.cc
  176. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  177. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
  178. $(THEOS_OBJ_DIR)/%.cc.$(_THEOS_OBJ_FILE_TAG).md: %.cc
  179. ifneq ($(THEOS_CURRENT_ARCH),)
  180. $(ECHO_NOTHING)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  181. endif
  182. $(THEOS_OBJ_DIR)/%.cp.$(_THEOS_OBJ_FILE_TAG).o: %.cp
  183. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  184. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
  185. $(THEOS_OBJ_DIR)/%.cp.$(_THEOS_OBJ_FILE_TAG).md: %.cp
  186. ifneq ($(THEOS_CURRENT_ARCH),)
  187. $(ECHO_NOTHING)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  188. endif
  189. $(THEOS_OBJ_DIR)/%.cxx.$(_THEOS_OBJ_FILE_TAG).o: %.cxx
  190. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  191. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
  192. $(THEOS_OBJ_DIR)/%.cxx.$(_THEOS_OBJ_FILE_TAG).md: %.cxx
  193. ifneq ($(THEOS_CURRENT_ARCH),)
  194. $(ECHO_NOTHING)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  195. endif
  196. $(THEOS_OBJ_DIR)/%.cpp.$(_THEOS_OBJ_FILE_TAG).o: %.cpp
  197. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  198. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
  199. $(THEOS_OBJ_DIR)/%.cpp.$(_THEOS_OBJ_FILE_TAG).md: %.cpp
  200. ifneq ($(THEOS_CURRENT_ARCH),)
  201. $(ECHO_NOTHING)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  202. endif
  203. $(THEOS_OBJ_DIR)/%.c++.$(_THEOS_OBJ_FILE_TAG).o: %.c++
  204. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  205. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< -o $@$(ECHO_END)
  206. $(THEOS_OBJ_DIR)/%.c++.$(_THEOS_OBJ_FILE_TAG).md: %.c++
  207. ifneq ($(THEOS_CURRENT_ARCH),)
  208. $(ECHO_NOTHING)$(TARGET_CXX) -x c++ -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_CCFLAGS) $< $(MDFLAGS) -o $@$(ECHO_END)
  209. endif
  210. $(THEOS_OBJ_DIR)/%.ii.$(_THEOS_OBJ_FILE_TAG).o: %.ii
  211. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  212. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x c++-cpp-output -c $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $< -o $@$(ECHO_END)
  213. $(THEOS_OBJ_DIR)/%.swift.$(_THEOS_OBJ_FILE_TAG).o: %.swift
  214. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  215. $(ECHO_COMPILING)$(TARGET_SWIFT) -frontend -emit-object -c $(ALL_SWIFTFLAGS) -target $(THEOS_CURRENT_ARCH)-$(_THEOS_TARGET_SWIFT_TARGET) -primary-file $< $(SWIFT_FILES) -o $@$(ECHO_END)
  216. $(THEOS_OBJ_DIR)/%.x.$(_THEOS_OBJ_FILE_TAG).o: %.x
  217. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  218. $(ECHO_PREPROCESSING)$(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $< > $(THEOS_OBJ_DIR)/$<.m$(ECHO_END)
  219. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c -c -I"$(call __clean_pwd,$(dir $<))" $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) $(THEOS_OBJ_DIR)/$<.m -o $@$(ECHO_END)
  220. $(ECHO_NOTHING)rm $(THEOS_OBJ_DIR)/$<.m$(ECHO_END)
  221. $(THEOS_OBJ_DIR)/%.xm.$(_THEOS_OBJ_FILE_TAG).o: %.xm
  222. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  223. $(ECHO_PREPROCESSING)$(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $< > $(THEOS_OBJ_DIR)/$<.mm$(ECHO_END)
  224. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c++ -c -I"$(call __clean_pwd,$(dir $<))" $(_THEOS_INTERNAL_IFLAGS) $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $(THEOS_OBJ_DIR)/$<.mm -o $@$(ECHO_END)
  225. $(ECHO_NOTHING)rm $(THEOS_OBJ_DIR)/$<.mm$(ECHO_END)
  226. $(THEOS_OBJ_DIR)/%.xi.$(_THEOS_OBJ_FILE_TAG).o: %.xi
  227. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  228. $(ECHO_PREPROCESSING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c -E -I"$(call __clean_pwd,$(dir $<))" $(_THEOS_INTERNAL_IFLAGS) $(ALL_PFLAGS) $(PREPROCESS_ARCH_FLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) -include substrate.h $< > $(THEOS_OBJ_DIR)/$<.pre && $(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $(THEOS_OBJ_DIR)/$<.pre > $(THEOS_OBJ_DIR)/$<.mi $(ECHO_END)
  229. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c -c $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(_THEOS_TARGET_ONLY_OBJCFLAGS) $(THEOS_OBJ_DIR)/$<.mi -o $@$(ECHO_END)
  230. $(ECHO_NOTHING)rm $(THEOS_OBJ_DIR)/$<.pre $(THEOS_OBJ_DIR)/$<.mi$(ECHO_END)
  231. $(THEOS_OBJ_DIR)/%.xmi.$(_THEOS_OBJ_FILE_TAG).o: %.xmi
  232. $(ECHO_NOTHING)mkdir -p $(dir $@)$(ECHO_END)
  233. $(ECHO_PREPROCESSING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c++ -E -I"$(call __clean_pwd,$(dir $<))" $(_THEOS_INTERNAL_IFLAGS) $(ALL_PFLAGS) $(PREPROCESS_ARCH_FLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) -include substrate.h $< > $(THEOS_OBJ_DIR)/$<.pre && $(THEOS_BIN_PATH)/logos.pl $(ALL_LOGOSFLAGS) $(THEOS_OBJ_DIR)/$<.pre > $(THEOS_OBJ_DIR)/$<.mii $(ECHO_END)
  234. $(ECHO_COMPILING)$(ECHO_UNBUFFERED)$(TARGET_CXX) -x objective-c++ -c $(ALL_CFLAGS) $(ALL_OBJCFLAGS) $(ALL_CCFLAGS) $(ALL_OBJCCFLAGS) $(THEOS_OBJ_DIR)/$<.mii -o $@$(ECHO_END)
  235. $(ECHO_NOTHING)rm $(THEOS_OBJ_DIR)/$<.pre $(THEOS_OBJ_DIR)/$<.mii$(ECHO_END)
  236. define _THEOS_TEMPLATE_DEFAULT_LINKING_RULE
  237. ifeq ($(_THEOS_PLATFORM_LIPO),)
  238. ifneq ($$(TARGET_CODESIGN),)
  239. .INTERMEDIATE: $$(THEOS_OBJ_DIR)/$(1).$(_THEOS_OUT_FILE_TAG).unsigned
  240. $$(THEOS_OBJ_DIR)/$(1): $$(THEOS_OBJ_DIR)/$(1).$(_THEOS_OUT_FILE_TAG).unsigned
  241. $$(ECHO_SIGNING)$$(_THEOS_CODESIGN_COMMANDLINE) "$$<" && mv "$$<" "$$@"$$(ECHO_END)
  242. $$(THEOS_OBJ_DIR)/$(1).$(_THEOS_OUT_FILE_TAG).unsigned: $$(OBJ_FILES_TO_LINK)
  243. else
  244. $$(THEOS_OBJ_DIR)/$(1): $$(OBJ_FILES_TO_LINK)
  245. endif
  246. ifneq ($(2),nowarn)
  247. ifeq ($$(OBJ_FILES_TO_LINK),)
  248. $$(WARNING_EMPTY_LINKING)
  249. endif
  250. endif
  251. $$(ECHO_LINKING)$$(ECHO_UNBUFFERED)$$(TARGET_LD) $$(ALL_LDFLAGS) -o "$$@" $$^ | (grep -v 'usr/lib/dylib1.o, missing required architecture' || true)$$(ECHO_END)
  252. ifeq ($(SHOULD_STRIP),$(_THEOS_TRUE))
  253. $$(ECHO_STRIPPING)$$(ECHO_UNBUFFERED)$$(TARGET_STRIP) $$(ALL_STRIP_FLAGS) "$$@"$$(ECHO_END)
  254. endif
  255. else
  256. ifeq ($(THEOS_CURRENT_ARCH),)
  257. ARCH_FILES_TO_LINK := $(addsuffix /$(1),$(addprefix $(THEOS_OBJ_DIR)/,$(TARGET_ARCHS)))
  258. $$(THEOS_OBJ_DIR)/%/$(1): $(__ALL_FILES)
  259. @ \
  260. mkdir -p $(THEOS_OBJ_DIR)/$$*; \
  261. $(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) --no-print-directory --no-keep-going \
  262. internal-$(_THEOS_CURRENT_TYPE)-$(_THEOS_CURRENT_OPERATION) \
  263. _THEOS_CURRENT_TYPE="$(_THEOS_CURRENT_TYPE)" \
  264. THEOS_CURRENT_INSTANCE="$(THEOS_CURRENT_INSTANCE)" \
  265. _THEOS_CURRENT_OPERATION="$(_THEOS_CURRENT_OPERATION)" \
  266. THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" \
  267. THEOS_CURRENT_ARCH="$$*"
  268. ifneq ($$(TARGET_CODESIGN),)
  269. .INTERMEDIATE: $$(THEOS_OBJ_DIR)/$(1).$(_THEOS_OUT_FILE_TAG).unsigned
  270. $(THEOS_OBJ_DIR)/$(1): $$(THEOS_OBJ_DIR)/$(1).$(_THEOS_OUT_FILE_TAG).unsigned
  271. $$(ECHO_SIGNING)$$(_THEOS_CODESIGN_COMMANDLINE) "$$<" && mv "$$<" "$$@"$$(ECHO_END)
  272. $(THEOS_OBJ_DIR)/$(1).$(_THEOS_OUT_FILE_TAG).unsigned: $$(ARCH_FILES_TO_LINK)
  273. else
  274. $(THEOS_OBJ_DIR)/$(1): $$(ARCH_FILES_TO_LINK)
  275. endif
  276. $(ECHO_MERGING)$(ECHO_UNBUFFERED)$(_THEOS_PLATFORM_LIPO) $(foreach ARCH,$(TARGET_ARCHS),-arch $(ARCH) $(THEOS_OBJ_DIR)/$(ARCH)/$(1)) -create -output "$$@"$(ECHO_END)
  277. else
  278. $$(THEOS_OBJ_DIR)/$(1): $$(OBJ_FILES_TO_LINK)
  279. ifneq ($(2),nowarn)
  280. ifeq ($$(OBJ_FILES_TO_LINK),)
  281. $$(WARNING_EMPTY_LINKING)
  282. endif
  283. endif
  284. $$(ECHO_NOTHING)mkdir -p $(shell dirname "$(THEOS_OBJ_DIR)/$(1)")$$(ECHO_END)
  285. $$(ECHO_LINKING)$$(ECHO_UNBUFFERED)$$(TARGET_LD) $$(ALL_LDFLAGS) -o "$$@" $$^ | (grep -v 'usr/lib/dylib1.o, missing required architecture' || true)$$(ECHO_END)
  286. ifeq ($$(findstring DEBUG,$$(THEOS_SCHEMA)),)
  287. $$(ECHO_STRIPPING)$$(ECHO_UNBUFFERED)$$(TARGET_STRIP) $$(ALL_STRIP_FLAGS) "$$@"$$(ECHO_END)
  288. endif
  289. endif
  290. endif
  291. endef
  292. $(eval $(call __mod,instance/rules.mk))