← Back to davo.co
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Faulkner <[email protected]>2026-08-06 02:40:39 -0500
committerDavid Faulkner <[email protected]>2026-08-06 02:40:39 -0500
commit85c77a80f1baa924535c3e1455fe4d9df7c13a6c (patch)
tree1a125ec3f49bf2764c8b81c48d48e376f4da5bd1
parent407017e02f32f471d17800f7d52b556a80cf9a0e (diff)
build(makefile): optimize for performance and security hardeningv1.0.1
- Enable -O3, -flto, -fomit-frame-pointer, and -march=native for performance - Add strict compiler warnings (-Werror, -Wconversion, -Wsign-conversion, -Wshadow, -Wformat=2) - Add security hardening flags (-fstack-protector-strong, -D_FORTIFY_SOURCE=2) - Pass -flto, -O3, and strip symbols (-Wl,-s) during linking
-rw-r--r--Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 939f257..c2a75fd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,20 @@
# Compiler and flags
+# Compiler & Language Standard
CC := gcc
-CFLAGS := -Wall -Wextra -Wpedantic -O2 -std=c11 -D_POSIX_C_SOURCE=200809L
+CFLAGS := -std=c11 -D_POSIX_C_SOURCE=200809L
+
+# --- PERFORMANCE FLAGS ---
+CFLAGS += -O3 -flto -fomit-frame-pointer -march=native
+
+# --- SAFETY & STRICT WARNING FLAGS ---
+CFLAGS += -Wall -Wextra -Wpedantic -Werror \
+ -Wconversion -Wsign-conversion -Wshadow -Wformat=2
+
+# --- HARDENING & RUNTIME PROTECTION FLAGS ---
+CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=2
+
+# --- LINKER FLAGS (LTO & Strip) ---
+LDFLAGS := -flto -O3 -Wl,-s
TARGET := ud
SRC := main.c
OBJ := $(SRC:.c=.o)