summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorrebeccadoth <rebeccadoth@disroot.org>2026-11-08 21:48:41 +0100
committerrebeccadoth <rebeccadoth@disroot.org>2026-11-08 21:48:41 +0100
commit60f60fa1a9b40863cf325cca1447ec36d6108701 (patch)
tree24697bcde2c86c6da77950f32819cd5584ac4487 /Makefile
inital commitHEADmaster
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..450732b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,47 @@
+CC := clang
+WRN := -Wall -Wextra -Wconversion -Wvla -Wformat
+ASM := rdtsc
+INF := main.c $(ASM).obj
+OUT := max
+LNK := -lm
+DBG := -g -gcodeview -gcolumn-info -fuse-ld=lld -g -Wl,--pdb=$(OUT).pdb
+
+default: asm com
+
+com:
+ $(CC) $(WRN) $(LNK) $(INF) $(DBG) -O0 -o $(OUT)
+
+asm:
+ nasm -w+all -f win64 $(ASM).S
+
+rdi:
+ $(RAD)/radbin --rdi $(OUT).pdb
+
+o1: asm
+ $(CC) $(WRN) $(LNK) $(INF) $(DBG) -o $(OUT) -O1
+o2: asm
+ $(CC) $(WRN) $(LNK) $(INF) $(DBG) -o $(OUT) -O2
+o3: asm
+ $(CC) $(WRN) $(LNK) $(INF) $(DBG) -o $(OUT) -O3
+os: asm
+ $(CC) $(WRN) $(LNK) $(INF) $(DBG) -o $(OUT) -Os
+ofast: asm
+ $(CC) $(WRN) $(LNK) $(INF) $(DBG) -o $(OUT) -Ofast
+
+test:
+ make default > /dev/null
+ ./$(OUT)
+ make o1 > /dev/null
+ ./$(OUT)
+ make o2 > /dev/null
+ ./$(OUT)
+ make o3 > /dev/null
+ ./$(OUT)
+ make os > /dev/null
+ ./$(OUT)
+ make ofast > /dev/null
+ ./$(OUT)
+
+clean:
+ rm -f $(OUT) $(OUT).exe $(OUT).pdb $(OUT).rdi $(ASM).o $(ASM).obj
+