Strip out most duplicated Makefile stuff into Makefile.common -- this should make configuration and maintenance much less troublesome. Attention to everyone who builds their own Edukes: you may have to re-set some paths like the one to the DirectX SDK.

git-svn-id: https://svn.eduke32.com/eduke32@1739 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2010-12-19 22:29:01 +00:00
parent 2fec586906
commit 00fbd8267e
6 changed files with 193 additions and 198 deletions

View file

@ -2,44 +2,21 @@
# EDuke32 Makefile for GNU Make
#
# DEFINES
include Makefile.common
# Use colored output
PRETTY_OUTPUT = 1
# SDK locations - adjust to match your setup
DXROOT=../sdk/dx
#DXROOT=c:/sdks/directx/dx8
# Engine options
SUPERBUILD = 1
POLYMOST = 1
POLYMER = 1
USE_OPENGL = 1
NOASM = 0
LINKED_GTK = 0
BUILD32_ON_64 = 0
NEDMALLOC = 1
# Debugging/Build options
RELEASE?=1
DEBUGANYWAY?=0
KRANDDEBUG?=0
NOSOUND?=0
OPTLEVEL?=2
PROFILER?=0
ifneq (0,$(KRANDDEBUG))
RELEASE=0
endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
ifneq ($(DXROOT_OVERRIDE),)
DXROOT=$(DXROOT_OVERRIDE)
else
DXROOT=../sdk/dx
#DXROOT=c:/sdks/directx/dx8
endif
# Build locations
SRC=source
RSRC=rsrc
EROOT=build
ESRC=$(EROOT)/src
EINC=$(EROOT)/include
INC=$(SRC)
@ -48,22 +25,21 @@ o=o
ifneq (0,$(RELEASE))
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) $(F_NO_STACK_PROTECTOR)
LIBS=-lm
debug+= $(F_NO_STACK_PROTECTOR)
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS
LIBS=-lm -rdynamic
ifneq (0,$(KRANDDEBUG))
debug+=-fno-inline -fno-inline-functions -fno-inline-functions-called-once
debug+=-DKRANDDEBUG=1
debug+= -fno-inline -fno-inline-functions -fno-inline-functions-called-once
endif
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
OURCFLAGS=$(BASECFLAGS) \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include \
$(ARCH)
OURCXXFLAGS=$(BASECXXFLAGS)
NASMFLAGS=$(BASEASFLAGS)
JAUDIOLIBDIR=$(SRC)/jaudiolib
JAUDIOLIB=libjfaudiolib.a
@ -71,24 +47,10 @@ JAUDIOLIB=libjfaudiolib.a
ENETDIR=$(SRC)/enet
ENETLIB=libenet.a
CC=gcc
CXX=g++
AS=nasm
RC=windres
STRIP=strip
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) $(ARCH)
OURCXXFLAGS=-fno-exceptions -fno-rtti
NASMFLAGS= -s
EXESUFFIX=
include $(EROOT)/Makefile.shared
ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win
EOBJ=eobj_win
@ -138,7 +100,8 @@ EDITOROBJS=$(OBJ)/astub.$o \
$(OBJ)/m32def.$o \
$(OBJ)/m32exec.$o \
$(OBJ)/m32vars.$o \
$(OBJ)/mathutil.$o
$(OBJ)/mathutil.$o \
$(OBJ)/sounds_mapster32.$o
# PLATFORM SPECIFIC SETTINGS
@ -200,7 +163,6 @@ else
endif
EDITOROBJS+= $(OBJ)/sounds_mapster32.$o
OURCFLAGS+= $(BUILDCFLAGS)
OURCXXFLAGS+= $(BUILDCFLAGS)
@ -254,8 +216,9 @@ enginelib editorlib:
-mkdir -p $(EOBJ)
ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(EROOT)\033[0;35m \033[0m\n"
endif
$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" \
endif
$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@
#\
SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\
USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) PROFILER=$(PROFILER)\
NOASM=$(NOASM) NEDMALLOC=$(NEDMALLOC) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $@
@ -269,7 +232,7 @@ $(JAUDIOLIBDIR)/$(JAUDIOLIB):
ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(JAUDIOLIBDIR)\033[0;35m \033[0m\n"
endif
$(MAKE) -C $(JAUDIOLIBDIR) PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) DEBUGANYWAY=$(DEBUGANYWAY)
$(MAKE) -C $(JAUDIOLIBDIR) #PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) DEBUGANYWAY=$(DEBUGANYWAY)
ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
endif
@ -278,7 +241,7 @@ $(ENETDIR)/$(ENETLIB):
ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(ENETDIR)\033[0;35m \033[0m\n"
endif
$(MAKE) -C $(ENETDIR) PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL)
$(MAKE) -C $(ENETDIR) #PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL)
ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
endif

View file

@ -0,0 +1,101 @@
## common definitions for Makefile, build/Makefile, source/enet/Makefile and
## source/jaudiolib/Makefile
# Use colored output
PRETTY_OUTPUT = 1
# DirectX SDK location - if nonempty, overrides the DXROOTs of the individual
# Makefiles. Should be set to an absolute path since this Makefile is included
# at different directory levels
DXROOT_OVERRIDE:=
# Engine options
# SUPERBUILD - enables voxels
# POLYMOST - enables Polymost renderer
# USE_OPENGL - enables OpenGL support in Polymost
# NOASM - disables the use of inline assembly pragmas
# LINKED_GTK - enables compile-time linkage to GTK
#
SUPERBUILD = 1
POLYMOST = 1
POLYMER = 1
USE_OPENGL = 1
NOASM = 0
LINKED_GTK = 0
BUILD32_ON_64 = 0
NEDMALLOC = 1
ifeq (0,$(USE_OPENGL))
POLYMOST = 0
POLYMER = 0
endif
# Debugging/Build options
# RELEASE - 1 = no debugging
# DEBUGANYWAY - 1 = include debug symbols even when generating release code
# KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
# OPTLEVEL - 0..3 = GCC optimization strategy
#
RELEASE?=1
DEBUGANYWAY?=0
KRANDDEBUG?=0
EFENCE?=0
OPTLEVEL?=2
PROFILER?=0
NOSOUND?=0
ifneq (0,$(KRANDDEBUG))
RELEASE=0
endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
endif
# Tools
CC=gcc
CXX=g++
AS=nasm
AR=ar
RC=windres
RANLIB=ranlib
STRIP=strip
# compiler flags etc.
LIBS=-lm
ifneq (0,$(RELEASE))
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL)
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS
LIBS+=-rdynamic
ifneq (0,$(PROFILER))
LIBS+= -lprofiler
debug+= -pg
endif
ifneq (0,$(KRANDDEBUG))
debug+=-DKRANDDEBUG=1
endif
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
BASECFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES)
BASECXXFLAGS= -fno-exceptions -fno-rtti
BASEASFLAGS=-s #-g
# Misc. stuff that is constant between Makefiles
EROOT:=build
# will be potentially overridden in build/Makefile.shared
EXESUFFIX=

View file

@ -8,52 +8,16 @@
# try again. If things are still going wrong, call me.
#
# Use colored output
PRETTY_OUTPUT = 1
include ../Makefile.common
# Engine options - these may be overridden by game makefiles
# SUPERBUILD - enables voxels
# POLYMOST - enables Polymost renderer
# USE_OPENGL - enables OpenGL support in Polymost
# NOASM - disables the use of inline assembly pragmas
# LINKED_GTK - enables compile-time linkage to GTK
#
SUPERBUILD ?= 1
POLYMOST ?= 1
POLYMER ?= 1
USE_OPENGL ?= 1
NOASM ?= 0
LINKED_GTK ?= 0
BUILD32_ON_64 ?= 0
NEDMALLOC ?= 1
ifeq (0,$(USE_OPENGL))
POLYMER = 0
endif
# Debugging/Build options
# RELEASE - 1 = no debugging
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
# OPTLEVEL - 0..3 = GCC optimization strategy
#
RELEASE?=1
DEBUGANYWAY?=0
KRANDDEBUG?=0
EFENCE?=0
OPTLEVEL?=2
PROFILER?=0
ifneq (0,$(KRANDDEBUG))
RELEASE=0
endif
ifneq (0,$(PROFILER))
DEBUGANYWAY=1
endif
# SDK locations for Windows - adjust to match your setup
#
DXROOT=c:/sdks/directx/dx61
ifneq ($(DXROOT_OVERRIDE),)
DXROOT=$(DXROOT_OVERRIDE)
else
DXROOT=c:/sdks/directx/dx61
endif
FMODROOTWIN=c:/sdks/fmodapi374win/api
# Build locations - OBJ gets overridden to the game-specific objects dir
@ -75,45 +39,22 @@ asm=nasm
#
ifneq ($(RELEASE),0)
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) $(F_NO_STACK_PROTECTOR)
LIBS=-lm
debug+= $(F_NO_STACK_PROTECTOR)
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS -DNOSDLPARACHUTE
LIBS=-lm $(L_SSP) -Wl,--enable-auto-import -rdynamic
ifneq (0,$(KRANDDEBUG))
debug+=-DKRANDDEBUG=1
endif
ifneq (0,$(PROFILER))
LIBS+= -lprofiler
debug+= -pg
endif
debug+= -DNOSDLPARACHUTE
LIBS+= $(L_SSP) -Wl,--enable-auto-import
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
CC=gcc
CXX=gcc
AS=nasm
RC=windres
AR=ar
RANLIB=ranlib
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-Wno-char-subscripts -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC) -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) $(ARCH)
OURCXXFLAGS=-fno-exceptions -fno-rtti
ASFLAGS=-s #-g
EXESUFFIX=
UTILLIBS=-lpthread
OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -DKSFORBUILD -I$(INC) $(ARCH)
OURCXXFLAGS=$(BASECXXFLAGS)
ASFLAGS=$(BASEASFLAGS)
include Makefile.shared
UTILLIBS=-lpthread
ENGINEOBJS=
ifeq (0,$(NOASM))
ENGINEOBJS+= $(OBJ)/a.$o
@ -226,12 +167,16 @@ utils: $(UTILS)
enginelib: $(OBJ)/$(ENGINELIB)
$(OBJ)/$(ENGINELIB): $(ENGINEOBJS)
$(AR) rc $@ $^
$(BUILD_ECHOFLAGS)
$(ARCHIVE_STATUS)
if $(AR) rc $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
$(RANLIB) $@
editorlib: $(OBJ)/$(EDITORLIB)
$(OBJ)/$(EDITORLIB): $(EDITOROBJS)
$(AR) rc $@ $^
$(BUILD_ECHOFLAGS)
$(ARCHIVE_STATUS)
if $(AR) rc $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
$(RANLIB) $@
pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o

