This commit is contained in:
veclavtlica
2026-10-12 21:52:52 +03:00
parent 8d2bb5575e
commit 964e623644
5 changed files with 28 additions and 16 deletions
+14 -6
View File
@@ -8,6 +8,11 @@ RUN ?= 0
ISCLANG = 1
ifeq ($(MAKECMDGOALS),cosmo)
ISCLANG = 0
ifeq ($(DEBUG), 1)
CFLAGS += -mdbg
else
CFLAGS += -mtiny
endif
endif
CFLAGS = -Wall -std=gnu99 -ffast-math -fno-ident -fvisibility=hidden
ifeq ($(ISCLANG), 1)
@@ -40,13 +45,15 @@ endif
ifeq ($(DEBUG), 1)
CFLAGS += -g3
else
CFLAGS += -DNDEBUG -Wl,--strip-all
CFLAGS += -DNDEBUG -s
endif
ifeq ($(RELEASE), 1)
CFLAGS += -O3 -fmerge-all-constants -Wl,-O3 \
-ffunction-sections -fdata-sections -Wl,--gc-sections \
-Wl,-mllvm,--vectorize-slp=true \
-Wl,-mllvm,--enable-gvn-hoist=true
-ffunction-sections -fdata-sections -Wl,--gc-sections
ifeq ($(ISCLANG), 1)
CFLAGS += -Wl,-mllvm,--vectorize-slp=true \
-Wl,-mllvm,--enable-gvn-hoist=true
endif
endif
linux: CFLAGS += -static -mbmi2 -nostdlib
@@ -59,9 +66,10 @@ wasm:
$(CC) -o player.wasm ./amalgam.c $(CFLAGS)
# todo: Add -mtiny for release without debug
cosmo: CC = ./Cosmo/bin/cosmocc -I /usr/include/X11 -mdbg
cosmo: CC = ./Cosmo/bin/cosmocc
cosmo: CFLAGS += -I /usr/include/X11 -mclang
cosmo: ./amalgam.c
$(CC) -o ./Out/Cosmo/player $^
$(CC) $(CFLAGS) -o ./Out/Cosmo/player $^
ifeq ($(RUN), 1)
ifeq ($(DEBUG), 1)
gdb ./Out/Cosmo/player.com.dbg