From 3d2c6cbddf851028585f9ff2b0ff684fb945b929 Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Wed, 23 Oct 2024 20:01:22 -0400 Subject: [PATCH] Run on windows OR unix --- makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 4b50bb5..b1f6bd9 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,15 @@ 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) +BINLINKFLAGS=-z noexecstack +else +SDL2FLAGS=$(shell pkg-config sdl2 --cflags --libs) -mwindows -mconsole +BINLINKFLAGS= +endif .PHONY: clean build clean: @@ -34,7 +42,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 $(BINLINKFLAGS) -o $@ $< shrooms-vb: $(OFILES) @$(CC) -o $@ $(OFILES) $(SDL2FLAGS) -flto