aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Moon Flower <moon@coffin.ir> 2025-02-28 01:50:25 +0330
committerGravatar Moon Flower <moon@coffin.ir> 2025-02-28 01:50:25 +0330
commitf7a08d4db77eaef1f6685c3fb263bb1cb1376deb (patch)
treec6fb20ba555421bf5fc483717810ba2234ce235b /Makefile
parentDecently performant double-linked two-way linked list implementation (diff)
Added a (rather useless) profiler (and also linked list speed optimizations)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b73f7a6..d079677 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
FLAGS = -Wno-incompatible-library-redeclaration -nostartfiles
-SIZE_FLAGS = -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -s -fno-unwind-tables -fomit-frame-pointer -fno-asynchronous-unwind-tables -fno-ident -fvisibility=hidden -march=native -Wl,--build-id=none
+SIZE_FLAGS = -Wl,--undefined=main -flto -Oz -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,--strip-all -finline-hint-functions -fno-builtin -Wl,--print-gc-sections -fno-unwind-tables -fomit-frame-pointer -fno-asynchronous-unwind-tables -fno-ident -fvisibility=hidden -march=native -Wl,--build-id=none
all: m4 c test
@@ -12,6 +12,16 @@ c:
test:
./out.bin
+# useless. it don't work.
+# profile:
+# clang -D__MOONSHINE_PROFILER main.c -o out.bin.profile $(FLAGS) $(SIZE_FLAGS) -fprofile-generate
+# echo NOTE: Let the program run completely and provide it with typical inputs.
+# ./out.bin.profile
+# llvm-profdata merge -output=default.profdata profile.profraw
+# rm -rf profile.profraw
+# clang main.c -o out.bin.release $(FLAGS) $(SIZE_FLAGS) -fprofile-use
+# rm -rf profile.profdata
+
release:
clang main.c -o out.bin.release $(FLAGS) $(SIZE_FLAGS)