diff --git a/ion/src/simulator/ios/Makefile b/ion/src/simulator/ios/Makefile index 876963d03..58dea89ba 100644 --- a/ion/src/simulator/ios/Makefile +++ b/ion/src/simulator/ios/Makefile @@ -35,7 +35,7 @@ SIMULATOR_ICONSET = $(SIMULATOR_ASSETS_PATH)/AppIcon.appiconset include ion/src/simulator/shared/apple/Makefile -$(call simulator_app_plist,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,Assets.car) +$(call simulator_app_plist,%,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,%,Assets.car) $(call rule_label,PLUTIL) $(Q) cp $< $@ $(Q) plutil -insert "BuildMachineOSBuild" -string "$(IOS_BUILD_MACHINE_OS_BUILD)" $@ @@ -54,22 +54,23 @@ $(call simulator_app_plist,Info.plist): ion/src/simulator/ios/Info.plist $(call $(Q) plutil -replace CFBundleIcons -json `plutil -extract CFBundleIcons json -o - $(BUILD_DIR)/app/assets/partial.plist` $@ $(Q) plutil -replace CFBundleIcons~ipad -json `plutil -extract CFBundleIcons~ipad json -o - $(BUILD_DIR)/app/assets/partial.plist` $@ -$(call simulator_app_resource,launch.storyboardc): ion/src/simulator/ios/launch.storyboard | $$(@D)/. +$(call simulator_app_resource,%,launch.storyboardc): ion/src/simulator/ios/launch.storyboard | $$(@D)/. $(call rule_label,IBTOOL) $(Q) $(IBTOOL) --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --compile $@ $^ ifdef IOS_PROVISIONNING_PROFILE -$(call simulator_app_resource,embedded.mobileprovision): $(IOS_PROVISIONNING_PROFILE) | $$(@D)/. +$(call simulator_app_resource,%,embedded.mobileprovision): $(IOS_PROVISIONNING_PROFILE) | $$(@D)/. $(call rule_label,COPY) $(Q) cp $^ $@ -$(BUILD_DIR)/app/entitlements.plist: $(call simulator_app_resource,embedded.mobileprovision) +$(BUILD_DIR)/app/entitlements.plist: $(IOS_PROVISIONNING_PROFILE) $(call rule_label,SCMS) $(Q) security cms -D -i $(IOS_PROVISIONNING_PROFILE) | plutil -extract Entitlements xml1 - -o $@ -SIMULATOR_APP_DEPS += $(BUILD_DIR)/app/entitlements.plist +simulator_app_deps += $(BUILD_DIR)/app/entitlements.plist +simulator_app_deps += $(call simulator_app_resource,$1,embedded.mobileprovision) else -$(call simulator_app_resource,embedded.mobileprovision): +$(call simulator_app_resource,%,embedded.mobileprovision): $(warning Building without a provisionning profile. Please define IOS_PROVISIONNING_PROFILE to point to the .mobileprovision file you want to use.) endif @@ -77,19 +78,19 @@ $(SIMULATOR_ICONSET)/Contents.json: ion/src/simulator/ios/icon_assets.json $(SIM $(call rule_label,COPY) $(Q) cp $< $@ -$(call simulator_app_resource,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | $$(@D)/. +$(call simulator_app_resource,%,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | $$(@D)/. $(call rule_label,ACTOOL) - $(Q) $(ACTOOL) --compile $(BUILD_DIR)/app/Payload/Epsilon.app --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --platform $(APPLE_SDK) --app-icon AppIcon --output-partial-info-plist $(BUILD_DIR)/app/assets/partial.plist $(SIMULATOR_ASSETS_PATH) > /dev/null + $(Q) $(ACTOOL) --compile $(BUILD_DIR)/app/Payload/$*.app --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --platform $(APPLE_SDK) --app-icon AppIcon --output-partial-info-plist $(BUILD_DIR)/app/assets/partial.plist $(SIMULATOR_ASSETS_PATH) > /dev/null -SIMULATOR_APP_DEPS += $(call simulator_app_resource,\ +simulator_app_deps += $(call simulator_app_resource,$(1), \ Assets.car \ launch.storyboardc \ ) -$(BUILD_DIR)/app/epsilon.ipa: $(SIMULATOR_APP_DEPS) +$(BUILD_DIR)/app/epsilon%ipa: $(subst ..,.,$(call simulator_app_deps,Epsilon$*)) ifdef IOS_PROVISIONNING_PROFILE $(call rule_label,SIGN) - $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon.app + $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon$*app endif $(call rule_label,ZIP) $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) Payload @@ -99,7 +100,7 @@ DEFAULT := $(BUILD_DIR)/app/epsilon.ipa endif ifeq ($(APPLE_PLATFORM),ios-simulator) -.PHONY: epsilon_run -epsilon_run: $(SIMULATOR_APP_DEPS) - xcrun simctl install booted $(BUILD_DIR)/app/Payload/Epsilon.app +.PHONY: epsilon%run +epsilon%run: $(subst _.,.,$(call simulator_app_deps,Epsilon$*)) + xcrun simctl install booted $(BUILD_DIR)/app/Payload/Epsilon$(subst _,.,$*)app endif diff --git a/ion/src/simulator/macos/Makefile b/ion/src/simulator/macos/Makefile index ae25b03f3..0f27650df 100644 --- a/ion/src/simulator/macos/Makefile +++ b/ion/src/simulator/macos/Makefile @@ -22,7 +22,7 @@ SIMULATOR_ICONSET = $(BUILD_DIR)/app/assets/app.iconset include ion/src/simulator/shared/apple/Makefile -$(call simulator_app_plist,Info.plist): ion/src/simulator/macos/Info.plist +$(call simulator_app_plist,%,Info.plist): ion/src/simulator/macos/Info.plist $(call rule_label,PLUTIL) $(Q) cp $< $@ $(Q) plutil -insert "LSMinimumSystemVersion" -string "$(MACOS_MIN_VERSION)" $@ @@ -31,12 +31,21 @@ $(call simulator_app_plist,Info.plist): ion/src/simulator/macos/Info.plist # macOS uses icns files -$(call simulator_app_resource,app.icns): $(SIMULATOR_ICONS) | $$(@D)/. +.SECONDARY: $(SIMULATOR_ICONS) | $$(@D)/. + +$(call simulator_app_resource,%,app.icns): $(SIMULATOR_ICONS) | $$(@D)/. $(call rule_label,ICNUTIL) $(Q) iconutil --convert icns --output $@ $(SIMULATOR_ICONSET) -SIMULATOR_APP_DEPS += $(call simulator_app_resource,app.icns) +simulator_app_deps += $(call simulator_app_resource,$(1),app.icns) + +simulator_app_deps_unofficial = $(call simulator_app_deps,Epsilon) +simulator_app_deps_official = $(call simulator_app_deps,Epsilon.official) + +.PHONY: Epsilon.app Epsilon.official.app +Epsilon.app: $(simulator_app_deps_unofficial) +Epsilon.official.app: $(simulator_app_deps_official) ifndef ARCH -DEFAULT := $(SIMULATOR_APP_DEPS) +DEFAULT := Epsilon.app endif diff --git a/ion/src/simulator/shared/apple/Makefile b/ion/src/simulator/shared/apple/Makefile index f5b1c77fe..22faf47d7 100644 --- a/ion/src/simulator/shared/apple/Makefile +++ b/ion/src/simulator/shared/apple/Makefile @@ -2,27 +2,37 @@ # The only things that have to be customized per platform are the icons and the # Info.plist. -SIMULATOR_APP_PATH = $(BUILD_DIR)/app/Payload/Epsilon.app +SIMULATOR_APP_PATH = $(BUILD_DIR)/app/Payload -simulator_app_binary = $(addprefix $(SIMULATOR_APP_PATH)/$(SIMULATOR_APP_BINARY_PATH),$(1)) -simulator_app_resource = $(addprefix $(SIMULATOR_APP_PATH)/$(SIMULATOR_APP_RESOURCE_PATH),$(1)) -simulator_app_plist = $(addprefix $(SIMULATOR_APP_PATH)/$(SIMULATOR_APP_PLIST_PATH),$(1)) +simulator_app_binary = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_BINARY_PATH),$(2)) +simulator_app_resource = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_RESOURCE_PATH),$(2)) +simulator_app_plist = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_PLIST_PATH),$(2)) # Epsilon binary .PHONY: force_remake -$(BUILD_DIR)/%/epsilon.bin: force_remake - $(Q) echo "MAKE ARCH=$*" - $(Q) $(MAKE) ARCH=$* +define rule_for_epsilon +$$(BUILD_DIR)/%/$(1): force_remake + $(Q) echo "MAKE ARCH=$$*" + $(Q) $$(MAKE) ARCH=$$* $(1) +endef -$(call simulator_app_binary,Epsilon): $(patsubst %,$(BUILD_DIR)/%/epsilon.bin,$(ARCHS)) | $$(@D)/. - $(call rule_label,LIPO) - $(Q) $(LIPO) -create $^ -output $@ +$(eval $(call rule_for_epsilon,epsilon.bin)) +$(eval $(call rule_for_epsilon,epsilon.official.bin)) + +define rule_for_lipo +$$(call simulator_app_binary,$1,Epsilon): $$(patsubst %,$(BUILD_DIR)/%/$2.bin,$$(ARCHS)) | $$$$(@D)/. + $$(call rule_label,LIPO) + $(Q) $$(LIPO) -create $$^ -output $$@ +endef + +$(eval $(call rule_for_lipo,Epsilon,epsilon)) +$(eval $(call rule_for_lipo,Epsilon.official,epsilon.official)) # Background image -$(call simulator_app_resource,background.jpg): ion/src/simulator/assets/background.jpg | $$(@D)/. +$(call simulator_app_resource,%,background.jpg): ion/src/simulator/assets/background.jpg | $$(@D)/. $(call rule_label,COPY) $(Q) cp $^ $@ @@ -44,6 +54,6 @@ $(addprefix $(SIMULATOR_ICONSET)/,icon_%.png): ion/src/simulator/assets/logo.svg # Export simulator app dependencies -SIMULATOR_APP_DEPS += $(call simulator_app_binary,Epsilon) -SIMULATOR_APP_DEPS += $(call simulator_app_plist,Info.plist) -SIMULATOR_APP_DEPS += $(call simulator_app_resource,background.jpg) +simulator_app_deps += $(call simulator_app_binary,$(1),Epsilon) +simulator_app_deps += $(call simulator_app_plist,$(1),Info.plist) +simulator_app_deps += $(call simulator_app_resource,$(1),background.jpg)