refactor, libc made optional

This commit is contained in:
veclavtlica
2026-09-14 12:21:49 +03:00
parent 26f6ba56e9
commit 1125073568
14 changed files with 178 additions and 152 deletions
+5 -5
View File
@@ -1,26 +1,26 @@
CC = clang
# todo: Only link to libm on debug.
CFLAGS = -Wall -std=c99 -g3 -O3
CFLAGS = -Wall -std=c99 -g3 -O3 -flto=full
DEPS = ../Common/lzw.h ../Common/mat.h ../Common/vec.h ../Common/fix.h ../Common/def.h ../Common/bits.h \
../Common/gem.h \
../Common/Timer/timer.h \
./Display/display.h \
./draw.h
SRC = ../Common/lzw.c ../Common/fix.c ../Common/mat.c ./draw.c
OBJ = ../Common/lzw.o ../Common/fix.o ../Common/mat.o ./draw.o
LINUX = ./Main/linux.o ./amalgam.o Display/x11.o ../Common/Timer/unix.o
LINUX = ./amalgam.c
WASM = ./amalgam.c
DOS = maindos.c Display/dos.c
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
linux: CFLAGS += -msse2 -lm -lX11
# TODO: Make it work with no stdlib.
linux: CFLAGS += -msse2 -lm -lX11 # -nostdlib
linux: $(LINUX) | $(SRC)
$(CC) -o player $^ $(CFLAGS)
# Note: lld package might need to be downloaded.
wasm: CFLAGS += --target=wasm32 -nostdlib -Wl,--no-entry
wasm: CFLAGS += --target=wasm32 -nostdlib -Wl,--no-entry -msimd128
wasm:
$(CC) -o player.wasm $(WASM) $(CFLAGS)