aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-09-03 14:19:27 +0200
committerTeddy Wing2023-09-03 15:44:00 +0200
commit99c437573f1748832f6eb30c5f4eeaf00fd72cf2 (patch)
treec9bf7bd87a505a5143ff730488f0f6d801ecbf7d
parentc54c23d76f95ce4730b36c7e81453dd61bc391a0 (diff)
downloadBase-Windowed-Application-99c437573f1748832f6eb30c5f4eeaf00fd72cf2.tar.bz2
Makefile: Try to build .app bundle
I'm trying to set up the Make targets to build a .app bundle, but I'm having trouble handling file names with spaces. I sort of managed to do it using the strategy articulated by andrewdotn (https://stackoverflow.com/users/14558/andrewdotn) with "${@}" in this Stack Overflow answer: https://stackoverflow.com/questions/14639906/can-gnu-make-handle-spaces/14640047#14640047 However, it doesn't seem to be working in the `subst` or `patsubst` calls using "%" for the localisation files. I get the error: make: *** No rule to make target `en.lproj', needed by `app'. Stop. The error looks like it's saying that the `build/$(APP_NAME).app/Contents/Resources/%.lproj` rule couldn't be found, even though it is declared. It looks like I'm going to have to explore other options to handle file names, or at least application names, with spaces. I copied the Info.plist file from Mass-menu and updated some fields to work with this project. I also copied and modified the Make rules from Mass-menu, but that project doesn't need to handle spaces in file names.
-rw-r--r--Info.plist28
-rw-r--r--Makefile53
2 files changed, 81 insertions, 0 deletions
diff --git a/Info.plist b/Info.plist
new file mode 100644
index 0000000..ae7efd1
--- /dev/null
+++ b/Info.plist
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>Base Windowed Application</string>
+ <key>CFBundleExecutable</key>
+ <string>Application</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.teddywing.Base-Windowed-Application</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Base Windowed Application</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.12</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2023 Teddy Wing</string>
+</dict>
+</plist>
diff --git a/Makefile b/Makefile
index 761e637..751af92 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,11 @@
+APP_NAME := Base\ Windowed\ Application
+
+
SOURCES := $(shell find src -name '*.m')
OBJECTS := $(SOURCES:%.m=%.o)
+LPROJS := $(shell ls Internationalization)
+
PRODUCT := build/Application
@@ -23,6 +28,54 @@ $(PRODUCT): $(OBJECTS) | build
build:
mkdir -p build
+build/$(APP_NAME).app: | build
+ mkdir -p build/$(APP_NAME).app
+
+build/$(APP_NAME).app/Contents: | build/$(APP_NAME).app
+ mkdir -p build/$(APP_NAME).app/Contents
+
+build/$(APP_NAME).app/Contents/MacOS: | build/$(APP_NAME).app/Contents
+ mkdir -p build/$(APP_NAME).app/Contents/MacOS
+
+build/$(APP_NAME).app/Contents/MacOS/$(APP_NAME): $(OBJECTS) \
+| build/$(APP_NAME).app/Contents/MacOS
+ $(CC) \
+ -framework Cocoa \
+ -o "${@}" \
+ $^
+
+# build/$(APP_NAME).app/Contents/Info.plist: Info.m4.plist \
+# | build/$(APP_NAME).app/Contents
+# m4 \
+# --define='CF_BUNDLE_VERSION=$(CF_BUNDLE_VERSION)' \
+# $< \
+# > $@
+build/$(APP_NAME).app/Contents/Info.plist: Info.plist \
+| build/$(APP_NAME).app/Contents
+ cp $< "${@}"
+
+build/$(APP_NAME).app/Contents/Resources: | build/$(APP_NAME).app/Contents
+ mkdir -p build/$(APP_NAME).app/Contents/Resources
+
+# build/$(APP_NAME).app/Contents/Resources/%.lproj/Localizable.strings: \
+# Internationalization/%.lproj/Localizable.strings \
+# | build/$(APP_NAME).app/Contents/Resources
+# mkdir -p $(dir "${@}")
+# cp $< "${@}"
+
+build/$(APP_NAME).app/Contents/Resources/%.lproj: \
+Internationalization/%.lproj \
+| build/$(APP_NAME).app/Contents/Resources
+ cp $< "${@}"
+
+.PHONY: app
+app: \
+build/$(APP_NAME).app/Contents/MacOS/$(APP_NAME) \
+build/$(APP_NAME).app/Contents/Info.plist \
+$(patsubst Internationalization/%,build/$(APP_NAME).app/Contents/Resources/%,$(LPROJS))
+
+# $(subst Internationalization/,build/$(APP_NAME).app/Contents/Resources/,$(LOCALIZABLE_STRINGS))
+
.PHONY: genstrings
genstrings: Base.lproj/Localizable.strings