projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
dd92360
)
improved Makefiles to auto-detect SDL target version
author
Holger Schemel
<info@artsoft.org>
Tue, 3 Mar 2015 19:43:09 +0000
(20:43 +0100)
committer
Holger Schemel
<info@artsoft.org>
Tue, 3 Mar 2015 19:43:09 +0000
(20:43 +0100)
Makefile
patch
|
blob
|
history
src/Makefile
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index 03320a5f4f056718e1161f2f3c5cb25a6115e2f4..d5a21886056fd8d7d6048bd14295a3ea87866427 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-59,15
+59,13
@@
CROSS_PATH_WIN32 = /usr/local/cross-tools/i386-mingw32msvc
SRC_DIR = src
MAKE_CMD = $(MAKE) -C $(SRC_DIR)
SRC_DIR = src
MAKE_CMD = $(MAKE) -C $(SRC_DIR)
-DEFAULT_TARGET = sdl2
-
# -----------------------------------------------------------------------------
# build targets
# -----------------------------------------------------------------------------
all:
# -----------------------------------------------------------------------------
# build targets
# -----------------------------------------------------------------------------
all:
- @$(MAKE_CMD)
TARGET=$(DEFAULT_TARGET)
+ @$(MAKE_CMD)
sdl:
@$(MAKE_CMD) TARGET=sdl
sdl:
@$(MAKE_CMD) TARGET=sdl
@@
-79,13
+77,7
@@
mac:
@$(MAKE_CMD) PLATFORM=macosx
mac-static:
@$(MAKE_CMD) PLATFORM=macosx
mac-static:
- @$(MAKE_CMD) PLATFORM=macosx TARGET=sdl-static
-
-mac2-static:
- @$(MAKE_CMD) PLATFORM=macosx TARGET=sdl2-static
-
-os2:
- @$(MAKE_CMD) PLATFORM=os2
+ @$(MAKE_CMD) PLATFORM=macosx STATIC=true
cross-win32:
@PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32
cross-win32:
@PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32
@@
-218,4
+210,4
@@
tags:
$(MAKE_CMD) tags
depend dep:
$(MAKE_CMD) tags
depend dep:
- $(MAKE_CMD)
TARGET=$(DEFAULT_TARGET)
depend
+ $(MAKE_CMD) depend
diff --git
a/src/Makefile
b/src/Makefile
index 2a1afc908ceb0be4d268c3149edd2f8177c95147..ea1325d8ef0a2ad6738063e6b9a70b0fe584569a 100644
(file)
--- a/
src/Makefile
+++ b/
src/Makefile
@@
-42,26
+42,23
@@
PROGNAME = ../$(PROGBASE)
# configuring platform
# -----------------------------------------------------------------------------
# configuring platform
# -----------------------------------------------------------------------------
-ifeq ($(PLATFORM),solaris) #
native compiling to
Solaris
+ifeq ($(PLATFORM),solaris) #
compiling on
Solaris
EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH)
EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH)
-PLATFORM = unix
+
override
PLATFORM = unix
endif
endif
-ifeq ($(PLATFORM),macosx) #
native compiling to
Mac OS X
+ifeq ($(PLATFORM),macosx) #
compiling on
Mac OS X
EXTRA_LDFLAGS = -lstdc++
EXTRA_LDFLAGS = -lstdc++
-PLATFORM = unix
-TARGET = sdl
+override PLATFORM = unix
endif
endif
-ifeq ($(PLATFORM),unix) #
native compiling to Uni
x (generic)
+ifeq ($(PLATFORM),unix) #
compiling on Unix/Linu
x (generic)
PROFILING_FLAGS = -pg
endif
ifeq ($(PLATFORM),cross-win32) # cross-compiling to Windows
PROGNAME = ../$(PROGBASE).exe
EXTRA_LDFLAGS = -lshfolder -lwsock32
PROFILING_FLAGS = -pg
endif
ifeq ($(PLATFORM),cross-win32) # cross-compiling to Windows
PROGNAME = ../$(PROGBASE).exe
EXTRA_LDFLAGS = -lshfolder -lwsock32
-# TARGET = sdl
-TARGET = sdl2
endif
endif
@@
-69,6
+66,26
@@
endif
# configuring target
# -----------------------------------------------------------------------------
# configuring target
# -----------------------------------------------------------------------------
+ifndef TARGET # auto-detect compiling for SDL or SDL2
+ SDL_VERSION := $(shell sdl2-config --version 2> /dev/null)
+ ifdef SDL_VERSION
+ TARGET = sdl2
+ else
+ SDL_VERSION := $(shell sdl-config --version 2> /dev/null)
+ ifdef SDL_VERSION
+ TARGET = sdl
+ else
+ $(error SDL/SDL2 library not found)
+ endif
+ endif
+endif
+
+ifeq ($(STATIC),true) # check for static linking
+override TARGET := $(TARGET)-static
+endif
+
+# $(info Using SDL version $(SDL_VERSION) [TARGET == $(TARGET)])
+
ifeq ($(TARGET),sdl) # compiling for SDL target
SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg
ifeq ($(TARGET),sdl) # compiling for SDL target
SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg