-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
40 lines (32 loc) · 1.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
APP=Cocoa\ Go
APPDIR=bin/$(APP).app
GOSRC=src/header.h src/c_funcs.c src/do_button.c src/exported.go src/main.go
CC=clang
TEMPXIB=tmp.xib
all: $(APP)
.PHONY: $(APP)
$(APP): \
$(APPDIR)/Contents/MacOS/$(APP) \
$(APPDIR)/Contents/Resources/Base.lproj/MainMenu.nib \
$(APPDIR)/Contents/Resources/gopher.icns \
$(APPDIR)/Contents/Info.plist \
$(APPDIR)/Contents/PkgInfo
$(APPDIR)/Contents/MacOS/$(APP): $(GOSRC) src/
-mkdir -p "`dirname \"$@\"`"
cd src/ && CC=$(CC) go build -ldflags="-linkmode=external" -o "$(CURDIR)/$@"
$(APPDIR)/Contents/Resources/Base.lproj/MainMenu.nib: res/MainMenu.xib
-mkdir -p "`dirname \"$@\"`"
sed -e 's/$$[{]APP}'/$(APP)/ $< > $(TEMPXIB)
ibtool --compile "$@" $(TEMPXIB)
rm $(TEMPXIB)
$(APPDIR)/Contents/Resources/gopher.icns: res/gopher.png
sips -z 512 512 -s format icns $< --out "$@"
$(APPDIR)/Contents/Info.plist: res/Info.plist.json
-mkdir -p "`dirname \"$@\"`"
sed -e 's/$$[{]APP}'/$(APP)/ $< > "$@"
plutil -convert xml1 "$@"
$(APPDIR)/Contents/PkgInfo: res/PkgInfo
-mkdir -p "`dirname \"$@\"`"
cp $< "$@"
clean:
-rm -r $(APPDIR)