1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00
alacritty/Makefile
Matthias Bussonnier 24533d2c5d Make the macOS bundle compatible osx 10.12
On macOS 10.12.6, running `make app` creates a bundle that refuses to
start (it complains application is only compatible with more recent
versions of macOS). The binary works great when running it directly.

To resolve this, the `MACOSX_DEPLOYMENT_TARGET` environment
variable is now set automatically from the makefile. This allows
building on macOS 10.12 and earlier, without negatively impacting the
later versions of macOS.
2018-10-03 01:38:03 +00:00

55 lines
1.6 KiB
Makefile

TARGET = alacritty
APP_NAME = Alacritty.app
ASSETS_DIR = assets
RELEASE_DIR = target/release
APP_TEMPLATE = $(ASSETS_DIR)/osx/$(APP_NAME)
APP_DIR = $(RELEASE_DIR)/osx
APP_BINARY = $(RELEASE_DIR)/$(TARGET)
APP_BINARY_DIR = $(APP_DIR)/$(APP_NAME)/Contents/MacOS
export MACOSX_DEPLOYMENT_TARGET = $(shell defaults read loginwindow SystemVersionStampAsString)
DMG_NAME = Alacritty.dmg
DMG_DIR = $(RELEASE_DIR)/osx
vpath $(TARGET) $(RELEASE_DIR)
vpath $(APP_NAME) $(APP_DIR)
vpath $(DMG_NAME) $(APP_DIR)
all: help
help: ## Prints help for targets with comments
@grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
binary: | $(TARGET) ## Build release binary with cargo
$(TARGET):
ifneq ( "${MACOSX_DEPLOYMENT_TARGET}" , "")
@echo MACOSX_DEPLOYMENT_TARGET=$${MACOSX_DEPLOYMENT_TARGET}
endif
cargo build --release
app: | $(APP_NAME) ## Clone Alacritty.app template and mount binary
$(APP_NAME): $(TARGET) $(APP_TEMPLATE)
@mkdir -p $(APP_BINARY_DIR)
@cp -fRp $(APP_TEMPLATE) $(APP_DIR)
@cp -fp $(APP_BINARY) $(APP_BINARY_DIR)
@echo "Created '$@' in '$(APP_DIR)'"
dmg: | $(DMG_NAME) ## Pack Alacritty.app into .dmg
$(DMG_NAME): $(APP_NAME)
@echo "Packing disk image..."
@hdiutil create $(DMG_DIR)/$(DMG_NAME) \
-volname "Alacritty" \
-fs HFS+ \
-srcfolder $(APP_DIR) \
-ov -format UDZO
@echo "Packed '$@' in '$(APP_DIR)'"
install: $(DMG_NAME) ## Mount disk image
@open $(DMG_DIR)/$(DMG_NAME)
.PHONY: app binary clean dmg install $(TARGET)
clean: ## Remove all artifacts
-rm -rf $(APP_DIR)