commit e3e8705316acdc30fb75835207d448d276e9400e
parent 610172bf4c37ce9222ef7dd739a848779e193298
Author: bsandro <email@bsandro.tech>
Date: Mon, 20 Oct 2025 22:14:41 +0300
new Makefile
Diffstat:
2 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,6 +1,4 @@
*.swp
*.o
-main3
-main3o
-test1
-test2
+*.out
+micro0
diff --git a/Makefile b/Makefile
@@ -1,19 +1,28 @@
-all:
- ${CC} main2.c -std=gnu23 -Wpedantic -Os -s -fomit-frame-pointer -ffast-math -fno-stack-protector -march=native -fwrapv -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-unwind-tables -fmerge-all-constants -fno-ident -lm -lGL -lGLU -lX11 -Wl,--gc-sections -o test2
+.SUFFIXES:
+MAKEFLAGS += -rR
-min: all
- strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag ./test2
- upx -9 ./test2
+CC=cc
-clean:
- rm -f ./test1 ./test2 ./main3
+.PHONY: clean
+
+.SECONDARY:
+%: %.out
+ @:
+
+%.out: %.c
+ ${CC} $< -std=gnu23 -Wpedantic -Os -s -fomit-frame-pointer -ffast-math -fno-stack-protector -march=native -fwrapv -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-unwind-tables -fmerge-all-constants -fno-ident -lm -lGL -lGLU -lX11 -Wl,--gc-sections -o $@
+ strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag $@
+ upx -9 $@
-main3: clean
- ${CC} -Os -s -fomit-frame-pointer -nostdlib main3.c -o main3o -Wl,-dynamic-linker,/usr/lib64/ld-linux-x86-64.so.2 -Wl,--no-as-needed /usr/lib64/libdl.so.2 /usr/lib64/libc.so
- strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag main3o
- echo "a=/tmp/I;tail -n+2 \$$0|unxz>\$$a;chmod +x \$$a;\$$a;exit" > main3
- xz -zce -9 main3o >> main3
- chmod +x main3
+micro: clean
+ ${CC} -Os -s -fomit-frame-pointer -nostdlib micro.c -o micro0 -Wl,-dynamic-linker,/usr/lib64/ld-linux-x86-64.so.2 -Wl,--no-as-needed /usr/lib64/libdl.so.2 /usr/lib64/libc.so
+ strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag micro0
+ echo "a=/tmp/I;tail -n+2 \$$0|unxz>\$$a;chmod +x \$$a;\$$a;exit" > micro.out
+ xz -zce -9 micro0 >> micro.out
+ chmod +x micro.out
-run: min
- ./test2
+run: shaders.out
+ ./shaders.out
+
+clean:
+ rm -f ./*.out