2019-04-02 04:11:27 +00:00
|
|
|
|
2019-06-15 04:26:38 +00:00
|
|
|
CFLAGS := -fno-plt -O1 -std=gnu11 -nostartfiles -Wall -Wextra
|
|
|
|
CFLAGS += -fno-stack-protector -fno-stack-check -fno-unwind-tables -fno-asynchronous-unwind-tables -fomit-frame-pointer
|
|
|
|
CFLAGS += -no-pie -fno-pic -fno-PIE -fno-PIC -march=core2 -ffunction-sections -fdata-sections
|
2019-04-02 04:17:23 +00:00
|
|
|
|
2019-06-15 04:26:38 +00:00
|
|
|
.PHONY: clean checkgccversion noelfver
|
|
|
|
|
|
|
|
all : checkgccversion gtk-opengl xlib-opengl sdl2-opengl
|
|
|
|
|
|
|
|
noelfver:
|
|
|
|
make -C noelfver
|
|
|
|
|
|
|
|
checkgccversion :
|
|
|
|
ifneq ($(shell expr `gcc -dumpversion`),8.3.0)
|
|
|
|
$(error GCC version must be 8.3.0)
|
|
|
|
endif
|
2019-04-02 04:17:23 +00:00
|
|
|
|
|
|
|
packer : vondehi/vondehi.asm
|
|
|
|
cd vondehi; nasm -fbin -o vondehi vondehi.asm
|
2019-04-02 04:11:27 +00:00
|
|
|
|
2019-04-02 04:43:08 +00:00
|
|
|
shader.h : shader.frag Makefile
|
|
|
|
mono ./shader_minifier.exe --preserve-externals shader.frag -o shader.h
|
|
|
|
|
|
|
|
gtk-opengl.elf : gtk-opengl.c shader.h Makefile
|
2019-06-15 04:26:38 +00:00
|
|
|
gcc -o $@ $< `pkg-config --cflags gtk+-3.0` -lGL -lgtk-3 -lgdk-3 -lgobject-2.0 $(CFLAGS)
|
2019-04-02 04:43:08 +00:00
|
|
|
|
2019-04-02 05:13:23 +00:00
|
|
|
xlib-opengl.elf : xlib-opengl.c shader.h Makefile
|
2019-06-15 04:26:38 +00:00
|
|
|
gcc -o $@ $< -lX11 -lGL -lXrandr $(CFLAGS)
|
2019-04-02 05:13:23 +00:00
|
|
|
|
2019-06-15 04:26:38 +00:00
|
|
|
sdl2-opengl.elf : sdl2-opengl.c shader.h Makefile
|
|
|
|
gcc -o $@ $< -lSDL2 -lGL $(CFLAGS)
|
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-06-15 04:26:38 +00:00
|
|
|
sdl2-opengl : sdl2-opengl_opt.elf.packed
|
|
|
|
mv $< $@
|
|
|
|
|
2019-04-02 13:58:43 +00:00
|
|
|
index.html.inc : index.html
|
|
|
|
cat index.html | xxd -i > index.html.inc
|
|
|
|
echo ", 0" >> index.html.inc
|
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
|
2019-06-15 04:26:38 +00:00
|
|
|
%_opt.elf : %.elf Makefile noelfver
|
2019-04-02 04:11:27 +00:00
|
|
|
cp $< $@
|
|
|
|
strip $@
|
2019-06-15 04:26:38 +00:00
|
|
|
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 .shstrtab -R .gnu.version_r -R .gnu.hash $@
|
|
|
|
./noelfver/noelfver $@ > $@.nover
|
|
|
|
mv $@.nover $@
|
2019-04-02 04:11:27 +00:00
|
|
|
#remove section header
|
2019-04-02 04:24:36 +00:00
|
|
|
./Section-Header-Stripper/section-stripper.py $@
|
2019-04-02 04:11:27 +00:00
|
|
|
|
|
|
|
#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' $@;
|
2019-06-15 04:26:38 +00:00
|
|
|
sed -i 's/GLIBC_2\.2\.5/\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/g' $@;
|
2019-04-02 04:11:27 +00:00
|
|
|
|
|
|
|
chmod +x $@
|
|
|
|
|
|
|
|
%.xz : % Makefile
|
|
|
|
-rm $@
|
2019-06-15 04:26:38 +00:00
|
|
|
lzma --format=lzma -9 --extreme --lzma1=preset=9,lc=0,lp=0,pb=0,nice=40,depth=32,dict=16384 --keep --stdout $< > $@
|
2019-04-02 04:11:27 +00:00
|
|
|
|
2019-04-02 04:17:23 +00:00
|
|
|
%.packed : %.xz packer Makefile
|
|
|
|
cat ./vondehi/vondehi $< > $@
|
|
|
|
chmod +x $@
|
|
|
|
wc -c $@
|
|
|
|
|
2019-04-02 04:11:27 +00:00
|
|
|
clean :
|
2019-06-15 04:26:38 +00:00
|
|
|
-rm *.elf shader.h gtk-opengl xlib-opengl sdl2-opengl
|