2008-08-20 22:58:09 +00:00
|
|
|
#
|
2006-04-13 20:47:06 +00:00
|
|
|
# Build Makefile for GNU Make
|
2008-08-20 22:58:09 +00:00
|
|
|
#
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
# Notes:
|
|
|
|
# As of 6 July 2005, the engine should handle optimisations being enabled.
|
|
|
|
# If things seem to be going wrong, lower or disable optimisations, then
|
|
|
|
# try again. If things are still going wrong, call me.
|
|
|
|
#
|
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
include ../Makefile.common
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
# SDK locations for Windows - adjust to match your setup
|
|
|
|
#
|
2010-12-19 22:29:01 +00:00
|
|
|
ifneq ($(DXROOT_OVERRIDE),)
|
|
|
|
DXROOT=$(DXROOT_OVERRIDE)
|
|
|
|
else
|
|
|
|
DXROOT=c:/sdks/directx/dx61
|
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
FMODROOTWIN=c:/sdks/fmodapi374win/api
|
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
# Build locations - OBJ gets overridden to the game-specific objects dir
|
|
|
|
#
|
2006-08-31 01:54:23 +00:00
|
|
|
OBJ?=obj.gnu
|
|
|
|
SRC=src
|
|
|
|
RSRC=rsrc
|
|
|
|
INC=include
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-12 04:16:41 +00:00
|
|
|
# ENETROOT=$(SRC)/enet
|
2008-11-11 13:24:05 +00:00
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
# Filename extensions - these won't need to change
|
|
|
|
#
|
2006-04-13 20:47:06 +00:00
|
|
|
o=o
|
|
|
|
res=o
|
|
|
|
asm=nasm
|
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
# Debugging and release
|
|
|
|
#
|
|
|
|
ifneq ($(RELEASE),0)
|
2010-07-03 08:53:57 +00:00
|
|
|
# Debugging disabled
|
2010-12-19 22:29:01 +00:00
|
|
|
debug+= $(F_NO_STACK_PROTECTOR)
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2010-07-03 08:53:57 +00:00
|
|
|
# Debugging enabled
|
2010-12-19 22:29:01 +00:00
|
|
|
debug+= -DNOSDLPARACHUTE
|
|
|
|
LIBS+= $(L_SSP) -Wl,--enable-auto-import
|
2009-04-07 18:56:22 +00:00
|
|
|
endif
|
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -I$(INC) $(ARCH)
|
2010-12-19 22:29:01 +00:00
|
|
|
OURCXXFLAGS=$(BASECXXFLAGS)
|
|
|
|
ASFLAGS=$(BASEASFLAGS)
|
2008-09-26 17:20:10 +00:00
|
|
|
|
2011-12-04 18:09:50 +00:00
|
|
|
ifneq ($(LUNATIC),0)
|
|
|
|
OURCFLAGS+= -DLUNATIC_ENABLE
|
|
|
|
endif
|
|
|
|
|
2010-12-19 22:29:01 +00:00
|
|
|
include Makefile.shared
|
2010-08-12 21:06:51 +00:00
|
|
|
|
2012-03-04 20:11:49 +00:00
|
|
|
UTILLIBS= # -lpthread
|
|
|
|
UTILADDOBJS=
|
|
|
|
ifneq (0,$(NEDMALLOC))
|
|
|
|
UTILADDOBJS+= $(OBJ)/nedmalloc.$o
|
|
|
|
endif
|
2010-08-13 06:45:38 +00:00
|
|
|
|
2006-09-10 17:40:34 +00:00
|
|
|
ENGINEOBJS=
|
|
|
|
ifeq (0,$(NOASM))
|
|
|
|
ENGINEOBJS+= $(OBJ)/a.$o
|
2011-06-15 10:38:12 +00:00
|
|
|
else
|
|
|
|
ENGINEOBJS+= $(OBJ)/a-c.$o
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
2010-05-03 08:30:25 +00:00
|
|
|
ifneq ($(PLATFORM),WINDOWS)
|
|
|
|
LIBS+= -ldl -pthread
|
|
|
|
endif
|
2011-10-11 16:53:52 +00:00
|
|
|
ifeq ($(PLATFORM),DARWIN)
|
|
|
|
ifneq ($(USE_LIBPNG),0)
|
|
|
|
OURCFLAGS+= -I/opt/local/include
|
|
|
|
LIBS+= -L/opt/local/lib -lpng
|
|
|
|
endif
|
|
|
|
endif
|
2010-05-03 08:30:25 +00:00
|
|
|
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
ENGINEOBJS+= \
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/baselayer.$o \
|
|
|
|
$(OBJ)/cache1d.$o \
|
|
|
|
$(OBJ)/compat.$o \
|
|
|
|
$(OBJ)/crc32.$o \
|
|
|
|
$(OBJ)/defs.$o \
|
|
|
|
$(OBJ)/engine.$o \
|
2008-12-02 10:44:39 +00:00
|
|
|
$(OBJ)/polymost.$o \
|
|
|
|
$(OBJ)/hightile.$o \
|
|
|
|
$(OBJ)/textfont.$o \
|
|
|
|
$(OBJ)/smalltextfont.$o \
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/kplib.$o \
|
2009-12-05 09:22:43 +00:00
|
|
|
$(OBJ)/quicklz.$o \
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/md4.$o \
|
|
|
|
$(OBJ)/osd.$o \
|
|
|
|
$(OBJ)/pragmas.$o \
|
2009-06-09 02:12:35 +00:00
|
|
|
$(OBJ)/scriptfile.$o \
|
2010-05-18 00:30:30 +00:00
|
|
|
$(OBJ)/mutex.$o
|
2008-11-11 13:24:05 +00:00
|
|
|
|
2009-05-07 16:00:49 +00:00
|
|
|
ifeq (1,$(USE_OPENGL))
|
2010-08-12 21:06:51 +00:00
|
|
|
ENGINEOBJS+= $(OBJ)/mdsprite.$o
|
|
|
|
ENGINEOBJS+= $(OBJ)/glbuild.$o
|
2009-05-07 16:00:49 +00:00
|
|
|
endif
|
|
|
|
|
2008-05-10 01:29:37 +00:00
|
|
|
ifeq (1,$(POLYMER))
|
2010-08-12 21:06:51 +00:00
|
|
|
ENGINEOBJS+= $(OBJ)/polymer.$o
|
2008-05-10 01:29:37 +00:00
|
|
|
endif
|
2006-08-31 01:54:23 +00:00
|
|
|
|
2010-05-18 00:30:30 +00:00
|
|
|
ifeq (1,$(NEDMALLOC))
|
2010-08-12 21:06:51 +00:00
|
|
|
ENGINEOBJS+= $(OBJ)/nedmalloc.$o
|
2010-05-18 00:30:30 +00:00
|
|
|
endif
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
EDITOROBJS=$(OBJ)/build.$o \
|
|
|
|
$(OBJ)/config.$o
|
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
# PLATFORM SPECIFIC SETTINGS
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
ifeq ($(PLATFORM),LINUX)
|
2010-08-12 21:06:51 +00:00
|
|
|
ASFLAGS+= -f elf
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
2008-08-20 22:58:09 +00:00
|
|
|
ifeq ($(PLATFORM),DARWIN)
|
2012-03-04 09:30:27 +00:00
|
|
|
ENGINEOBJS += $(OBJ)/osxbits.$o $(OBJ)/StartupWinController.editor.$o
|
2011-10-11 16:53:52 +00:00
|
|
|
ASFLAGS += -f macho -DUNDERSCORES
|
|
|
|
OURCFLAGS += -fno-pic -DUNDERSCORES
|
2008-08-20 22:58:09 +00:00
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
ifeq ($(PLATFORM),BSD)
|
2010-08-12 21:06:51 +00:00
|
|
|
ASFLAGS+= -f elf
|
|
|
|
OURCFLAGS+= -I/usr/X11R6/include
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
2010-08-12 21:06:51 +00:00
|
|
|
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include
|
|
|
|
LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT)
|
|
|
|
ASFLAGS+= -DUNDERSCORES -f win32
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),BEOS)
|
2010-08-12 21:06:51 +00:00
|
|
|
ASFLAGS+= -f elf
|
|
|
|
TARGETOPTS+= -DNOASM
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM),SYLLABLE)
|
2010-08-12 21:06:51 +00:00
|
|
|
ASFLAGS+= -f elf
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RENDERTYPE),SDL)
|
2010-08-12 21:06:51 +00:00
|
|
|
ENGINEOBJS+= $(OBJ)/sdlayer.$o
|
|
|
|
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS))
|
|
|
|
|
|
|
|
ifeq (1,$(HAVE_GTK2))
|
|
|
|
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
|
|
|
|
ENGINEOBJS+= $(OBJ)/gtkbits.$o
|
|
|
|
ifeq ($(LINKED_GTK),0)
|
|
|
|
ENGINEOBJS+= $(OBJ)/dynamicgtk.$o
|
|
|
|
endif
|
|
|
|
EDITOROBJS+= $(OBJ)/startgtk.editor.$o
|
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(RENDERTYPE),WIN)
|
2010-08-12 21:06:51 +00:00
|
|
|
ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o
|
|
|
|
EDITOROBJS+= $(OBJ)/startwin.editor.$o
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
OURCFLAGS+= $(BUILDCFLAGS)
|
|
|
|
|
2008-10-22 04:14:30 +00:00
|
|
|
.SILENT:
|
2012-03-04 20:11:49 +00:00
|
|
|
.PHONY: clean cleanutils veryclean all utils enginelib editorlib
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
# TARGETS
|
|
|
|
|
2012-03-04 20:12:15 +00:00
|
|
|
UTILOBJS=$(OBJ)/kextract.$o $(OBJ)/kgroup.$o $(OBJ)/transpal.$o $(OBJ)/wad2art.$o $(OBJ)/wad2map.$o $(OBJ)/md2tool.$o \
|
|
|
|
$(OBJ)/compat.$o $(OBJ)/pragmas.$o
|
|
|
|
UTILS=kextract kgroup transpal wad2art wad2map md2tool
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-10-22 04:14:30 +00:00
|
|
|
# all: $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB)
|
2006-04-13 20:47:06 +00:00
|
|
|
utils: $(UTILS)
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
enginelib: $(OBJ)/$(ENGINELIB)
|
|
|
|
$(OBJ)/$(ENGINELIB): $(ENGINEOBJS)
|
2010-12-19 22:29:01 +00:00
|
|
|
$(BUILD_ECHOFLAGS)
|
|
|
|
$(ARCHIVE_STATUS)
|
|
|
|
if $(AR) rc $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
editorlib: $(OBJ)/$(EDITORLIB)
|
|
|
|
$(OBJ)/$(EDITORLIB): $(EDITOROBJS)
|
2010-12-19 22:29:01 +00:00
|
|
|
$(BUILD_ECHOFLAGS)
|
|
|
|
$(ARCHIVE_STATUS)
|
|
|
|
if $(AR) rc $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
2012-03-04 20:11:49 +00:00
|
|
|
#pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o
|
|
|
|
# $(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^
|
|
|
|
|
|
|
|
kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
|
|
|
kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
|
|
|
transpal$(EXESUFFIX): $(OBJ)/transpal.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
|
|
|
wad2art$(EXESUFFIX): $(OBJ)/wad2art.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
|
|
|
wad2map$(EXESUFFIX): $(OBJ)/wad2map.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
|
|
|
md2tool$(EXESUFFIX): $(OBJ)/md2tool.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
2006-08-31 01:54:23 +00:00
|
|
|
generateicon$(EXESUFFIX): $(OBJ)/generateicon.$o $(OBJ)/kplib.$o
|
2012-03-04 20:11:49 +00:00
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
|
|
|
cacheinfo$(EXESUFFIX): $(OBJ)/cacheinfo.$o $(OBJ)/compat.$o $(UTILADDOBJS)
|
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
enumdisplay$(EXESUFFIX): src/misc/enumdisplay.c
|
2012-03-04 20:11:49 +00:00
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -g -Os -o $@ $^ $(UTILLIBS) -I$(DXROOT)/include -lgdi32; then $(ONESTEP_OK); fi
|
2006-08-31 01:54:23 +00:00
|
|
|
mapdump$(EXESUFFIX): $(OBJ)/mapdump.$o
|
2012-03-04 20:11:49 +00:00
|
|
|
$(ONESTEP_STATUS)
|
|
|
|
if $(CC) -o $@ $^ $(UTILLIBS); then $(ONESTEP_OK); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
# DEPENDENCIES
|
|
|
|
include Makefile.deps
|
|
|
|
|
|
|
|
# RULES
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.nasm
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(AS) $(ASFLAGS) $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.c
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-20 22:58:09 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.m
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2008-08-20 22:58:09 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.cpp
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-11 13:24:05 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.cxx
|
|
|
|
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/misc/%.rc
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC); then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/util/%.c
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(RSRC)/%.c
|
2008-10-18 13:25:23 +00:00
|
|
|
$(COMPILE_STATUS)
|
2008-10-19 12:14:04 +00:00
|
|
|
if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
|
2006-04-13 20:47:06 +00:00
|
|
|
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
|
|
|
|
gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
|
2006-08-31 01:54:23 +00:00
|
|
|
$(RSRC)/editor_banner.c: $(RSRC)/build.bmp
|
2006-04-13 20:47:06 +00:00
|
|
|
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
|
|
|
|
gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
|
|
|
|
|
|
|
|
# PHONIES
|
2008-08-20 22:58:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
clean:
|
2006-08-31 01:54:23 +00:00
|
|
|
-rm -f $(OBJ)/*
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-03-04 20:11:49 +00:00
|
|
|
cleanutils:
|
2012-03-04 20:12:15 +00:00
|
|
|
-rm -f $(UTILS) $(UTILOBJS)
|
2012-03-04 20:11:49 +00:00
|
|
|
|
|
|
|
veryclean: clean cleanutils
|
|
|
|
-rm -f $(ENGINELIB) $(EDITORLIB)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
.PHONY: fixlineends
|
|
|
|
fixlineends:
|
|
|
|
for a in `find . -type f \( -name '*.c' -o -name '*.h' -o -name 'Makefile*' \) \! -path '*/.svn/*'`; do \
|
|
|
|
echo Fixing $$a && tr -d "\015" < $$a > $$a.fix && mv $$a.fix $$a; \
|
|
|
|
done
|
2008-11-11 13:24:05 +00:00
|
|
|
|
|
|
|
# DO NOT DELETE
|
|
|
|
|
|
|
|
|