ecsv  committed b47c380

Allow to statically set SDL_(CFLAGS|LIBS) without sdl-config

n.pepinpe requested in #540 to allow overwriting the automatically searched
CFLAGS and LIBS for used libraries. This should allow distributors to set the
build configuration without patching the makefile. This is important for
systems were pkg-config or sdl-config aren't normally used.

  • Participants
  • Parent commits 008c0c5
  • Branches default

Comments (0)

Files changed (1)

File projects/unix/Makefile

 # default configuration programs
 # Since we are building a shared library, we must compile with -fPIC on some architectures
 # test for presence of SDL
-ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
-  $(error No SDL development libraries found!)
-ifeq ($(OS),FREEBSD)
-    CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
-    LDLIBS += $(shell $(SDL_CONFIG) --libs)
-ifeq ($(OS),OSX)
-    CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
+ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
+  SDL_CONFIG = $(CROSS_COMPILE)sdl-config
+  ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
+    $(error No SDL development libraries found!)
+  endif
+  ifeq ($(OS),OSX)
+    SDL_CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
     # sdl-config on mac screws up when we're trying to build a library and not an executable
     # SDL 1.3 is supposed to fix that, if it's ever released
-    LDLIBS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
+    SDL_LDLIBS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
+  else
+    SDL_CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
+    SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
+  endif
-ifeq ($(OS),LINUX)
-    CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
-    LDLIBS += $(shell $(SDL_CONFIG) --libs)
-ifeq ($(OS), MINGW)
-  CFLAGS += $(shell $(SDL_CONFIG) --cflags)
-  LDLIBS += $(shell $(SDL_CONFIG) --libs)
 # set mupen64plus core API header path
 ifneq ("$(APIDIR)","")