Alter the Makefile again to bootstrap Windows

This version of the Makefile adds a horrible workaround for Windows
broken "mkdir". It'll be resolved before the first CFT is released.
This commit is contained in:
Yamagi Burmeister 2012-06-03 13:06:48 +02:00
parent ef5cc65664
commit d43e10b1b0

View file

@ -61,13 +61,13 @@ WITH_SYSTEMDIR:=""
# Detect the OS # Detect the OS
ifdef SystemRoot ifdef SystemRoot
OS ?= Windows OSTYPE := Windows
else else
OSTYPE := $(shell uname -s) OSTYPE := $(shell uname -s)
endif endif
# Detect the architecture # Detect the architecture
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
# At this time only i386 is supported on Windows # At this time only i386 is supported on Windows
ARCH := i386 ARCH := i386
else else
@ -115,7 +115,7 @@ endif
# ---------- # ----------
# Extra CFLAGS for SDL # Extra CFLAGS for SDL
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
SDLCFLAGS := $(shell sdl-config.exe --cflags) SDLCFLAGS := $(shell sdl-config.exe --cflags)
else else
SDLCFLAGS := $(shell sdl-config --cflags) SDLCFLAGS := $(shell sdl-config --cflags)
@ -124,7 +124,7 @@ endif
# ---------- # ----------
# Extra CFLAGS for X11 # Extra CFLAGS for X11
ifneq ($(OS), Windows) ifneq ($(OSTYPE), Windows)
ifeq ($(WITH_X11GAMMA),yes) ifeq ($(WITH_X11GAMMA),yes)
X11CFLAGS := $(shell pkg-config x11 --cflags) X11CFLAGS := $(shell pkg-config x11 --cflags)
X11CFLAGS += $(shell pkg-config xxf86vm --cflags) X11CFLAGS += $(shell pkg-config xxf86vm --cflags)
@ -157,7 +157,7 @@ endif
# ---------- # ----------
# Extra LDFLAGS for SDL # Extra LDFLAGS for SDL
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
SDLLDFLAGS := $(shell sdl-config.exe --libs) SDLLDFLAGS := $(shell sdl-config.exe --libs)
else else
SDLLDFLAGS := $(shell sdl-config --libs) SDLLDFLAGS := $(shell sdl-config --libs)
@ -166,7 +166,7 @@ endif
# ---------- # ----------
# Extra LDFLAGS for X11 # Extra LDFLAGS for X11
ifneq ($(OS), Windows) ifneq ($(OSTYPE), Windows)
ifeq ($(WITH_X11GAMMA),yes) ifeq ($(WITH_X11GAMMA),yes)
X11LDFLAGS := $(shell pkg-config x11 --libs) X11LDFLAGS := $(shell pkg-config x11 --libs)
X11LDFLAGS += $(shell pkg-config xxf86vm --libs) X11LDFLAGS += $(shell pkg-config xxf86vm --libs)
@ -191,7 +191,7 @@ endif
# ---------- # ----------
# Builds everything # Builds everything
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
all: server all: server
else else
all: client server refresher game all: client server refresher game
@ -200,7 +200,7 @@ endif
# ---------- # ----------
# Cleanup # Cleanup
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
clean: clean:
@echo "===> CLEAN" @echo "===> CLEAN"
@-rmdir /S /Q release build @-rmdir /S /Q release build
@ -244,15 +244,27 @@ endif
# ---------- # ----------
# The server # The server
ifeq ($(OSTYPE), Windows)
server: server:
@echo '===> Building q2ded' @echo "===> Building q2ded"
${Q}mkdir.exe -p release
$(MAKE) release/q2ded
build/server/%.o: %.c
@echo "===> CC $<"
${Q}mkdir.exe -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
else
server:
@echo "===> Building q2ded"
${Q}mkdir -p release ${Q}mkdir -p release
$(MAKE) release/q2ded $(MAKE) release/q2ded
build/server/%.o: %.c build/server/%.o: %.c
@echo '===> CC $<' @echo "===> CC $<"
${Q}mkdir -p $(@D) ${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< ${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
endif
release/q2ded : CFLAGS += -DDEDICATED_ONLY release/q2ded : CFLAGS += -DDEDICATED_ONLY
release/q2ded : LDFLAGS += -lz release/q2ded : LDFLAGS += -lz
@ -473,7 +485,7 @@ SERVER_OBJS_ := \
src/server/sv_user.o \ src/server/sv_user.o \
src/server/sv_world.o src/server/sv_world.o
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
SERVER_OBJS_ += \ SERVER_OBJS_ += \
src/windows/conproc.o \ src/windows/conproc.o \
src/windows/system.o src/windows/system.o
@ -547,9 +559,9 @@ release/quake2 : $(CLIENT_OBJS)
${Q}$(CC) $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@ ${Q}$(CC) $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
# release/q2ded # release/q2ded
ifeq ($(OS), Windows) ifeq ($(OSTYPE), Windows)
release/q2ded : $(SERVER_OBJS) release/q2ded : $(SERVER_OBJS)
@echo '===> LD $@.exe' @echo "===> LD $@.exe"
${Q}$(CC) $(SERVER_OBJS) $(LDFLAGS) -o $@.exe ${Q}$(CC) $(SERVER_OBJS) $(LDFLAGS) -o $@.exe
else else
release/q2ded : $(SERVER_OBJS) release/q2ded : $(SERVER_OBJS)