Run on windows OR unix

This commit is contained in:
Simon Gellis 2024-10-23 20:01:22 -04:00
parent 0b21febc6b
commit 075d119ab3
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,13 @@
CC?=gcc
LD?=ld
SHROOMSFLAGS=shrooms-vb-core/core/vb.c -I shrooms-vb-core/core
SDL2FLAGS=$(shell pkg-config sdl2 --cflags --libs) -mconsole
msys_version := $(if $(findstring Msys, $(shell uname -o)),$(word 1, $(subst ., ,$(shell uname -r))),0)
ifeq ($(msys_version), 0)
SDL2FLAGS=$(shell pkg-config sdl2 --cflags --libs)
else
SDL2FLAGS=$(shell pkg-config sdl2 --cflags --libs) -mwindows -mconsole
endif
.PHONY: clean build
clean:
@ -34,7 +40,7 @@ output/vb.o: shrooms-vb-core/core/vb.c
output/%.o: assets/%.bin
@mkdir -p output
@$(LD) -r -b binary -o $@ $<
@$(LD) -r -b binary -z noexecstack -o $@ $<
shrooms-vb: $(OFILES)
@$(CC) -o $@ $(OFILES) $(SDL2FLAGS) -flto