Makefile 1006 B

1234567891011121314151617181920212223242526272829303132333435
  1. APP_NAME := AirAccept
  2. BUNDLE_ID := com.airaccept.AirAccept
  3. BUILD_DIR := .build/release
  4. APP_DIR := build/$(APP_NAME).app
  5. CONTENTS_DIR := $(APP_DIR)/Contents
  6. MACOS_DIR := $(CONTENTS_DIR)/MacOS
  7. RESOURCES_DIR := $(CONTENTS_DIR)/Resources
  8. .PHONY: build test app run debug-run clean
  9. build:
  10. swift build -c release
  11. test:
  12. swift test
  13. app: build
  14. rm -rf "$(APP_DIR)"
  15. mkdir -p "$(MACOS_DIR)" "$(RESOURCES_DIR)"
  16. cp "$(BUILD_DIR)/$(APP_NAME)" "$(MACOS_DIR)/$(APP_NAME)"
  17. cp "Resources/Info.plist" "$(CONTENTS_DIR)/Info.plist"
  18. plutil -replace CFBundleIdentifier -string "$(BUNDLE_ID)" "$(CONTENTS_DIR)/Info.plist"
  19. plutil -replace CFBundleExecutable -string "$(APP_NAME)" "$(CONTENTS_DIR)/Info.plist"
  20. plutil -replace CFBundleName -string "$(APP_NAME)" "$(CONTENTS_DIR)/Info.plist"
  21. plutil -replace CFBundleDisplayName -string "$(APP_NAME)" "$(CONTENTS_DIR)/Info.plist"
  22. codesign --force --sign - "$(APP_DIR)"
  23. run: app
  24. open "$(APP_DIR)"
  25. debug-run: app
  26. "$(MACOS_DIR)/$(APP_NAME)"
  27. clean:
  28. rm -rf .build build