CC=gcc CFLAGS=-Wall -g -I/usr/include/SDL2 -DLINUX LDFLAGS=-lSDL2 -lSDL2_ttf all: boxui_demo_helloworld boxui_demo_helloworld.exe boxui_demo_helloworld.html # common notosans_regular_ttf.c: fonts/NotoSans-Regular.ttf (cd fonts && xxd -i NotoSans-Regular.ttf | tr A-Z a-z ) > notosans_regular_ttf.c notosans_regular_ttf.h: fonts/NotoSans-Regular.ttf (cd fonts && xxd -i NotoSans-Regular.ttf | sed "s/^\(.*[^ ]\) *=.*/extern \1\;/g" | grep extern | tr A-Z a-z ) > notosans_regular_ttf.h # windows build icon boxui-icon.ico: boxui-icon_256x256.png convert boxui-icon_256x256.png boxui-icon.ico boxui-icon.rc: boxui-icon.ico echo "1 ICON \"boxui-icon.ico\"" > boxui-icon.rc boxui-icon.o: boxui-icon.rc boxui-icon.ico x86_64-w64-mingw32-windres --preprocessor /usr/bin/cpp boxui-icon.rc boxui-icon.o # boxui.o: linux boxui.o: boxui.c boxui.h notosans_regular_ttf.c notosans_regular_ttf.h # boxui-windows.o: windows boxui-windows.o: boxui.c boxui.h notosans_regular_ttf.c notosans_regular_ttf.h sh -c ". toolchain-zig/env.sh >/dev/null ; zig cc -I./toolchain-zig/windows-msys2-mingw/include/ -I./toolchain-zig/windows-msys2-mingw/include/SDL2 boxui.c -c -o boxui-windows.o -target x86_64-windows-gnu" # boxui-html.o: html5 boxui-html.o: boxui.c boxui.h notosans_regular_ttf.c notosans_regular_ttf.h 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" # boxui_demo_helloworld: linux boxui_demo_helloworld.o: boxui_demo_helloworld.c boxui.h boxui_demo_helloworld: boxui.o boxui_demo_helloworld.o # boxui_demo_helloworld: windows boxui_demo_helloworld-windows.o: boxui_demo_helloworld.c boxui.h sh -c ". toolchain-zig/env.sh >/dev/null ; zig cc -I./toolchain-zig/windows-msys2-mingw/include/ -I./toolchain-zig/windows-msys2-mingw/include/SDL2 boxui_demo_helloworld.c -c -o boxui_demo_helloworld-windows.o -target x86_64-windows-gnu" boxui_demo_helloworld.exe: boxui-icon.o boxui-windows.o boxui_demo_helloworld-windows.o sh -c ". toolchain-zig/env.sh >/dev/null ; zig build-exe --subsystem windows boxui_demo_helloworld-windows.o boxui-windows.o boxui-icon.o -Ltoolchain-zig/windows-msys2-mingw/lib/ -Ltoolchain-zig/windows-msys2-mingw/lib/w32api -lSDL2 -lSDL2main -lSDL2_ttf -lfreetype -lgdi32 -lwinmm -lsetupapi -lmincore -lwindowsapp -limm32 -lversion -lgraphite2 -lpng -lbrotlidec -lbrotlicommon -lharfbuzz -lstdc++ -lbz2 -lz --name boxui_demo_helloworld -target x86_64-windows-gnu && rm boxui_demo_helloworld.lib boxui_demo_helloworld.pdb" # boxui_demo_helloworld: html5 boxui_demo_helloworld-html.o: boxui_demo_helloworld.c sh -c ". toolchain-emscripten/env.sh ; emcc -g -Wall -s USE_SDL=2 -s USE_SDL_TTF=2 boxui_demo_helloworld.c -c -o boxui_demo_helloworld-html.o" boxui_demo_helloworld.html: boxui-html.template boxui-html.o boxui_demo_helloworld-html.o sh -c ". toolchain-emscripten/env.sh ; emcc boxui_demo_helloworld-html.o boxui-html.o -o boxui_demo_helloworld.html -s USE_SDL=2 -s USE_SDL_TTF=2 && sed s/PROGRAMNAME/boxui_demo_helloworld/g < boxui-html.template > boxui_demo_helloworld.html && zip -pr boxui_demo_helloworld-html.zip boxui_demo_helloworld.html boxui_demo_helloworld.js boxui_demo_helloworld.wasm" clean: rm -f *.o *.js *.html *.wasm *.exe *.ico *.rc \ notosans_regular_ttf.c notosans_regular_ttf.h \ boxui_demo_helloworld boxui_demo_helloworld-html.zip