2006-04-13 20:47:06 +00:00
|
|
|
# EDuke32 Makefile for GNU Make
|
|
|
|
|
|
|
|
# SDK locations - adjust to match your setup
|
|
|
|
# DXROOT=c:/sdks/msc/dx61
|
|
|
|
|
|
|
|
# Engine options
|
|
|
|
SUPERBUILD = 1
|
|
|
|
POLYMOST = 1
|
|
|
|
USE_OPENGL = 1
|
|
|
|
NOASM = 0
|
|
|
|
|
|
|
|
# Debugging options
|
|
|
|
RELEASE?=1
|
2006-04-15 04:32:51 +00:00
|
|
|
JFAUD?=0
|
2006-11-20 04:55:37 +00:00
|
|
|
NOSOUND?=0
|
2006-11-28 22:53:11 +00:00
|
|
|
TESTNET?=0
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
# build locations
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
SRC=source
|
|
|
|
RSRC=rsrc
|
|
|
|
EROOT=../build
|
|
|
|
ESRC=$(EROOT)/src
|
|
|
|
EINC=$(EROOT)/include
|
2006-04-13 20:47:06 +00:00
|
|
|
INC=$(SRC)
|
|
|
|
o=o
|
|
|
|
|
|
|
|
ifneq (0,$(RELEASE))
|
|
|
|
# debugging disabled
|
2006-07-18 21:08:38 +00:00
|
|
|
debug=-fomit-frame-pointer -O2
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
# debugging enabled
|
2006-11-18 08:13:33 +00:00
|
|
|
debug=-ggdb -O0 -DDEBUGGINGAIDS
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
2006-11-19 08:24:46 +00:00
|
|
|
|
|
|
|
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration -Wno-unused \
|
2006-09-10 17:40:34 +00:00
|
|
|
-fno-pic -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -DNOCOPYPROTECT \
|
2006-08-31 01:54:23 +00:00
|
|
|
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib -I../jfaud/inc
|
2006-04-13 20:47:06 +00:00
|
|
|
OURCXXFLAGS=-fno-exceptions -fno-rtti
|
|
|
|
LIBS=-lm
|
2006-04-15 03:12:08 +00:00
|
|
|
ifneq (0,$(JFAUD))
|
2006-04-23 04:50:08 +00:00
|
|
|
JFAUDLIBS=../jfaud/libjfaud.a ../jfaud/mpadec/libmpadec.a
|
2006-07-14 07:28:32 +00:00
|
|
|
OURCFLAGS+=-DJFAUD
|
2006-04-15 03:12:08 +00:00
|
|
|
endif
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
NASMFLAGS=-s #-g
|
|
|
|
EXESUFFIX=
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
include $(EROOT)/Makefile.shared
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ifeq ($(PLATFORM),LINUX)
|
2006-08-31 01:54:23 +00:00
|
|
|
OBJ=obj.nix
|
|
|
|
EOBJ=eobj.nix
|
2006-04-13 20:47:06 +00:00
|
|
|
NASMFLAGS+= -f elf
|
|
|
|
else
|
2006-08-31 01:54:23 +00:00
|
|
|
OBJ=obj
|
|
|
|
EOBJ=eobj
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
JMACTOBJ=$(OBJ)/util_lib.$o \
|
|
|
|
$(OBJ)/file_lib.$o \
|
|
|
|
$(OBJ)/control.$o \
|
|
|
|
$(OBJ)/keyboard.$o \
|
|
|
|
$(OBJ)/mouse.$o \
|
|
|
|
$(OBJ)/mathutil.$o \
|
|
|
|
$(OBJ)/scriplib.$o
|
|
|
|
|
2006-11-18 08:46:58 +00:00
|
|
|
AUDIOLIB_FX_STUB=$(OBJ)/audiolib_fxstub.$o
|
|
|
|
AUDIOLIB_MUSIC_STUB=$(OBJ)/audiolib_musicstub.$o
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
AUDIOLIB_FX_SDL=$(OBJ)/mv_mix.$o \
|
|
|
|
$(OBJ)/mv_mix16.$o \
|
|
|
|
$(OBJ)/mvreverb.$o \
|
|
|
|
$(OBJ)/ll_man.$o \
|
|
|
|
$(OBJ)/fx_man.$o \
|
2006-11-18 08:46:58 +00:00
|
|
|
$(OBJ)/dsl.$o \
|
|
|
|
$(OBJ)/pitch.$o \
|
|
|
|
$(OBJ)/multivoc.$o
|
2006-11-16 03:02:42 +00:00
|
|
|
AUDIOLIB_MUSIC_SDL=$(OBJ)/sdlmusic.$o \
|
|
|
|
$(OBJ)/unixglob.$o
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
AUDIOLIB_JFAUD=$(OBJ)/jfaud_sounds.$o
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
AUDIOLIB_FX=$(OBJ)/mv_mix.$o \
|
|
|
|
$(OBJ)/mv_mix16.$o \
|
|
|
|
$(OBJ)/mvreverb.$o \
|
|
|
|
$(OBJ)/pitch.$o \
|
|
|
|
$(OBJ)/multivoc.$o \
|
|
|
|
$(OBJ)/ll_man.$o \
|
|
|
|
$(OBJ)/fx_man.$o \
|
|
|
|
$(OBJ)/dsoundout.$o
|
|
|
|
AUDIOLIB_MUSIC=$(OBJ)/midi.$o \
|
|
|
|
$(OBJ)/mpu401.$o \
|
|
|
|
$(OBJ)/music.$o
|
|
|
|
|
|
|
|
GAMEOBJS=$(OBJ)/game.$o \
|
|
|
|
$(OBJ)/actors.$o \
|
|
|
|
$(OBJ)/anim.$o \
|
|
|
|
$(OBJ)/animlib.$o \
|
|
|
|
$(OBJ)/config.$o \
|
|
|
|
$(OBJ)/gamedef.$o \
|
|
|
|
$(OBJ)/gameexec.$o \
|
|
|
|
$(OBJ)/global.$o \
|
|
|
|
$(OBJ)/menus.$o \
|
|
|
|
$(OBJ)/namesdyn.$o \
|
|
|
|
$(OBJ)/player.$o \
|
|
|
|
$(OBJ)/premap.$o \
|
|
|
|
$(OBJ)/savegame.$o \
|
|
|
|
$(OBJ)/sector.$o \
|
|
|
|
$(OBJ)/rts.$o \
|
|
|
|
$(OBJ)/testcd.$o \
|
|
|
|
$(OBJ)/osdfuncs.$o \
|
|
|
|
$(OBJ)/osdcmds.$o \
|
2006-11-16 03:02:42 +00:00
|
|
|
$(OBJ)/grpscan.$o \
|
2006-04-13 20:47:06 +00:00
|
|
|
$(JMACTOBJ)
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
EDITOROBJS=$(OBJ)/astub.$o
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
|
|
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include
|
|
|
|
NASMFLAGS+= -DUNDERSCORES -f win32
|
2006-08-31 01:54:23 +00:00
|
|
|
GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o
|
|
|
|
EDITOROBJS+= $(OBJ)/buildres.$o
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RENDERTYPE),SDL)
|
2006-11-18 08:46:58 +00:00
|
|
|
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell sdl-config --cflags))
|
2006-04-15 03:12:08 +00:00
|
|
|
|
|
|
|
ifneq (0,$(JFAUD))
|
|
|
|
AUDIOLIBOBJ=$(AUDIOLIB_JFAUD)
|
|
|
|
else
|
2006-11-18 08:46:58 +00:00
|
|
|
ifneq ($(PLATFORM),WINDOWS)
|
|
|
|
AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_SDL) $(AUDIOLIB_FX_SDL) $(OBJ)/sounds.$o
|
|
|
|
LIBS+= -lSDL_mixer
|
|
|
|
else
|
|
|
|
AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_STUB) $(AUDIOLIB_FX_STUB) $(OBJ)/sounds.$o
|
|
|
|
endif
|
2006-04-15 03:12:08 +00:00
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
ifeq (1,$(HAVE_GTK2))
|
|
|
|
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
|
2006-08-31 01:54:23 +00:00
|
|
|
GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
|
|
|
|
EDITOROBJS+= $(OBJ)/editor_banner.$o
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
GAMEOBJS+= $(OBJ)/game_icon.$o
|
|
|
|
EDITOROBJS+= $(OBJ)/build_icon.$o
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RENDERTYPE),WIN)
|
2006-04-15 03:12:08 +00:00
|
|
|
ifneq (0,$(JFAUD))
|
|
|
|
AUDIOLIBOBJ=$(AUDIOLIB_JFAUD)
|
|
|
|
else
|
2006-08-31 01:54:23 +00:00
|
|
|
AUDIOLIBOBJ=$(AUDIOLIB_MUSIC) $(AUDIOLIB_FX) $(OBJ)/sounds.$o
|
2006-04-15 03:12:08 +00:00
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
2006-11-20 04:55:37 +00:00
|
|
|
ifeq ($(NOSOUND),1)
|
|
|
|
AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_STUB) $(AUDIOLIB_FX_STUB) $(OBJ)/sounds.$o
|
|
|
|
endif
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
GAMEOBJS+= $(AUDIOLIBOBJ)
|
|
|
|
OURCFLAGS+= $(BUILDCFLAGS)
|
|
|
|
OURCXXFLAGS+= $(BUILDCFLAGS)
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
.PHONY: clean all engine $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
# TARGETS
|
|
|
|
|
|
|
|
# Invoking Make from the terminal in OSX just chains the build on to xcode
|
|
|
|
ifeq ($(PLATFORM),DARWIN)
|
|
|
|
ifeq ($(RELEASE),0)
|
|
|
|
style=Development
|
|
|
|
else
|
|
|
|
style=Deployment
|
|
|
|
endif
|
|
|
|
.PHONY: alldarwin
|
|
|
|
alldarwin:
|
|
|
|
cd osx && xcodebuild -target All -buildstyle $(style)
|
|
|
|
endif
|
|
|
|
|
2006-05-01 22:49:09 +00:00
|
|
|
ifeq ($(PLATFORM),WINDOWS)
|
|
|
|
all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) duke3d_w32$(EXESUFFIX)
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX)
|
2006-05-01 22:49:09 +00:00
|
|
|
endif
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB)
|
2006-05-01 06:52:06 +00:00
|
|
|
$(CC) -o $@ $^ $(JFAUDLIBS) $(LIBS) $(STDCPPLIB) -Wl,-Map=$@.map
|
2006-11-19 08:43:27 +00:00
|
|
|
-rm -f eduke32.sym$(EXESUFFIX)
|
2006-04-13 20:47:06 +00:00
|
|
|
cp eduke32$(EXESUFFIX) eduke32.sym$(EXESUFFIX)
|
|
|
|
strip eduke32$(EXESUFFIX)
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB)
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) -Wl,-Map=$@.map
|
2006-11-19 08:43:27 +00:00
|
|
|
-rm -f mapster32.sym$(EXESUFFIX)
|
2006-04-13 20:47:06 +00:00
|
|
|
cp mapster32$(EXESUFFIX) mapster32.sym$(EXESUFFIX)
|
|
|
|
strip mapster32$(EXESUFFIX)
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
duke3d_w32$(EXESUFFIX): $(OBJ)/wrapper.$o
|
2006-05-01 06:52:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ -Wl
|
|
|
|
strip duke3d_w32$(EXESUFFIX)
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
include Makefile.deps
|
|
|
|
|
|
|
|
.PHONY: enginelib editorlib
|
|
|
|
enginelib editorlib:
|
2006-11-19 07:09:43 +00:00
|
|
|
-mkdir -p $(EOBJ)
|
2006-08-31 01:54:23 +00:00
|
|
|
$(MAKE) -C $(EROOT)/ "OBJ=$(CURDIR)/$(EOBJ)" \
|
2006-04-13 20:47:06 +00:00
|
|
|
SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) \
|
2006-11-28 22:53:11 +00:00
|
|
|
USE_OPENGL=$(USE_OPENGL) TESTNET=$(TESTNET) \
|
2006-05-12 21:55:05 +00:00
|
|
|
NOASM=$(NOASM) RELEASE=$(RELEASE) $@
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(EOBJ)/$(ENGINELIB): enginelib
|
|
|
|
$(EOBJ)/$(EDITORLIB): editorlib
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
# RULES
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.nasm
|
2006-04-13 20:47:06 +00:00
|
|
|
nasm $(NASMFLAGS) $< -o $@
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/jaudiolib/%.nasm
|
2006-04-13 20:47:06 +00:00
|
|
|
nasm $(NASMFLAGS) $< -o $@
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.c
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/%.cpp
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/jmact/%.c
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/jaudiolib/%.c
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
2006-07-14 07:28:32 +00:00
|
|
|
|
|
|
|
ifeq (1,$(JFAUD))
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/misc/%.rc
|
|
|
|
windres -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) -DJFAUD
|
2006-07-14 07:28:32 +00:00
|
|
|
else
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/misc/%.rc
|
|
|
|
windres -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC)
|
2006-07-14 07:28:32 +00:00
|
|
|
endif
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(SRC)/util/%.c
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/%.$o: $(RSRC)/%.c
|
2006-04-13 20:47:06 +00:00
|
|
|
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
|
|
|
|
2006-08-31 01:54:23 +00:00
|
|
|
$(OBJ)/game_banner.$o: $(RSRC)/game_banner.c
|
|
|
|
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
|
|
|
|
$(RSRC)/game_banner.c: $(RSRC)/game.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//' >> $@
|
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
|
|
|
|
clean:
|
|
|
|
ifeq ($(PLATFORM),DARWIN)
|
|
|
|
cd osx && xcodebuild -target All clean
|
|
|
|
else
|
2006-08-31 01:54:23 +00:00
|
|
|
-rm -f $(OBJ)/* eduke32$(EXESUFFIX) eduke32.sym$(EXESUFFIX) mapster32$(EXESUFFIX) mapster32.sym$(EXESUFFIX) core* duke3d_w32$(EXESUFFIX)
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
veryclean: clean
|
|
|
|
ifeq ($(PLATFORM),DARWIN)
|
|
|
|
else
|
2006-08-31 01:54:23 +00:00
|
|
|
-rm -f $(EOBJ)/*
|
2006-04-13 20:47:06 +00:00
|
|
|
endif
|