|
@@ -7,25 +7,56 @@
|
7
|
7
|
|
8
|
8
|
CFLAGS ?= -Wall -pedantic -std=c11
|
9
|
9
|
|
10
|
|
-all: bin/protocol bin/foohid SerialGamepad.app
|
|
10
|
+# Build everything
|
|
11
|
+all: bin/protocol bin/foohid build/Release/SerialGamepad.app build/Installer.pkg
|
|
12
|
+ cp -R build/Release/SerialGamepad.app bin/SerialGamepad.app
|
|
13
|
+ cp -R build/Installer.pkg bin/SerialGamepad.pkg
|
11
|
14
|
|
|
15
|
+# Install locally
|
12
|
16
|
install: all
|
13
|
17
|
cp bin/protocol ~/bin/protocol
|
14
|
18
|
cp bin/foohid ~/bin/foohid
|
15
|
19
|
cp -r build/Release/SerialGamepad.app /Applications/SerialGamepad.app
|
16
|
20
|
|
17
|
|
-SerialGamepad.app:
|
|
21
|
+# Build GUI project
|
|
22
|
+build/Release/SerialGamepad.app:
|
18
|
23
|
xcodebuild
|
19
|
24
|
|
|
25
|
+# Build protocol binary
|
20
|
26
|
bin/protocol: src/serial.o src/protocol.o
|
21
|
27
|
@mkdir -p bin
|
22
|
28
|
$(CC) -o bin/protocol src/serial.o src/protocol.o
|
23
|
29
|
|
|
30
|
+# Build foohid binary
|
24
|
31
|
bin/foohid: src/serial.o src/foohid.o
|
25
|
32
|
@mkdir -p bin
|
26
|
33
|
$(CC) -o bin/foohid -framework IOKit src/serial.o src/foohid.o
|
27
|
34
|
|
|
35
|
+# Download foohid binary dependency
|
|
36
|
+build/foohid.pkg:
|
|
37
|
+ @mkdir -p build
|
|
38
|
+ curl -o build/foohid.pkg \
|
|
39
|
+ -L https://github.com/unbit/foohid/releases/download/0.1/foohid.pkg
|
|
40
|
+
|
|
41
|
+# Create installer pkg for our App
|
|
42
|
+build/SerialGamepad.pkg: build/Release/SerialGamepad.app
|
|
43
|
+ pkgbuild \
|
|
44
|
+ --root build/Release/SerialGamepad.app \
|
|
45
|
+ --identifier de.xythobuz.SerialGamepad \
|
|
46
|
+ --install-location "/Applications/SerialGamepad.app" \
|
|
47
|
+ build/SerialGamepad.pkg
|
|
48
|
+
|
|
49
|
+# Create installer bundling our App and fooHID
|
|
50
|
+build/Installer.pkg: build/SerialGamepad.pkg build/foohid.pkg Resources/Distribution.xml Resources/readme.rtf Resources/license.txt
|
|
51
|
+ productbuild \
|
|
52
|
+ --distribution Resources/Distribution.xml \
|
|
53
|
+ --package-path build \
|
|
54
|
+ --resources Resources \
|
|
55
|
+ build/Installer.pkg
|
|
56
|
+
|
|
57
|
+# Delete intermediate files
|
28
|
58
|
clean:
|
29
|
59
|
rm -rf bin
|
|
60
|
+ rm -rf build
|
30
|
61
|
rm -rf src/*.o
|
31
|
62
|
|