Run on windows OR unix

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

View File

@ -1,7 +1,15 @@
CC?=gcc CC?=gcc
LD?=ld LD?=ld
SHROOMSFLAGS=shrooms-vb-core/core/vb.c -I shrooms-vb-core/core 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)
BINLINKFLAGS=-z noexecstack
else
SDL2FLAGS=$(shell pkg-config sdl2 --cflags --libs) -mwindows -mconsole
BINLINKFLAGS=
endif
.PHONY: clean build .PHONY: clean build
clean: clean:
@ -34,7 +42,7 @@ output/vb.o: shrooms-vb-core/core/vb.c
output/%.o: assets/%.bin output/%.o: assets/%.bin
@mkdir -p output @mkdir -p output
@$(LD) -r -b binary -o $@ $< @$(LD) -r -b binary $(BINLINKFLAGS) -o $@ $<
shrooms-vb: $(OFILES) shrooms-vb: $(OFILES)
@$(CC) -o $@ $(OFILES) $(SDL2FLAGS) -flto @$(CC) -o $@ $(OFILES) $(SDL2FLAGS) -flto