From 551a31b856cca52ee74f9a69f65352692cd7fe08 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Thu, 1 Feb 2024 00:34:02 +0700 Subject: [PATCH] Refactor build config --- .gitignore | 3 ++- Makefile | 41 ++++++++++++++++++++++------------------- build/.gitignore | 2 -- 3 files changed, 24 insertions(+), 22 deletions(-) delete mode 100644 build/.gitignore diff --git a/.gitignore b/.gitignore index dfdb05a..0bc143c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build/ # Created by https://www.gitignore.io/api/osx # Edit at https://www.gitignore.io/?templates=osx @@ -9,7 +10,7 @@ .LSOverride # Icon must end with two \r -Icon +Icon # Thumbnails ._* diff --git a/Makefile b/Makefile index 49eb94c..8f3cb18 100644 --- a/Makefile +++ b/Makefile @@ -1,42 +1,45 @@ +XOCDEBUILD=/usr/bin/xcodebuild +PACKAGES=/usr/local/bin/packagesbuild +CONFIGURATION_BUILD_DIR=$(PWD)/build/KhmerUnicodeBundle/Products/Release + .PHONY: main -main: clean bundle-info bundle installer +main: clean build installer install: @echo "Opening installer..." @open "build/KhmerUnicodeInstaller/Khmer Unicode Installer.pkg" -bundle: +build-info: + @echo "Bundle build settings..." + @$(XOCDEBUILD) -project src/KhmerUnicodeBundle/KhmerUnicode.xcodeproj \ + -scheme "[Release] KhmerUnicode" \ + -showBuildSettings \ + CONFIGURATION_BUILD_DIR=$(CONFIGURATION_BUILD_DIR) + +.PHONY: build +build: build-info + @mkdir -p build @echo "Building Khmer Unicode Keyboard [Bundle]\n" - @xcodebuild -project src/KhmerUnicodeBundle/KhmerUnicode.xcodeproj \ + @$(XOCDEBUILD) -project src/KhmerUnicodeBundle/KhmerUnicode.xcodeproj \ -scheme "[Release] KhmerUnicode" \ - build - @echo "Removing existing KhmerUnicode.bundle from KhmerUnicodeInstaller..." - @rm -rf "src/KhmerUnicodeInstaller/Library/Keyboard Layouts/KhmerUnicode.bundle" + build \ + CONFIGURATION_BUILD_DIR=$(CONFIGURATION_BUILD_DIR) @echo "Copying KhmerUnicode.bundle to KhmerUnicodeInstaller..." @cp -r "build/KhmerUnicodeBundle/Products/Release/KhmerUnicode.bundle" \ "src/KhmerUnicodeInstaller/Library/Keyboard Layouts" @echo "\n[DONE] Ready to build the installer!" -bundle-info: - @echo "Bundle build settings..." - @xcodebuild -project src/KhmerUnicodeBundle/KhmerUnicode.xcodeproj \ - -scheme "[Release] KhmerUnicode" \ - -showBuildSettings - installer: @echo "Building Khmer Unicode Keyboard [Installer]\n" @rm -rf "build/KhmerUnicodeInstaller" @mkdir build/KhmerUnicodeInstaller - @/usr/local/bin/packagesbuild \ + @$(PACKAGES) \ --verbose \ - ./src/KhmerUnicodeInstaller/Packages.pkgproj + ./src/KhmerUnicodeInstaller/Packages.pkgproj \ clean: @echo "Cleaning up..." - @rm -rf build/temp/*/ - @echo "Removing build/KhmerUnicodeBundle directory..." - @rm -rf "build/KhmerUnicodeBundle" - @echo "Removing build/KhmerUnicodeInstaller directory..." - @rm -rf "build/KhmerUnicodeInstaller" + @rm -rf build + @rm -rf "src/KhmerUnicodeInstaller/Library/Keyboard Layouts/KhmerUnicode.bundle" @echo "[DONE] Cleanup completed!\n" diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/build/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore