Browse code

Create main window using boxui

Dario Rodriguez authored on 28/12/2023 12:16:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,55 @@
1
+CC=gcc
2
+CFLAGS=-Wall -g -I/usr/include/SDL2 -DLINUX
3
+LDFLAGS=-lSDL2_ttf -lSDL2
4
+
5
+all: annotator annotator.exe annotator.html
6
+
7
+# common
8
+
9
+notosans_regular_ttf.c: fonts/NotoSans-Regular.ttf
10
+	(cd fonts && xxd -i NotoSans-Regular.ttf | tr A-Z a-z ) > notosans_regular_ttf.c
11
+
12
+notosans_regular_ttf.h: fonts/NotoSans-Regular.ttf
13
+	(cd fonts && xxd -i NotoSans-Regular.ttf | sed "s/^\(.*[^ ]\) *=.*/extern \1\;/g" | grep extern | tr A-Z a-z ) > notosans_regular_ttf.h
14
+
15
+# boxui.o: linux
16
+
17
+boxui.o: boxui.c boxui.h notosans_regular_ttf.c notosans_regular_ttf.h
18
+
19
+# boxui-windows.o: windows
20
+
21
+boxui-windows.o: boxui.c boxui.h notosans_regular_ttf.c notosans_regular_ttf.h
22
+	toolchain-zig/compile.sh boxui.c -c -o boxui-windows.o
23
+
24
+# boxui-html.o: html5
25
+
26
+boxui-html.o: boxui.c boxui.h notosans_regular_ttf.c notosans_regular_ttf.h
27
+	sh -c ". toolchain-emscripten/env.sh ; emcc -g -Wall -s USE_SDL=2 -s USE_SDL_TTF=2 boxui.c -c -o boxui-html.o"
28
+
29
+# annotator: linux
30
+
31
+annotator.o: annotator.c boxui.h
32
+
33
+annotator: boxui.o annotator.o
34
+	gcc annotator.o boxui.o -o annotator -lSDL2_ttf -lSDL2
35
+
36
+# annotator: windows
37
+
38
+annotator-windows.o: annotator.c boxui.h
39
+	toolchain-zig/compile.sh annotator.c -c -o annotator-windows.o
40
+
41
+annotator.exe: annotator-icon_256x256.png boxui-windows.o annotator-windows.o
42
+	toolchain-zig/link.sh -icon annotator-icon_256x256.png annotator.exe boxui-windows.o annotator-windows.o
43
+
44
+# annotator: html5
45
+
46
+annotator-html.o: annotator.c
47
+	sh -c ". toolchain-emscripten/env.sh ; emcc -g -Wall -s USE_SDL=2 -s USE_SDL_TTF=2 annotator.c -c -o annotator-html.o"
48
+
49
+annotator.html: boxui-html.template boxui-html.o annotator-html.o
50
+	sh -c ". toolchain-emscripten/env.sh ; emcc annotator-html.o boxui-html.o -o annotator.html -s USE_SDL=2 -s USE_SDL_TTF=2 && sed s/PROGRAMNAME/annotator/g < boxui-html.template > annotator.html && zip -pr annotator-html.zip annotator.html annotator.js annotator.wasm"
51
+
52
+clean:
53
+	rm -f *.o *.js *.html *.wasm *.exe \
54
+ notosans_regular_ttf.c notosans_regular_ttf.h \
55
+ annotator annotator.exe annotator-html.zip