Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. TARGET = alacritty
  2. ASSETS_DIR = extra
  3. RELEASE_DIR = target/release
  4. MANPAGE = $(ASSETS_DIR)/alacritty.man
  5. TERMINFO = $(ASSETS_DIR)/alacritty.info
  6. COMPLETIONS_DIR = $(ASSETS_DIR)/completions
  7. COMPLETIONS = $(COMPLETIONS_DIR)/_alacritty \
  8. $(COMPLETIONS_DIR)/alacritty.bash \
  9. $(COMPLETIONS_DIR)/alacritty.fish
  10. APP_NAME = Alacritty.app
  11. APP_TEMPLATE = $(ASSETS_DIR)/osx/$(APP_NAME)
  12. APP_DIR = $(RELEASE_DIR)/osx
  13. APP_BINARY = $(RELEASE_DIR)/$(TARGET)
  14. APP_BINARY_DIR = $(APP_DIR)/$(APP_NAME)/Contents/MacOS
  15. APP_EXTRAS_DIR = $(APP_DIR)/$(APP_NAME)/Contents/Resources
  16. APP_COMPLETIONS_DIR = $(APP_EXTRAS_DIR)/completions
  17. DMG_NAME = Alacritty.dmg
  18. DMG_DIR = $(RELEASE_DIR)/osx
  19. vpath $(TARGET) $(RELEASE_DIR)
  20. vpath $(APP_NAME) $(APP_DIR)
  21. vpath $(DMG_NAME) $(APP_DIR)
  22. all: help
  23. help: ## Prints help for targets with comments
  24. @grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
  25. binary: | $(TARGET) ## Build release binary with cargo
  26. $(TARGET):
  27. MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --release
  28. app: | $(APP_NAME) ## Clone Alacritty.app template and mount binary
  29. $(APP_NAME): $(TARGET)
  30. @mkdir -p $(APP_BINARY_DIR)
  31. @mkdir -p $(APP_EXTRAS_DIR)
  32. @mkdir -p $(APP_COMPLETIONS_DIR)
  33. @gzip -c $(MANPAGE) > $(APP_EXTRAS_DIR)/alacritty.1.gz
  34. @tic -xe alacritty,alacritty-direct -o $(APP_EXTRAS_DIR) $(TERMINFO)
  35. @cp -fRp $(APP_TEMPLATE) $(APP_DIR)
  36. @cp -fp $(APP_BINARY) $(APP_BINARY_DIR)
  37. @cp -fp $(COMPLETIONS) $(APP_COMPLETIONS_DIR)
  38. @touch -r "$(APP_BINARY)" "$(APP_DIR)/$(APP_NAME)"
  39. @echo "Created '$@' in '$(APP_DIR)'"
  40. dmg: | $(DMG_NAME) ## Pack Alacritty.app into .dmg
  41. $(DMG_NAME): $(APP_NAME)
  42. @echo "Packing disk image..."
  43. @ln -sf /Applications $(DMG_DIR)/Applications
  44. @hdiutil create $(DMG_DIR)/$(DMG_NAME) \
  45. -volname "Alacritty" \
  46. -fs HFS+ \
  47. -srcfolder $(APP_DIR) \
  48. -ov -format UDZO
  49. @echo "Packed '$@' in '$(APP_DIR)'"
  50. install: $(DMG_NAME) ## Mount disk image
  51. @open $(DMG_DIR)/$(DMG_NAME)
  52. .PHONY: app binary clean dmg install $(TARGET)
  53. clean: ## Remove all artifacts
  54. -rm -rf $(APP_DIR)