Skip to content

Commit e4febaf

Browse files
authored
A few changes for MSYS2 (snesrev#164)
Compilation on Windows with MSYS2 add STBI_NO_THREAD_LOCALS definition Simpler SDL handling
1 parent 8bee717 commit e4febaf

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

Makefile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,38 @@ SRCS:=$(wildcard *.c snes/*.c) third_party/gl_core/gl_core_3_1.c third_party/opu
44
OBJS:=$(SRCS:%.c=%.o)
55
PYTHON:=/usr/bin/env python3
66
CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-O2 -Werror)
7-
87
CFLAGS:=${CFLAGS} $(shell sdl2-config --cflags) -DSYSTEM_VOLUME_MIXER_AVAILABLE=0
9-
LDFLAGS:=${LDFLAGS} $(shell sdl2-config --libs) -lm
8+
9+
ifeq (${OS},Windows_NT)
10+
WINDRES:=windres
11+
RES:=zelda3.res
12+
SDLFLAGS:=-Wl,-Bstatic $(shell sdl2-config --static-libs)
13+
else
14+
SDLFLAGS:=$(shell sdl2-config --libs) -lm
15+
endif
1016

1117
.PHONY: all clean clean_obj clean_gen
1218

1319
all: $(TARGET_EXEC) tables/zelda3_assets.dat
14-
$(TARGET_EXEC): $(OBJS)
15-
$(CC) $(OBJS) -o $@ $(LDFLAGS)
20+
$(TARGET_EXEC): $(OBJS) $(RES)
21+
$(CC) $^ -o $@ $(LDFLAGS) $(SDLFLAGS)
1622
%.o : %.c
1723
$(CC) -c $(CFLAGS) $< -o $@
1824

25+
$(RES): platform/win32/zelda3.rc
26+
@echo "Generating Windows resources"
27+
@$(WINDRES) $< -O coff -o $@
28+
1929
tables/zelda3_assets.dat: tables/dialogue.txt
20-
cd tables; $(PYTHON) compile_resources.py ../$(ROM)
30+
@echo "Compiling game resources"
31+
@cd tables; $(PYTHON) compile_resources.py ../$(ROM)
2132
tables/dialogue.txt:
22-
cd tables; $(PYTHON) extract_resources.py ../$(ROM)
33+
@echo "Extracting game resources"
34+
@cd tables; $(PYTHON) extract_resources.py ../$(ROM)
2335

2436
clean: clean_obj clean_gen
2537
clean_obj:
26-
$(RM) $(OBJS) $(TARGET_EXEC)
38+
@$(RM) $(OBJS) $(TARGET_EXEC)
2739
clean_gen:
28-
$(RM) tables/zelda3_assets.dat
40+
@$(RM) $(RES) tables/zelda3_assets.dat tables/*.txt tables/*.png tables/sprites/*.png tables/*.yaml
41+
@rm -rf tables/__pycache__ tables/dungeon tables/img tables/overworld tables/sound

glsl_shader.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <assert.h>
88
#include <string.h>
99
#define STB_IMAGE_IMPLEMENTATION
10+
#define STBI_NO_THREAD_LOCALS
1011
#define STBI_ONLY_PNG
1112
#define STBI_MAX_DIMENSIONS 4096
1213
#define STBI_NO_FAILURE_STRINGS

0 commit comments

Comments
 (0)