2021-10-06 11:42:43 +00:00
|
|
|
TARGET = lapce
|
|
|
|
|
2022-10-08 13:47:55 +00:00
|
|
|
CODESIGN_IDENTITY = FAC8FBEA99169DC1980731029648F110628D6A32
|
|
|
|
|
2021-10-06 11:42:43 +00:00
|
|
|
ASSETS_DIR = extra
|
2022-05-04 08:20:25 +00:00
|
|
|
RELEASE_DIR = target/release-lto
|
2021-10-06 11:42:43 +00:00
|
|
|
|
|
|
|
APP_NAME = Lapce.app
|
|
|
|
APP_TEMPLATE = $(ASSETS_DIR)/macos/$(APP_NAME)
|
|
|
|
APP_DIR = $(RELEASE_DIR)/macos
|
|
|
|
APP_BINARY = $(RELEASE_DIR)/$(TARGET)
|
|
|
|
APP_BINARY_DIR = $(APP_DIR)/$(APP_NAME)/Contents/MacOS
|
|
|
|
APP_EXTRAS_DIR = $(APP_DIR)/$(APP_NAME)/Contents/Resources
|
|
|
|
|
|
|
|
DMG_NAME = Lapce.dmg
|
|
|
|
DMG_DIR = $(RELEASE_DIR)/macos
|
|
|
|
|
|
|
|
vpath $(TARGET) $(RELEASE_DIR)
|
|
|
|
vpath $(APP_NAME) $(APP_DIR)
|
|
|
|
vpath $(DMG_NAME) $(APP_DIR)
|
|
|
|
|
|
|
|
all: help
|
|
|
|
|
|
|
|
help: ## Print this help message
|
|
|
|
@grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
binary: $(TARGET)-native ## Build a release binary
|
|
|
|
binary-universal: $(TARGET)-universal ## Build a universal release binary
|
|
|
|
$(TARGET)-native:
|
2022-04-20 17:23:27 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --profile release-lto
|
2022-05-04 09:09:13 +00:00
|
|
|
@lipo target/release-lto/$(TARGET) -create -output $(APP_BINARY)
|
2021-10-06 11:42:43 +00:00
|
|
|
$(TARGET)-universal:
|
2022-04-20 17:23:27 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --profile release-lto --target=x86_64-apple-darwin
|
|
|
|
MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --profile release-lto --target=aarch64-apple-darwin
|
2022-05-04 09:09:13 +00:00
|
|
|
@lipo target/{x86_64,aarch64}-apple-darwin/release-lto/$(TARGET) -create -output $(APP_BINARY)
|
2022-10-08 13:47:55 +00:00
|
|
|
/usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict --options=runtime --force -s $(CODESIGN_IDENTITY) $(APP_BINARY)
|
2021-10-06 11:42:43 +00:00
|
|
|
|
2022-01-05 06:56:32 +00:00
|
|
|
app: $(APP_NAME)-native ## Create a Lapce.app
|
2022-01-03 09:56:37 +00:00
|
|
|
app-universal: $(APP_NAME)-universal ## Create a universal Lapce.app
|
2021-10-06 11:42:43 +00:00
|
|
|
$(APP_NAME)-%: $(TARGET)-%
|
|
|
|
@mkdir -p $(APP_BINARY_DIR)
|
|
|
|
@mkdir -p $(APP_EXTRAS_DIR)
|
|
|
|
@cp -fRp $(APP_TEMPLATE) $(APP_DIR)
|
|
|
|
@cp -fp $(APP_BINARY) $(APP_BINARY_DIR)
|
|
|
|
@touch -r "$(APP_BINARY)" "$(APP_DIR)/$(APP_NAME)"
|
|
|
|
@echo "Created '$(APP_NAME)' in '$(APP_DIR)'"
|
2021-10-09 20:32:46 +00:00
|
|
|
xattr -c $(APP_DIR)/$(APP_NAME)/Contents/Info.plist
|
|
|
|
xattr -c $(APP_DIR)/$(APP_NAME)/Contents/Resources/lapce.icns
|
2022-10-08 13:47:55 +00:00
|
|
|
/usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict --options=runtime --force -s $(CODESIGN_IDENTITY) $(APP_DIR)/$(APP_NAME)
|
2021-10-06 11:42:43 +00:00
|
|
|
|
2022-01-05 06:56:32 +00:00
|
|
|
dmg: $(DMG_NAME)-native ## Create a Lapce.dmg
|
2022-01-03 09:56:37 +00:00
|
|
|
dmg-universal: $(DMG_NAME)-universal ## Create a universal Lapce.dmg
|
2021-10-06 11:42:43 +00:00
|
|
|
$(DMG_NAME)-%: $(APP_NAME)-%
|
|
|
|
@echo "Packing disk image..."
|
|
|
|
@ln -sf /Applications $(DMG_DIR)/Applications
|
|
|
|
@hdiutil create $(DMG_DIR)/$(DMG_NAME) \
|
|
|
|
-volname "Lapce" \
|
|
|
|
-fs HFS+ \
|
|
|
|
-srcfolder $(APP_DIR) \
|
|
|
|
-ov -format UDZO
|
|
|
|
@echo "Packed '$(APP_NAME)' in '$(APP_DIR)'"
|
2022-10-08 13:47:55 +00:00
|
|
|
/usr/bin/codesign -vvv --deep --entitlements $(ASSETS_DIR)/entitlements.plist --strict --options=runtime --force -s $(CODESIGN_IDENTITY) $(DMG_DIR)/$(DMG_NAME)
|
2021-10-06 11:42:43 +00:00
|
|
|
|
|
|
|
install: $(INSTALL)-native ## Mount disk image
|
|
|
|
install-universal: $(INSTALL)-native ## Mount universal disk image
|
|
|
|
$(INSTALL)-%: $(DMG_NAME)-%
|
|
|
|
@open $(DMG_DIR)/$(DMG_NAME)
|
|
|
|
|
|
|
|
.PHONY: app binary clean dmg install $(TARGET) $(TARGET)-universal
|
|
|
|
|
|
|
|
clean: ## Remove all build artifacts
|
2022-01-03 09:56:37 +00:00
|
|
|
@cargo clean
|