Clean up the Makefile

This commit is contained in:
Yamagi Burmeister 2012-06-05 10:37:34 +02:00
parent 28be8cda8e
commit bf590cbba5
4 changed files with 14 additions and 34 deletions

View file

@ -14,7 +14,7 @@
# Platforms: #
# - Linux #
# - FreeBSD #
# - Windows #
# - Windows (MinGW) #
# ------------------------------------------------------ #
# User configurable options
@ -37,17 +37,17 @@ WITH_OGG:=yes
# installed
WITH_OPENAL:=yes
# Enables retexturing support. Adds a dependency to
# libjpeg
# Enables retexturing support. Adds
# a dependency to libjpeg
WITH_RETEXTURING:=yes
# Set the gamma via X11 and not via SDL. This works
# around problems in some SDL version. Adds dependencies
# to pkg-config, libX11 and libXxf86vm. Unsupported in
# to pkg-config, libX11 and libXxf86vm. Unsupported on
# Windows.
WITH_X11GAMMA:=no
# Enables opening of ZIP files (also known as .pk3 packs).
# Enables opening of ZIP files (also known as .pk3 paks).
# Adds a dependency to libz
WITH_ZIP:=yes
@ -118,9 +118,7 @@ endif
# ----------
# Extra CFLAGS for SDL
ifeq ($(OSTYPE), Windows)
SDLCFLAGS :=
else
ifneq ($(OSTYPE), Windows)
SDLCFLAGS := $(shell sdl-config --cflags)
endif
@ -131,14 +129,9 @@ ifneq ($(OSTYPE), Windows)
ifeq ($(WITH_X11GAMMA),yes)
X11CFLAGS := $(shell pkg-config x11 --cflags)
X11CFLAGS += $(shell pkg-config xxf86vm --cflags)
else
X11CFLAGS :=
endif
else
X11CFLAGS :=
endif
# ----------
# Base include path.
@ -175,11 +168,7 @@ ifneq ($(OSTYPE), Windows)
ifeq ($(WITH_X11GAMMA),yes)
X11LDFLAGS := $(shell pkg-config x11 --libs)
X11LDFLAGS += $(shell pkg-config xxf86vm --libs)
else
X11LDFLAGS :=
endif
else
X11LDFLAGS :=
endif
# ----------
@ -217,12 +206,12 @@ endif
ifeq ($(OSTYPE), Windows)
client:
@echo "===> Building quake2.exe"
${Q}mkdir.exe -p release
${Q}stuff/misc/mkdir.exe -p release
$(MAKE) release/quake2.exe
build/client/%.o: %.c
@echo "===> CC $<"
${Q}mkdir.exe -p $(@D)
${Q}stuff/misc/mkdir.exe -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
ifeq ($(WITH_CDA),yes)
@ -278,12 +267,12 @@ endif
ifeq ($(OSTYPE), Windows)
server:
@echo "===> Building q2ded"
${Q}mkdir.exe -p release
${Q}stuff/misc/mkdir.exe -p release
$(MAKE) release/q2ded.exe
build/server/%.o: %.c
@echo "===> CC $<"
${Q}mkdir.exe -p $(@D)
${Q}stuff/misc/mkdir.exe -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/q2ded.exe : CFLAGS += -DDEDICATED_ONLY
@ -319,20 +308,16 @@ endif
ifeq ($(OSTYPE), Windows)
refresher:
@echo "===> Building ref_gl.dll"
${Q}mkdir.exe -p release
${Q}stuff/misc/mkdir.exe -p release
$(MAKE) release/ref_gl.dll
build/refresher/%.o: %.c
@echo "===> CC $<"
${Q}mkdir.exe -p $(@D)
${Q}stuff/misc/mkdir.exe -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(X11CFLAGS) $(INCLUDE) -o $@ $<
release/ref_gl.dll : LDFLAGS += -shared
ifeq ($(WITH_X11GAMMA),yes)
release/ref_gl.dll : CFLAGS += -DX11GAMMA
endif
ifeq ($(WITH_RETEXTURING),yes)
release/ref_gl.dll : CFLAGS += -DRETEXTURE
release/ref_gl.dll : LDFLAGS += -ljpeg
@ -367,12 +352,12 @@ endif
ifeq ($(OSTYPE), Windows)
game:
@echo "===> Building baseq2/game.dll"
${Q}mkdir.exe -p release/baseq2
${Q}stuff/misc/mkdir.exe -p release/baseq2
$(MAKE) release/baseq2/game.dll
build/baseq2/%.o: %.c
@echo "===> CC $<"
${Q}mkdir.exe -p $(@D)
${Q}stuff/misc/mkdir.exe -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/baseq2/game.dll : LDFLAGS += -shared

5
TODO
View file

@ -2,11 +2,6 @@ Windows Port TODO
-----------------
- Check WITH_SYSTEMWIDE
- Currently the Makefiles needs a special "mkdir.exe" which
supports the -p option. We need a better aproach so that
the Windows buildin "mkdir" can be used.
- The Makefile needs some love. '' cannot be used as quotation
marks under Windows and shouled be changed to "".
- Ensure that all new headers have header guards.
- Replace atoi(), atol() and atof() in Windows code.
- Replace rand() with randk() in Windows code.