View file

@ -214,19 +214,27 @@ endif
ifeq ($(PRETTY_OUTPUT),1)
BUILD_STARTED = printf "\033[K\033[1;36mBuild started using \"$(CC) $(OURCFLAGS)\"\033[0m\n"
BUILD_ECHOFLAGS = printf "\033[K\033[1;36mEnded compilation in this directory using \"$(CC) $(OURCFLAGS)\"\033[0m\n"
BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n"
COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r"
COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m \033[0m\n"
COMPILE_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
ARCHIVE_STATUS = printf "\033[K\033[0mCreating library archive \033[1m$@\033[0m...\033[0m\r"
ARCHIVE_OK = printf "\033[K\033[0;32mCreated library archive \033[1;32m$@\033[0;32m \033[0m\n"
ARCHIVE_FAILED = printf "\033[K\033[0;31mFailed creating library archive \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
LINK_STATUS = printf "\033[K\033[0;0mLinking executable \033[1m$@\033[0;0m...\033[0m\r"
LINK_OK = printf "\033[K\033[0;32mLinked executable \033[1;32m$@\033[0;32m \033[0m\n"
LINK_FAILED = printf "\033[K\033[0;31mFailed linking executable \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
else
BUILD_STARTED =
BUILD_ECHOFLAGS=
BUILD_FINISHED =
COMPILE_STATUS =
COMPILE_OK = true
COMPILE_FAILED = false; exit 1
ARCHIVE_STATUS =
ARCHIVE_OK = true
ARCHIVE_FAILED = false; exit 1
LINK_STATUS =
LINK_OK = true
LINK_FAILED = false; exit 1

View file

@ -1,33 +1,17 @@
CC=gcc
include ../../Makefile.common
include ../../$(EROOT)/Makefile.shared
OBJ=obj
OBJNAME?=libenet.a
PRETTY_OUTPUT?=1
EROOT?=build
RELEASE?=1
OPTLEVEL?=2
OBJNAME=libenet.a
SRC=src
INC=include
include ../../$(EROOT)/Makefile.shared
ifneq (0,$(RELEASE))
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL)
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
CFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) $(F_NO_STACK_PROTECTOR)
CFLAGS=$(BASECFLAGS) $(F_NO_STACK_PROTECTOR)
# for BUILD_ECHOFLAGS:
OURCFLAGS=$(CFLAGS)
CPPFLAGS=-I$(INC) -I$(SRC) -I../../$(EROOT)/include
OBJECTS=$(OBJ)/callbacks.o \
$(OBJ)/host.o \
$(OBJ)/list.o \
@ -37,17 +21,19 @@ OBJECTS=$(OBJ)/callbacks.o \
$(OBJ)/compress.o
ifeq ($(PLATFORM),WINDOWS)
OBJECTS+= $(OBJ)/win32.o
OBJNAME=libenet_win32.a
OBJ=obj_win
OBJECTS+= $(OBJ)/win32.o
OBJNAME=libenet_win32.a
OBJ=obj_win
else
OBJECTS+= $(OBJ)/unix.o
OBJECTS+= $(OBJ)/unix.o
endif
# OBJECTS=$(SOURCES:%.c=$(OBJ)/%.o)
$(OBJNAME): $(OBJECTS)
$(AR) cr $@ $^
$(BUILD_ECHOFLAGS)
$(ARCHIVE_STATUS)
if $(AR) cr $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(INC)/enet/*.h
-mkdir -p $(OBJ)

View file

@ -1,33 +1,23 @@
CC=gcc
OBJ=obj
OBJNAME?=libjfaudiolib.a
PRETTY_OUTPUT?=1
EROOT?=build
RELEASE?=1
OPTLEVEL?=2
SRC=src
DXROOT ?= c:/sdks/directx/dx8
include ../../Makefile.common
include ../../$(EROOT)/Makefile.shared
ifneq (0,$(RELEASE))
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL)
OBJ=obj
OBJNAME=libjfaudiolib.a
SRC=src
INC=include
# SDK locations - adjust to match your setup
ifneq ($(DXROOT_OVERRIDE),)
DXROOT ?= $(DXROOT_OVERRIDE)
else
# Debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS
DXROOT ?= c:/sdks/directx/dx8
endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
CFLAGS=$(BASECFLAGS) $(F_NO_STACK_PROTECTOR)
# for BUILD_ECHOFLAGS:
OURCFLAGS=$(CFLAGS)
CPPFLAGS=-I$(INC) -I$(SRC) -DHAVE_VORBIS
CFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) $(F_NO_STACK_PROTECTOR)
CPPFLAGS=-Iinclude -Isrc -DHAVE_VORBIS
OBJECTS=$(OBJ)/drivers.o \
$(OBJ)/fx_man.o \
@ -39,19 +29,21 @@ OBJECTS=$(OBJ)/drivers.o \
$(OBJ)/driver_nosound.o
ifeq ($(PLATFORM),WINDOWS)
CPPFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include
OBJECTS+= $(OBJ)/driver_directsound.o
OBJNAME=libjfaudiolib_win32.a
OBJ=obj_win
CPPFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include
OBJECTS+= $(OBJ)/driver_directsound.o
OBJNAME=libjfaudiolib_win32.a
OBJ=obj_win
else
CPPFLAGS+= -DHAVE_SDL
OBJECTS+= $(OBJ)/driver_sdl.o
CPPFLAGS+= -DHAVE_SDL
OBJECTS+= $(OBJ)/driver_sdl.o
endif
# OBJECTS=$(SOURCES:%.c=$(OBJ)/%.o)
$(OBJNAME): $(OBJECTS)
$(AR) cr $@ $^
$(BUILD_ECHOFLAGS)
$(ARCHIVE_STATUS)
if $(AR) cr $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi
$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c
-mkdir -p $(OBJ)