From f9b08435789319e6a02339b668e96e46d0eb974d Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Thu, 2 Apr 2020 22:24:55 -0400 Subject: [PATCH] [build/simulator/apple] Share code --- ion/src/simulator/ios/Makefile | 16 ++-------------- ion/src/simulator/macos/Makefile | 11 ++--------- .../shared/apple/{app.mak => helpers.mak} | 10 ---------- ion/src/simulator/shared/apple/targets.mak | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 33 deletions(-) rename ion/src/simulator/shared/apple/{app.mak => helpers.mak} (83%) create mode 100644 ion/src/simulator/shared/apple/targets.mak diff --git a/ion/src/simulator/ios/Makefile b/ion/src/simulator/ios/Makefile index 64b254df4..a8b0c36d6 100644 --- a/ion/src/simulator/ios/Makefile +++ b/ion/src/simulator/ios/Makefile @@ -35,7 +35,7 @@ SIMULATOR_ICON_SIZES = 20x20 29x29 40x40 40x40 40x40 58x58 58x58 60x60 76x76 \ SIMULATOR_ASSETS_PATH = $(BUILD_DIR)/app/assets/Assets.xcassets SIMULATOR_ICONSET = $(SIMULATOR_ASSETS_PATH)/AppIcon.appiconset -include ion/src/simulator/shared/apple/app.mak +include ion/src/simulator/shared/apple/helpers.mak $(call simulator_app_plist,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,Assets.car) $(call rule_label,PLUTIL) @@ -87,19 +87,7 @@ $(call simulator_app_resource,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | simulator_app_deps += $(call simulator_app_resource,Assets.car) simulator_app_deps += $(call simulator_app_resource,launch.storyboardc) -.PRECIOUS: $(simulator_app_deps) - -.PRECIOUS: $(BUILD_DIR)/%.app -.PHONY: $(BUILD_DIR)/%.app -$(BUILD_DIR)/%.app: $(simulator_app_deps) - -$(BUILD_DIR)/%.ipa: $(BUILD_DIR)/%.app -ifdef IOS_PROVISIONNING_PROFILE - $(call rule_label,SIGN) - $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/$*.app -endif - $(call rule_label,ZIP) - $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) $*.app +include ion/src/simulator/shared/apple/targets.mak DEFAULT = epsilon.ipa diff --git a/ion/src/simulator/macos/Makefile b/ion/src/simulator/macos/Makefile index 4c6cb4900..3992f08fa 100644 --- a/ion/src/simulator/macos/Makefile +++ b/ion/src/simulator/macos/Makefile @@ -22,7 +22,7 @@ SIMULATOR_APP_RESOURCE_PATH = Contents/Resources/ SIMULATOR_APP_PLIST_PATH = Contents/ SIMULATOR_ICONSET = $(BUILD_DIR)/app/assets/app.iconset -include ion/src/simulator/shared/apple/app.mak +include ion/src/simulator/shared/apple/helpers.mak $(call simulator_app_plist,Info.plist): ion/src/simulator/macos/Info.plist | $$(@D)/. $(call rule_label,PLUTIL) @@ -41,14 +41,7 @@ $(call simulator_app_resource,app.icns): $(SIMULATOR_ICONS) | $$(@D)/. simulator_app_deps += $(call simulator_app_resource,app.icns) -.PRECIOUS: $(simulator_app_deps) - -$(BUILD_DIR)/%.app: $(simulator_app_deps) - $(Q) echo "DONE" - -#.PHONY: Epsilon.app Epsilon.official.app -#Epsilon.app: $(simulator_app_deps_unofficial) -#Epsilon.official.app: $(simulator_app_deps_official) +include ion/src/simulator/shared/apple/targets.mak DEFAULT = epsilon.app diff --git a/ion/src/simulator/shared/apple/app.mak b/ion/src/simulator/shared/apple/helpers.mak similarity index 83% rename from ion/src/simulator/shared/apple/app.mak rename to ion/src/simulator/shared/apple/helpers.mak index 062862496..dbbf8fc17 100644 --- a/ion/src/simulator/shared/apple/app.mak +++ b/ion/src/simulator/shared/apple/helpers.mak @@ -10,16 +10,6 @@ simulator_app_plist = $(SIMULATOR_APP_PATH)/%.app/$(SIMULATOR_APP_PLIST_PATH)$(1 # Epsilon binary -.PHONY: force_remake -define rule_for_arch_executable -.PRECIOUS: $$(BUILD_DIR)/$(1)/%.bin -$$(BUILD_DIR)/$(1)/%.bin: force_remake - $(Q) echo "MAKE ARCH=$(1)" - $(Q) $$(MAKE) ARCH=$(1) --silent $$*.bin -endef - -$(foreach ARCH,$(ARCHS),$(eval $(call rule_for_arch_executable,$(ARCH)))) - $(simulator_app_binary): $(foreach arch,$(ARCHS),$(BUILD_DIR)/$(arch)/%.bin) | $$(@D)/. $(call rule_label,LIPO) $(Q) $(LIPO) -create $^ -output $@ diff --git a/ion/src/simulator/shared/apple/targets.mak b/ion/src/simulator/shared/apple/targets.mak new file mode 100644 index 000000000..0245e6fb6 --- /dev/null +++ b/ion/src/simulator/shared/apple/targets.mak @@ -0,0 +1,16 @@ +.PRECIOUS: $(simulator_app_deps) + +# CAUTION: The empty line in this rule is important! +# Indeed, rule without receipe serve a special purpose +# https://www.gnu.org/software/make/manual/html_node/Canceling-Rules.html +.PRECIOUS: $(BUILD_DIR)/%.app +$(BUILD_DIR)/%.app: $(simulator_app_deps) + + +$(BUILD_DIR)/%.ipa: $(BUILD_DIR)/%.app +ifdef IOS_PROVISIONNING_PROFILE + $(call rule_label,SIGN) + $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/$*.app +endif + $(call rule_label,ZIP) + $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) $*.app