Skip to content

Commit e4532dd

Browse files
committed
Tweak build rules to link correct SDL library
Close #381
1 parent ef5d4b2 commit e4532dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ $(call set-feature, Zifencei)
8484

8585
# Experimental SDL oriented system calls
8686
ENABLE_SDL ?= 1
87+
ifneq ("$(CC_IS_EMCC)", "1") # note that emcc generates port SDL headers/library, so it does not requires system SDL headers/library
8788
ifeq ($(call has, SDL), 1)
8889
ifeq (, $(shell which sdl2-config))
8990
$(warning No sdl2-config in $$PATH. Check SDL2 installation in advance)
@@ -101,6 +102,7 @@ $(OUT)/syscall_sdl.o: CFLAGS += $(shell sdl2-config --cflags)
101102
LDFLAGS += $(shell sdl2-config --libs) -pthread
102103
LDFLAGS += $(shell pkg-config --libs SDL2_mixer)
103104
endif
105+
endif
104106

105107
ENABLE_GDBSTUB ?= 0
106108
$(call set-feature, GDBSTUB)
@@ -148,6 +150,8 @@ endif
148150
ifeq ("$(CC_IS_EMCC)", "1")
149151
ifeq ($(call has, SDL), 1)
150152
CFLAGS_emcc += -sUSE_SDL=2 -sSDL2_MIXER_FORMATS=wav,mid -sUSE_SDL_MIXER=2
153+
OBJS_EXT += syscall_sdl.o
154+
LDFLAGS += -pthread
151155
endif
152156
endif
153157

0 commit comments

Comments
 (0)