opengl-setup-examples/Makefile

60 lines
1.9 KiB
Makefile
Raw Normal View History

2019-04-02 05:13:23 +00:00
all : gtk-webkit gtk-opengl xlib-opengl
2019-04-02 04:17:23 +00:00
.PHONY: clean
packer : vondehi/vondehi.asm
cd vondehi; nasm -fbin -o vondehi vondehi.asm
2019-04-02 04:43:08 +00:00
shader.h : shader.frag Makefile
mono ./shader_minifier.exe --preserve-externals shader.frag -o shader.h
# not using `pkg-config --libs` here because it will include too many libs
gtk-webkit.elf : gtk-webkit.c Makefile
gcc -o $@ $< `pkg-config --cflags webkit2gtk-4.0` -lgobject-2.0 -lgtk-3 -lwebkit2gtk-4.0 -no-pie -fno-plt -Os -std=gnu11 -nostartfiles -nostdlib
2019-04-02 04:43:08 +00:00
gtk-opengl.elf : gtk-opengl.c shader.h Makefile
gcc -o $@ $< `pkg-config --cflags gtk+-3.0` -lglib-2.0 -lGL -lgtk-3 -lgdk-3 -lgobject-2.0 -no-pie -fno-plt -Os -std=gnu11 -nostartfiles -nostdlib
2019-04-02 05:13:23 +00:00
xlib-opengl.elf : xlib-opengl.c shader.h Makefile
gcc -o $@ $< -lX11 -lGL -lcairo -lXrandr -no-pie -fno-plt -Os -std=gnu11 -nostartfiles -nostdlib
2019-04-02 04:17:23 +00:00
gtk-webkit : gtk-webkit_opt.elf.packed
2019-04-02 04:24:36 +00:00
mv $< $@
2019-04-02 04:17:23 +00:00
2019-04-02 04:43:08 +00:00
gtk-opengl : gtk-opengl_opt.elf.packed
mv $< $@
2019-04-02 05:13:23 +00:00
xlib-opengl : xlib-opengl_opt.elf.packed
mv $< $@
2019-04-02 04:43:08 +00:00
#all the rest of these rules just takes a compiled elf file and generates a packed version of it with vondehi
%_opt.elf : %.elf Makefile
cp $< $@
strip $@
strip -R .note -R .comment -R .eh_frame -R .eh_frame_hdr -R .note.gnu.build-id -R .got -R .got.plt -R .gnu.version -R .rela.dyn -R .shstrtab $@
#remove section header
2019-04-02 04:24:36 +00:00
./Section-Header-Stripper/section-stripper.py $@
#clear out useless bits
sed -i 's/_edata/\x00\x00\x00\x00\x00\x00/g' $@;
sed -i 's/__bss_start/\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/g' $@;
sed -i 's/_end/\x00\x00\x00\x00/g' $@;
wc -c $@
chmod +x $@
%.xz : % Makefile
-rm $@
lzma --format=lzma -9 --extreme --lzma1=preset=9,lc=1,lp=0,pb=1,nice=270,depth=64,dict=16384 --keep --stdout $< > $@
wc -c $@
2019-04-02 04:17:23 +00:00
%.packed : %.xz packer Makefile
cat ./vondehi/vondehi $< > $@
chmod +x $@
wc -c $@
clean :
2019-04-02 05:13:23 +00:00
-rm *.elf shader.h gtk-webkit gtk-opengl xlib-opengl