Fix linking with CLANG=1 by separating $(INVOCATION) into $(COMPILER) and $(LINKER) and removing "-x" from clang as a linker in Makefile.common. Additionally, the Build tools are now affected by CPLUSPLUS=1, for which small corrections have been made.

git-svn-id: https://svn.eduke32.com/eduke32@3122 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2012-11-06 07:49:44 +00:00
parent b31d5c9d59
commit a0c6fb9805
10 changed files with 159 additions and 131 deletions

View file

@ -35,13 +35,14 @@ else
endif endif
endif endif
OURCFLAGS=$(BASECFLAGS) \ OURCOMMONFLAGS=$(BASECOMMONFLAGS) \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -I$(SRC)/xdelta3 -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -I$(SRC)/xdelta3
OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS)
OURCXXFLAGS=$(BASECXXFLAGS) OURCXXFLAGS=$(BASECXXFLAGS)
OURCONLYFLAGS=$(BASECONLYFLAGS) OURCONLYFLAGS=$(BASECONLYFLAGS)
OURASFLAGS=$(BASEASFLAGS) OURASFLAGS=$(BASEASFLAGS)
OURLDFLAGS=$(BASELDFLAGS) $(BUILDLDFLAGS) PRINTLDFLAGS=$(BASELDFLAGS)
OURLDFLAGS=$(OURCOMMONFLAGS) $(PRINTLDFLAGS)
# Game/editor-specific linker options # Game/editor-specific linker options
GAMELDFLAGS= GAMELDFLAGS=
@ -59,12 +60,12 @@ include $(EROOT)/Makefile.shared
ifneq (0,$(USE_LIBVPX)) ifneq (0,$(USE_LIBVPX))
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
LIBS+= -LWindows/lib LIBS+= -LWindows/lib
OURCFLAGS+= -IWindows/include OURCOMMONFLAGS+= -IWindows/include
endif endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
# vpx headers and lib from 'port install libvpx' or 'brew install libvpx' # vpx headers and lib from 'port install libvpx' or 'brew install libvpx'
LIBS+= -L/opt/local/lib -L/usr/local/lib LIBS+= -L/opt/local/lib -L/usr/local/lib
OURCFLAGS+= -I/opt/local/include -I/usr/local/include OURCOMMONFLAGS+= -I/opt/local/include -I/usr/local/include
endif endif
endif endif
@ -167,11 +168,11 @@ LUAJIT_WIN_SRC:= g:/mod/LuaJIT-2.0.0-beta8/src
ifneq (0,$(LUNATIC)) ifneq (0,$(LUNATIC))
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -I$(LUAJIT_WIN_SRC) OURCOMMONFLAGS+= -I$(LUAJIT_WIN_SRC)
else else
OURCFLAGS+= -I/usr/include/luajit-2.0 OURCOMMONFLAGS+= -I/usr/include/luajit-2.0
endif endif
OURCFLAGS+= -I$(SRC)/lunatic -DLUNATIC OURCOMMONFLAGS+= -I$(SRC)/lunatic -DLUNATIC
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
LIBS+= -LWindows/lib -lluajit LIBS+= -LWindows/lib -lluajit
@ -201,11 +202,11 @@ ifneq (0,$(LUNATIC))
STRIP+= -s $(SRC)/lunatic/dynsymlist_osx STRIP+= -s $(SRC)/lunatic/dynsymlist_osx
MISCGAMEDEPS+= $(SRC)/lunatic/dynsymlist_osx MISCGAMEDEPS+= $(SRC)/lunatic/dynsymlist_osx
OURLDFLAGS+= -pagezero_size 10000 -image_base 100000000 #-Wl,-alias_list -Wl,$(SRC)/lunatic/aliases_list #-exported_symbols_list $(SRC)/lunatic/dynsymlist_osx PRINTLDFLAGS+= -pagezero_size 10000 -image_base 100000000 #-Wl,-alias_list -Wl,$(SRC)/lunatic/aliases_list #-exported_symbols_list $(SRC)/lunatic/dynsymlist_osx
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
MISCGAMEDEPS+= $(SRC)/lunatic/eduke32.def MISCGAMEDEPS+= $(SRC)/lunatic/eduke32.def
OURLDFLAGS+= $(SRC)/lunatic/eduke32.def PRINTLDFLAGS+= $(SRC)/lunatic/eduke32.def
endif endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
# TODO: Windows, OS X # TODO: Windows, OS X
@ -219,7 +220,7 @@ endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
ifeq (0,$(CLANG)) ifeq (0,$(CLANG))
OURCFLAGS += -fno-pic OURCOMMONFLAGS += -fno-pic
endif endif
OURASFLAGS += -f elf OURASFLAGS += -f elf
LIBS += -lvorbisfile -lvorbis -logg LIBS += -lvorbisfile -lvorbis -logg
@ -230,7 +231,7 @@ ifeq ($(PLATFORM),WII)
endif endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
OURCFLAGS += -fno-pic -I$(abspath Apple) -I$(abspath Apple/include) OURCOMMONFLAGS += -fno-pic -I$(abspath Apple) -I$(abspath Apple/include)
ifneq ($(findstring x86_64,$(ARCH)),x86_64) ifneq ($(findstring x86_64,$(ARCH)),x86_64)
ifeq (,$(ARCH)) ifeq (,$(ARCH))
@ -243,7 +244,7 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq (1,$(SDL_FRAMEWORK)) ifeq (1,$(SDL_FRAMEWORK))
OURCFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \ OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \
-I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
LIBS += -LApple/lib -lvorbisfile -lvorbis -logg -lm \ LIBS += -LApple/lib -lvorbisfile -lvorbis -logg -lm \
@ -257,7 +258,7 @@ ifeq ($(PLATFORM),DARWIN)
EDITOROBJS+=$(OBJ)/SDLMain.$o EDITOROBJS+=$(OBJ)/SDLMain.$o
GAMEOBJS+=$(OBJ)/SDLMain.$o GAMEOBJS+=$(OBJ)/SDLMain.$o
else else
OURCFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
LIBS += -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \ LIBS += -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \ -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \ -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
@ -274,7 +275,7 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include OURCOMMONFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include
OURASFLAGS+= -DUNDERSCORES -f win32 OURASFLAGS+= -DUNDERSCORES -f win32
LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound
GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o
@ -286,15 +287,15 @@ else
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
ifeq (0,$(SDL_FRAMEWORK)) ifeq (0,$(SDL_FRAMEWORK))
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) OURCOMMONFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
endif endif
LIBS+= -l$(SDLNAME)_mixer LIBS+= -l$(SDLNAME)_mixer
else else
OURCFLAGS += -DSDL_FRAMEWORK OURCOMMONFLAGS += -DSDL_FRAMEWORK
endif endif
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
EDITOROBJS+= $(OBJ)/editor_banner.$o EDITOROBJS+= $(OBJ)/editor_banner.$o
endif endif
@ -305,29 +306,31 @@ else
endif endif
OURCFLAGS+= $(BUILDCFLAGS) OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS)
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURLDFLAGS+= -Wl,--large-address-aware PRINTLDFLAGS+= -Wl,--large-address-aware
endif endif
#ifneq (0,$(KRANDDEBUG)) #ifneq (0,$(KRANDDEBUG))
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
OURLDFLAGS+=-Wl,-map -Wl,$@.memmap PRINTLDFLAGS+=-Wl,-map -Wl,$@.memmap
else else
OURLDFLAGS+=-Wl,-Map=$@.memmap PRINTLDFLAGS+=-Wl,-Map=$@.memmap
endif endif
#endif #endif
ifneq (0,$(PROFILER)) ifneq (0,$(PROFILER))
OURLDFLAGS+=-pg PRINTLDFLAGS+=-pg
endif endif
ifeq ($(PLATFORM),WII) ifeq ($(PLATFORM),WII)
OURLDFLAGS+= -mrvl -meabi -mhard-float -Wl,--gc-sections -Wl,-Map,$(notdir $@).map PRINTLDFLAGS+= -mrvl -meabi -mhard-float -Wl,--gc-sections -Wl,-Map,$(notdir $@).map
# -msdata=eabi # -msdata=eabi
endif endif
INVOCATION=$(CC) $(OURCONLYFLAGS) COMPILER=$(CC) $(OURCONLYFLAGS)
LINKER=$(L_CC)
ifneq ($(CPLUSPLUS),0) ifneq ($(CPLUSPLUS),0)
INVOCATION=$(CXX) $(OURCXXFLAGS) COMPILER=$(CXX) $(OURCXXFLAGS)
LINKER=$(L_CXX)
endif endif
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
@ -354,7 +357,7 @@ notice:
$(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS) $(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS)
$(LINK_STATUS) $(LINK_STATUS)
if $(INVOCATION) $(OURCFLAGS) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi
ifeq (1,$(RELEASE)) ifeq (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
@ -370,7 +373,7 @@ endif
$(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB)
$(LINK_STATUS) $(LINK_STATUS)
if $(INVOCATION) $(OURCFLAGS) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi
ifeq (1,$(RELEASE)) ifeq (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
@ -429,7 +432,7 @@ $(OBJ)/%.$o: $(SRC)/%.nasm
$(OBJ)/%.$o: $(SRC)/%.c $(OBJ)/%.$o: $(SRC)/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
#### Lunatic #### Lunatic
@ -446,11 +449,11 @@ endif
$(OBJ)/%.$o: $(SRC)/lunatic/%.c $(OBJ)/%.$o: $(SRC)/lunatic/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/xdelta3/%.c $(OBJ)/%.$o: $(SRC)/xdelta3/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# TODO: _m32 # TODO: _m32
# List of exported symbols, OS X # List of exported symbols, OS X
@ -470,7 +473,7 @@ $(SRC)/lunatic/eduke32.def: $(SRC)/lunatic/dynsymlist
$(OBJ)/%.$o: Apple/%.m $(OBJ)/%.$o: Apple/%.m
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/%.cc $(OBJ)/%.$o: $(SRC)/%.cc
$(COMPILE_STATUS) $(COMPILE_STATUS)
@ -486,7 +489,7 @@ $(OBJ)/%.$o: $(SRC)/%.cxx
$(OBJ)/%.$o: $(SRC)/jmact/%.c $(OBJ)/%.$o: $(SRC)/jmact/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/misc/%.rc $(OBJ)/%.$o: $(SRC)/misc/%.rc
$(COMPILE_STATUS) $(COMPILE_STATUS)
@ -494,15 +497,15 @@ $(OBJ)/%.$o: $(SRC)/misc/%.rc
$(OBJ)/%.$o: $(RSRC)/%.c $(OBJ)/%.$o: $(RSRC)/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/game_banner.$o: $(RSRC)/game_banner.c $(OBJ)/game_banner.$o: $(RSRC)/game_banner.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c $(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(RSRC)/game_banner.c: $(RSRC)/game.bmp $(RSRC)/game_banner.c: $(RSRC)/game.bmp
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@ echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@

View file

@ -14,11 +14,16 @@ RC=windres
RANLIB=ranlib RANLIB=ranlib
STRIP=strip STRIP=strip
L_CC=$(CC)
L_CXX=$(CXX)
CLANG?=0 CLANG?=0
ifneq (0,$(CLANG)) ifneq (0,$(CLANG))
CC=clang -x c -std=gnu89 CC=clang -x c -std=gnu89
CXX=clang -x c++ CXX=clang -x c++
L_CC=clang -std=gnu89
L_CXX=clang
# AR=llvm-ar # AR=llvm-ar
# RANLIB=llvm-ranlib # RANLIB=llvm-ranlib
endif endif
@ -122,7 +127,18 @@ DMALLOC?=0
OPTLEVEL?=2 OPTLEVEL?=2
PROFILER?=0 PROFILER?=0
MUDFLAP?=0 MUDFLAP?=0
LTO?=1
ifndef LTO
LTO=1
ifneq (0,$(CLANG))
ifeq ($(PLATFORM), WINDOWS)
LTO=0
endif
endif
endif
ifeq (4,$(GCC_MAJOR))
endif
ifeq (4,$(GCC_MAJOR)) ifeq (4,$(GCC_MAJOR))
F_NO_STACK_PROTECTOR := -fno-stack-protector F_NO_STACK_PROTECTOR := -fno-stack-protector
@ -142,7 +158,7 @@ ifeq ($(PLATFORM),DARWIN)
DARWIN9 ?= 1 DARWIN9 ?= 1
endif endif
# BASECFLAGS += -fno-leading-underscore # BASECOMMONFLAGS += -fno-leading-underscore
ifeq (1,$(DARWIN9)) ifeq (1,$(DARWIN9))
F_JUMP_TABLES := F_JUMP_TABLES :=
@ -150,10 +166,10 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq (1,$(BUILD32_ON_64)) ifeq (1,$(BUILD32_ON_64))
BASECFLAGS += $(F_NO_STACK_PROTECTOR) BASECOMMONFLAGS += $(F_NO_STACK_PROTECTOR)
else else
ifeq ($(findstring ppc,$(ARCH)),ppc) ifeq ($(findstring ppc,$(ARCH)),ppc)
BASECFLAGS += $(F_NO_STACK_PROTECTOR) BASECOMMONFLAGS += $(F_NO_STACK_PROTECTOR)
endif endif
endif endif
endif endif
@ -190,6 +206,7 @@ endif
# compiler flags etc. # compiler flags etc.
BASECFLAGS=
BASECONLYFLAGS=-Wimplicit -Wdeclaration-after-statement BASECONLYFLAGS=-Wimplicit -Wdeclaration-after-statement
BASECXXFLAGS= -fno-exceptions -fno-rtti -fpermissive BASECXXFLAGS= -fno-exceptions -fno-rtti -fpermissive
BASEASFLAGS=-s #-g BASEASFLAGS=-s #-g
@ -243,7 +260,7 @@ else
ifneq (0,$(CLANG)) ifneq (0,$(CLANG))
# CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }') # CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }')
debug+= -fcatch-undefined-behavior BASECFLAGS+= -Xclang -fcatch-undefined-behavior
# ifeq ($(CLANG_MAJOR),3) # ifeq ($(CLANG_MAJOR),3)
# debug+= -faddress-sanitizer # debug+= -faddress-sanitizer
# endif # endif
@ -282,41 +299,41 @@ CWARNS := -W -Wall -Werror-implicit-function-declaration \
#-Wcast-qual -Wcast-align \ #-Wcast-qual -Wcast-align \
#-Waddress -Wlogical-op #-Waddress -Wlogical-op
BASECFLAGS=$(debug) $(OPTOPT) $(CWARNS) \ BASECOMMONFLAGS=$(debug) $(OPTOPT) $(CWARNS) \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \ -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) $(ARCH) $(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) $(ARCH)
ifneq (0,$(CLANG)) ifneq (0,$(CLANG))
BASECFLAGS+= -Wno-unused-value -Wno-parentheses BASECOMMONFLAGS+= -Wno-unused-value -Wno-parentheses
endif endif
ifneq (0,$(DISABLEINLINING)) ifneq (0,$(DISABLEINLINING))
BASECFLAGS+= -DDISABLE_INLINING BASECOMMONFLAGS+= -DDISABLE_INLINING
endif endif
BASELDFLAGS+= $(OPTOPT) BASELDFLAGS+= $(OPTOPT)
# This should come from the environment: # This should come from the environment:
ifdef EDUKE32_MY_DEVELOPER_ID ifdef EDUKE32_MY_DEVELOPER_ID
BASECFLAGS+= -DMY_DEVELOPER_ID=$(EDUKE32_MY_DEVELOPER_ID) BASECOMMONFLAGS+= -DMY_DEVELOPER_ID=$(EDUKE32_MY_DEVELOPER_ID)
endif endif
ifneq (0,$(USE_LIBPNG)) ifneq (0,$(USE_LIBPNG))
BASECFLAGS+= -DUSE_LIBPNG BASECOMMONFLAGS+= -DUSE_LIBPNG
endif endif
ifneq (0,$(USE_LIBVPX)) ifneq (0,$(USE_LIBVPX))
BASECFLAGS+= -DUSE_LIBVPX BASECOMMONFLAGS+= -DUSE_LIBVPX
endif endif
ifneq (0,$(OSX_STARTUPWINDOW)) ifneq (0,$(OSX_STARTUPWINDOW))
BASECFLAGS+= -DOSX_STARTUPWINDOW BASECOMMONFLAGS+= -DOSX_STARTUPWINDOW
endif endif
ifneq (0,$(EFENCE)) ifneq (0,$(EFENCE))
LIBS+= -lefence LIBS+= -lefence
BASECFLAGS+= -DEFENCE BASECOMMONFLAGS+= -DEFENCE
endif endif
ifneq (0,$(DMALLOC)) ifneq (0,$(DMALLOC))
LIBS+= -ldmalloc LIBS+= -ldmalloc
BASECFLAGS+= -DDMALLOC BASECOMMONFLAGS+= -DDMALLOC
endif endif
# Misc. stuff that is constant between Makefiles # Misc. stuff that is constant between Makefiles

View file

@ -48,14 +48,16 @@ endif
include Makefile.shared include Makefile.shared
OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -I$(INC) OURCOMMONFLAGS=$(BASECOMMONFLAGS) -Wno-char-subscripts -I$(INC)
OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS)
OURCONLYFLAGS=$(BASECONLYFLAGS) OURCONLYFLAGS=$(BASECONLYFLAGS)
OURCXXFLAGS=$(BASECXXFLAGS) OURCXXFLAGS=$(BASECXXFLAGS)
OURASFLAGS=$(BASEASFLAGS) OURASFLAGS=$(BASEASFLAGS)
OURLDFLAGS=$(BASELDFLAGS) $(BUILDLDFLAGS) PRINTLDFLAGS=$(BASELDFLAGS)
OURLDFLAGS=$(OURCOMMONFLAGS) $(PRINTLDFLAGS)
ifneq ($(LUNATIC),0) ifneq ($(LUNATIC),0)
OURCFLAGS+= -DLUNATIC OURCOMMONFLAGS+= -DLUNATIC
endif endif
UTILLIBS= -lm # -lpthread UTILLIBS= -lm # -lpthread
@ -112,14 +114,14 @@ ifeq ($(PLATFORM),DARWIN)
ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o
endif endif
OURASFLAGS += -f macho -DUNDERSCORES OURASFLAGS += -f macho -DUNDERSCORES
OURCFLAGS += -fno-pic -DUNDERSCORES OURCOMMONFLAGS += -fno-pic -DUNDERSCORES
endif endif
ifeq ($(PLATFORM),BSD) ifeq ($(PLATFORM),BSD)
OURASFLAGS+= -f elf OURASFLAGS+= -f elf
OURCFLAGS+= -I/usr/X11R6/include OURCOMMONFLAGS+= -I/usr/X11R6/include
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include OURCOMMONFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include
OURASFLAGS+= -DUNDERSCORES -f win32 OURASFLAGS+= -DUNDERSCORES -f win32
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
@ -145,21 +147,21 @@ ifeq ($(RENDERTYPE),SDL)
endif endif
ifeq (1,$(SDL_FRAMEWORK)) ifeq (1,$(SDL_FRAMEWORK))
OURCFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \ OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \
-I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
else else
OURCFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
endif endif
endif endif
ifeq (0,$(SDL_FRAMEWORK)) ifeq (0,$(SDL_FRAMEWORK))
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) OURCOMMONFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
else else
OURCFLAGS += -DSDL_FRAMEWORK OURCOMMONFLAGS += -DSDL_FRAMEWORK
endif endif
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o ENGINEOBJS+= $(OBJ)/gtkbits.$o
ifeq ($(LINKED_GTK),0) ifeq ($(LINKED_GTK),0)
ENGINEOBJS+= $(OBJ)/dynamicgtk.$o ENGINEOBJS+= $(OBJ)/dynamicgtk.$o
@ -172,11 +174,13 @@ ifeq ($(RENDERTYPE),WIN)
EDITOROBJS+= $(OBJ)/startwin.editor.$o EDITOROBJS+= $(OBJ)/startwin.editor.$o
endif endif
OURCFLAGS+= $(BUILDCFLAGS) OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS)
INVOCATION=$(CC) $(OURCONLYFLAGS) COMPILER=$(CC) $(OURCONLYFLAGS)
LINKER=$(L_CC)
ifneq ($(CPLUSPLUS),0) ifneq ($(CPLUSPLUS),0)
INVOCATION=$(CXX) $(OURCXXFLAGS) COMPILER=$(CXX) $(OURCXXFLAGS)
LINKER=$(L_CXX)
endif endif
.SILENT: .SILENT:
@ -239,56 +243,56 @@ $(OBJ)/$(EDITORLIB): $(EDITOROBJS)
kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
transpal$(EXESUFFIX): $(OBJ)/transpal.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) transpal$(EXESUFFIX): $(OBJ)/transpal.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
wad2art$(EXESUFFIX): $(OBJ)/wad2art.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) wad2art$(EXESUFFIX): $(OBJ)/wad2art.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
wad2map$(EXESUFFIX): $(OBJ)/wad2map.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) wad2map$(EXESUFFIX): $(OBJ)/wad2map.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
kmd2tool$(EXESUFFIX): $(OBJ)/kmd2tool.$o $(UTILADDOBJS) kmd2tool$(EXESUFFIX): $(OBJ)/kmd2tool.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
md2tool$(EXESUFFIX): $(OBJ)/md2tool.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) md2tool$(EXESUFFIX): $(OBJ)/md2tool.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
generateicon$(EXESUFFIX): $(OBJ)/generateicon.$o $(OBJ)/compat.$o $(OBJ)/pragmas.$o $(OBJ)/kplib.$o \ generateicon$(EXESUFFIX): $(OBJ)/generateicon.$o $(OBJ)/compat.$o $(OBJ)/pragmas.$o $(OBJ)/kplib.$o \
$(OBJ)/cache1d.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) $(OBJ)/cache1d.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
cacheinfo$(EXESUFFIX): $(OBJ)/cacheinfo.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS) cacheinfo$(EXESUFFIX): $(OBJ)/cacheinfo.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
enumdisplay$(EXESUFFIX): $(OBJ)/enumdisplay.$o $(UTILADDOBJS) enumdisplay$(EXESUFFIX): $(OBJ)/enumdisplay.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(DXROOT)/include -lgdi32; then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(DXROOT)/include -lgdi32; then $(ONESTEP_OK); fi
getdxdidf$(EXESUFFIX): $(OBJ)/getdxdidf.$o $(UTILADDOBJS) getdxdidf$(EXESUFFIX): $(OBJ)/getdxdidf.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(DXROOT)/include -ldinput; then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(DXROOT)/include -ldinput; then $(ONESTEP_OK); fi
makesdlkeytrans$(EXESUFFIX): $(OBJ)/makesdlkeytrans.$o $(UTILADDOBJS) makesdlkeytrans$(EXESUFFIX): $(OBJ)/makesdlkeytrans.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
arttool$(EXESUFFIX): $(OBJ)/arttool.$o $(UTILADDOBJS) arttool$(EXESUFFIX): $(OBJ)/arttool.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CXX) -o $@ $^ $(OURLDFLAGS) $(STATICSTDCPP) $(UTILLIBS); then $(ONESTEP_OK); fi if $(L_CXX) -o $@ $^ $(OURLDFLAGS) $(STATICSTDCPP) $(UTILLIBS); then $(ONESTEP_OK); fi
givedepth$(EXESUFFIX): $(OBJ)/givedepth.$o $(UTILADDOBJS) givedepth$(EXESUFFIX): $(OBJ)/givedepth.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
mkpalette$(EXESUFFIX): $(OBJ)/mkpalette.$o $(UTILADDOBJS) mkpalette$(EXESUFFIX): $(OBJ)/mkpalette.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
unpackssi$(EXESUFFIX): $(OBJ)/unpackssi.$o $(UTILADDOBJS) unpackssi$(EXESUFFIX): $(OBJ)/unpackssi.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
bsuite$(EXESUFFIX): $(OBJ)/bsuite.$o $(UTILADDOBJS) bsuite$(EXESUFFIX): $(OBJ)/bsuite.$o $(UTILADDOBJS)
$(ONESTEP_STATUS) $(ONESTEP_STATUS)
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
# DEPENDENCIES # DEPENDENCIES
include Makefile.deps include Makefile.deps
@ -301,15 +305,15 @@ $(OBJ)/%.$o: $(SRC)/%.nasm
# comment out to debug a-c.o # comment out to debug a-c.o
$(OBJ)/a-c.$o: $(SRC)/a-c.c $(OBJ)/a-c.$o: $(SRC)/a-c.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(subst -O0,-O2,$(subst -fcatch-undefined-behavior,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(subst -O0,-O2,$(subst -fcatch-undefined-behavior,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/%.c $(OBJ)/%.$o: $(SRC)/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/%.m $(OBJ)/%.$o: $(SRC)/%.m
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/%.cc $(OBJ)/%.$o: $(SRC)/%.cc
$(COMPILE_STATUS) $(COMPILE_STATUS)
@ -325,7 +329,7 @@ $(OBJ)/%.$o: $(SRC)/%.cxx
$(OBJ)/%.$o: $(SRC)/misc/%.c $(OBJ)/%.$o: $(SRC)/misc/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/misc/%.rc $(OBJ)/%.$o: $(SRC)/misc/%.rc
$(COMPILE_STATUS) $(COMPILE_STATUS)
@ -333,7 +337,7 @@ $(OBJ)/%.$o: $(SRC)/misc/%.rc
$(OBJ)/%.$o: $(SRC)/util/%.c $(OBJ)/%.$o: $(SRC)/util/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/util/%.cc $(OBJ)/%.$o: $(SRC)/util/%.cc
$(COMPILE_STATUS) $(COMPILE_STATUS)
@ -349,7 +353,7 @@ $(OBJ)/%.$o: $(SRC)/util/%.cxx
$(OBJ)/%.$o: $(RSRC)/%.c $(OBJ)/%.$o: $(RSRC)/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c $(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@ echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@

View file

@ -31,8 +31,7 @@ ifeq (4,$(GCC_MAJOR))
L_SSP := -lssp L_SSP := -lssp
endif endif
BUILDCFLAGS=$(ARCH) BUILDCOMMONFLAGS=$(ARCH)
BUILDLDFLAGS=$(ARCH)
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
STDCPPLIB= STDCPPLIB=
@ -43,14 +42,14 @@ endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
RENDERTYPE=SDL RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0 GTKCOMPAT32=0
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
ifeq (1,$(BUILD32_ON_64)) ifeq (1,$(BUILD32_ON_64))
# On my 64bit Gentoo these are the 32bit emulation libs # On my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32 BUILDCOMMONFLAGS+= -m32
# Override WITHOUT_GTK=0 # Override WITHOUT_GTK=0
GTKCOMPAT32=1 GTKCOMPAT32=1
else else
@ -61,12 +60,12 @@ endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
RENDERTYPE = SDL RENDERTYPE = SDL
STDCPPLIB = -lstdc++ STDCPPLIB = -lstdc++
BUILDCFLAGS += -DHAVE_INTTYPES BUILDCOMMONFLAGS += -DHAVE_INTTYPES
GTKCOMPAT32 = 0 GTKCOMPAT32 = 0
SDL_FRAMEWORK = 1 SDL_FRAMEWORK = 1
ifeq (1,$(DARWIN9)) ifeq (1,$(DARWIN9))
BUILDCFLAGS += -DDARWIN9 BUILDCOMMONFLAGS += -DDARWIN9
endif endif
ifeq (1,$(BUILD32_ON_64)) ifeq (1,$(BUILD32_ON_64))
@ -78,7 +77,7 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN RENDERTYPE ?= WIN
BUILDCFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32
#-lshfolder #-lshfolder
@ -86,7 +85,7 @@ ifeq ($(PLATFORM),WINDOWS)
endif endif
ifeq ($(PLATFORM),BSD) ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL RENDERTYPE=SDL
BUILDCFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
ifneq ($(findstring i386, $(SYSARCH)), i386) ifneq ($(findstring i386, $(SYSARCH)), i386)
override NOASM=1 override NOASM=1
endif endif
@ -100,9 +99,9 @@ ifeq ($(PLATFORM),SKYOS)
RENDERTYPE=SDL RENDERTYPE=SDL
EXESUFFIX=.app EXESUFFIX=.app
override NOASM=1 override NOASM=1
BUILDCFLAGS+= -DUNDERSCORES BUILDCOMMONFLAGS+= -DUNDERSCORES
SDLCONFIG= SDLCONFIG=
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl SDLCONFIG_COMMONFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet LIBS+= -lSDL -lnet
endif endif
ifeq ($(PLATFORM),WII) ifeq ($(PLATFORM),WII)
@ -121,7 +120,7 @@ ifeq ($(PLATFORM),WII)
override NOASM=1 override NOASM=1
override WITHOUT_GTK=1 override WITHOUT_GTK=1
# -msdata=eabi # -msdata=eabi
BUILDCFLAGS+= -g -mtune=750 -meabi -mhard-float \ BUILDCOMMONFLAGS+= -g -mtune=750 -meabi -mhard-float \
-DGEKKO -DHAVE_INTTYPES -D__POWERPC__ \ -DGEKKO -DHAVE_INTTYPES -D__POWERPC__ \
-I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include -I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include
SDLCONFIG= SDLCONFIG=
@ -150,12 +149,12 @@ endif
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
ifeq ($(SDL_FRAMEWORK),1) ifeq ($(SDL_FRAMEWORK),1)
LIBS += -Wl,-framework,SDL LIBS += -Wl,-framework,SDL
SDLCONFIG_CFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers SDLCONFIG_COMMONFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers
else else
ifneq ($(SDLCONFIG),) ifneq ($(SDLCONFIG),)
SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs) SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs)
LIBS+= $(SDLCONFIG_LIBS) LIBS+= $(SDLCONFIG_LIBS)
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags) SDLCONFIG_COMMONFLAGS+=$(shell $(SDLCONFIG) --cflags)
endif endif
endif endif
@ -185,21 +184,21 @@ else
endif endif
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 $(W_STRICT_OVERFLOW) BUILDCOMMONFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 $(W_STRICT_OVERFLOW)
ifneq (0,$(USE_OPENGL)) ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DUSE_OPENGL BUILDCOMMONFLAGS+= -DUSE_OPENGL
endif endif
ifneq (0,$(NOASM)) ifneq (0,$(NOASM))
BUILDCFLAGS+= -DNOASM BUILDCOMMONFLAGS+= -DNOASM
endif endif
ifneq (0,$(LINKED_GTK)) ifneq (0,$(LINKED_GTK))
BUILDCFLAGS+= -DLINKED_GTK BUILDCOMMONFLAGS+= -DLINKED_GTK
endif endif
ifneq (0,$(POLYMER)) ifneq (0,$(POLYMER))
ifneq (0,$(USE_OPENGL)) ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DPOLYMER BUILDCOMMONFLAGS+= -DPOLYMER
endif endif
endif endif
@ -227,12 +226,12 @@ ifeq ($(PLATFORM),WINDOWS)
ifneq ($(USE_LIBPNG),0) ifneq ($(USE_LIBPNG),0)
# XXX: these assume that the compiler runs from build/. Ugh. # XXX: these assume that the compiler runs from build/. Ugh.
LIBS+= -L../Windows/lib -lpng_mini -lz_mini LIBS+= -L../Windows/lib -lpng_mini -lz_mini
BUILDCFLAGS+= -I../Windows/include BUILDCOMMONFLAGS+= -I../Windows/include
endif endif
else else
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
ifneq ($(USE_LIBPNG),0) ifneq ($(USE_LIBPNG),0)
BUILDCFLAGS+= -I/opt/local/include -I/sw/include -I/usr/local/include BUILDCOMMONFLAGS+= -I/opt/local/include -I/sw/include -I/usr/local/include
LIBS+= -L/opt/local/lib -L/usr/local/lib -lpng # -lz LIBS+= -L/opt/local/lib -L/usr/local/lib -lpng # -lz
endif endif
else else
@ -249,9 +248,9 @@ endif
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(INVOCATION) $(OURCFLAGS)\" BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(COMPILER) $(OURCFLAGS)\"
BUILD_SETTINGS_ASSEMBLER = \033[1;36massembler: \033[0;36m\"$(AS) $(OURASFLAGS)\" BUILD_SETTINGS_ASSEMBLER = \033[1;36massembler: \033[0;36m\"$(AS) $(OURASFLAGS)\"
BUILD_SETTINGS_LINKER = \033[1;36mlinker: \033[0;36m\"$(OURLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB)\" BUILD_SETTINGS_LINKER = \033[1;36mlinker: \033[0;36m\"$(PRINTLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB)\"
ifeq (0,$(NOASM)) ifeq (0,$(NOASM))
BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n" BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n"
else else

View file

@ -1359,7 +1359,7 @@ void dfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
dasizeof = 1; dasizeof = 1;
} }
ptr = buffer; ptr = (char*)buffer;
Bmemcpy(lzwrawbuf, ptr, (int32_t)dasizeof); Bmemcpy(lzwrawbuf, ptr, (int32_t)dasizeof);

View file

@ -54,19 +54,22 @@ HRESULT WINAPI ddenum(DDSURFACEDESC *ddsd, VOID *udata ATTRIBUTE((unused)))
return(DDENUMRET_OK); return(DDENUMRET_OK);
} }
typedef HRESULT (WINAPI *aDirectDrawCreateType)(GUID *, LPDIRECTDRAW *, IUnknown *);
typedef HRESULT (WINAPI *aDirectDrawEnumerateType)(LPDDENUMCALLBACK, LPVOID);
int InitDirectDraw(void) int InitDirectDraw(void)
{ {
HRESULT result; HRESULT result;
HRESULT (WINAPI *aDirectDrawCreate)(GUID *, LPDIRECTDRAW *, IUnknown *); aDirectDrawCreateType aDirectDrawCreate;
HRESULT (WINAPI *aDirectDrawEnumerate)(LPDDENUMCALLBACK, LPVOID); aDirectDrawEnumerateType aDirectDrawEnumerate;
hDDrawDLL = LoadLibrary("DDRAW.DLL"); hDDrawDLL = LoadLibrary("DDRAW.DLL");
if (!hDDrawDLL) { fprintf(output, "Failed loading DDRAW.DLL\n"); return -1; } if (!hDDrawDLL) { fprintf(output, "Failed loading DDRAW.DLL\n"); return -1; }
aDirectDrawEnumerate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA"); aDirectDrawEnumerate = (aDirectDrawEnumerateType)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA");
if (!aDirectDrawEnumerate) { fprintf(output, "Error fetching DirectDrawEnumerate\n"); return -1; } if (!aDirectDrawEnumerate) { fprintf(output, "Error fetching DirectDrawEnumerate\n"); return -1; }
aDirectDrawCreate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawCreate"); aDirectDrawCreate = (aDirectDrawCreateType)GetProcAddress(hDDrawDLL, "DirectDrawCreate");
if (!aDirectDrawCreate) { fprintf(output, "Error fetching DirectDrawCreate\n"); return -1; } if (!aDirectDrawCreate) { fprintf(output, "Error fetching DirectDrawCreate\n"); return -1; }
result = aDirectDrawCreate(NULL, &lpDD, NULL); result = aDirectDrawCreate(NULL, &lpDD, NULL);

View file

@ -165,7 +165,7 @@ int main(int argc, char **argv)
{ {
Bprintf("TRANSPAL [-t]<numshades><trans#(0-inv,256-opa)><r><g><b> by Kenneth Silverman\n"); Bprintf("TRANSPAL [-t]<numshades><trans#(0-inv,256-opa)><r><g><b> by Kenneth Silverman\n");
Bprintf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n"); Bprintf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
Bprintf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n"); Bprintf(" \xc0\xc4\xc4\xc1\xc4\xc4\xc1\xc4\xc4\xc4 The RGB scales are optional\n");
Bprintf(" Ex #2: transpal 64 160\n\n"); Bprintf(" Ex #2: transpal 64 160\n\n");
Bprintf("Once tables are generated, the optional -t switch determines what to save:\n"); Bprintf("Once tables are generated, the optional -t switch determines what to save:\n");
Bprintf(" Exclude -t to update both the shade table and transluscent table\n"); Bprintf(" Exclude -t to update both the shade table and transluscent table\n");

View file

@ -151,7 +151,7 @@ static int secval[4096], secopnum = 0;
#define THINGLISTNUM 123 #define THINGLISTNUM 123
static short thinglookup[MAXTHINGTYPES]; static short thinglookup[MAXTHINGTYPES];
typedef struct { short num; char name[8]; } thinglisttype; typedef struct { short num; char name[9]; } thinglisttype;
static thinglisttype thinglist[THINGLISTNUM] = static thinglisttype thinglist[THINGLISTNUM] =
{{1,"PLAYA1"},{2,"PLAYA1"},{3,"PLAYA1"},{4,"PLAYA1"},{11,"PLAYA1"},{14,""},{3004,"POSSA1"}, {{1,"PLAYA1"},{2,"PLAYA1"},{3,"PLAYA1"},{4,"PLAYA1"},{11,"PLAYA1"},{14,""},{3004,"POSSA1"},
{84,"SSWVA1"},{9,"SPOSA1"},{65,"CPOSA1"},{3001,"TROOA1"},{3002,"SARGA1"},{58,"SARGA1"}, {84,"SSWVA1"},{9,"SPOSA1"},{65,"CPOSA1"},{3001,"TROOA1"},{3002,"SARGA1"},{58,"SARGA1"},

View file

@ -7,19 +7,20 @@ SRC=src
INC=include INC=include
# for BUILD_ECHOFLAGS: # for BUILD_ECHOFLAGS:
OURCFLAGS=$(BASECFLAGS) $(BUILDCFLAGS) -I$(INC) -I$(SRC) -I../../$(EROOT)/include OURCOMMONFLAGS=$(BASECOMMONFLAGS) $(BUILDCOMMONFLAGS) -I$(INC) -I$(SRC) -I../../$(EROOT)/include
ifneq ($(RELEASE),0) ifneq ($(RELEASE),0)
# Debugging disabled # Debugging disabled
debug+= $(F_NO_STACK_PROTECTOR) debug+= $(F_NO_STACK_PROTECTOR)
endif endif
OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS)
OURCONLYFLAGS=$(BASECONLYFLAGS) OURCONLYFLAGS=$(BASECONLYFLAGS)
OURCXXFLAGS=$(BASECXXFLAGS) OURCXXFLAGS=$(BASECXXFLAGS)
OURLDFLAGS=$(BASELDFLAGS) PRINTLDFLAGS=$(BASELDFLAGS)
OURASFLAGS=$(BASEASFLAGS) OURASFLAGS=$(BASEASFLAGS)
INVOCATION=$(CC) $(OURCONLYFLAGS) COMPILER=$(CC) $(OURCONLYFLAGS)
ifneq ($(CPLUSPLUS),0) ifneq ($(CPLUSPLUS),0)
INVOCATION=$(CXX) $(OURCXXFLAGS) COMPILER=$(CXX) $(OURCXXFLAGS)
endif endif
@ -49,7 +50,7 @@ $(OBJNAME): $(OBJECTS)
$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(INC)/enet/*.h $(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(INC)/enet/*.h
-mkdir -p $(OBJ) -mkdir -p $(OBJ)
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
.SILENT: .SILENT:

View file

@ -15,30 +15,31 @@ else
endif endif
# for BUILD_ECHOFLAGS: # for BUILD_ECHOFLAGS:
OURCFLAGS=$(BASECFLAGS) $(BUILDCFLAGS) -I$(INC) -I$(SRC) OURCOMMONFLAGS=$(BASECOMMONFLAGS) $(BUILDCOMMONFLAGS) -I$(INC) -I$(SRC)
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
OURCFLAGS+= -DHAVE_VORBIS OURCOMMONFLAGS+= -DHAVE_VORBIS
endif endif
ifneq ($(RELEASE),0) ifneq ($(RELEASE),0)
# Debugging disabled # Debugging disabled
debug+= $(F_NO_STACK_PROTECTOR) debug+= $(F_NO_STACK_PROTECTOR)
endif endif
OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS)
OURCONLYFLAGS=$(BASECONLYFLAGS) OURCONLYFLAGS=$(BASECONLYFLAGS)
OURCXXFLAGS=$(BASECXXFLAGS) OURCXXFLAGS=$(BASECXXFLAGS)
OURLDFLAGS=$(BASELDFLAGS) PRINTLDFLAGS=$(BASELDFLAGS)
OURASFLAGS=$(BASEASFLAGS) OURASFLAGS=$(BASEASFLAGS)
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
ifeq (1,$(SDL_FRAMEWORK)) ifeq (1,$(SDL_FRAMEWORK))
APPLE_INCLUDE_DIR:=../../Apple/include APPLE_INCLUDE_DIR:=../../Apple/include
OURCFLAGS += -DSDL_FRAMEWORK -I$(APPLE_INCLUDE_DIR) -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \ OURCOMMONFLAGS += -DSDL_FRAMEWORK -I$(APPLE_INCLUDE_DIR) -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \
-I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
endif endif
endif endif
INVOCATION=$(CC) $(OURCONLYFLAGS) COMPILER=$(CC) $(OURCONLYFLAGS)
ifneq ($(CPLUSPLUS),0) ifneq ($(CPLUSPLUS),0)
INVOCATION=$(CXX) $(OURCXXFLAGS) COMPILER=$(CXX) $(OURCXXFLAGS)
endif endif
@ -52,14 +53,14 @@ OBJECTS=$(OBJ)/drivers.o \
$(OBJ)/driver_nosound.o $(OBJ)/driver_nosound.o
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include OURCOMMONFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include
OBJECTS+= $(OBJ)/driver_directsound.o OBJECTS+= $(OBJ)/driver_directsound.o
OBJNAME=libjfaudiolib_win32.a OBJNAME=libjfaudiolib_win32.a
OBJ=obj_win OBJ=obj_win
else else
OURCFLAGS+= -DHAVE_SDL $(SDLCONFIG_CFLAGS) OURCOMMONFLAGS+= -DHAVE_SDL $(SDLCONFIG_COMMONFLAGS)
ifneq ($(PLATFORM),DARWIN) ifneq ($(PLATFORM),DARWIN)
OURCFLAGS+=`pkg-config --cflags vorbis` OURCOMMONFLAGS+=`pkg-config --cflags vorbis`
endif endif
OBJECTS+= $(OBJ)/driver_sdl.o OBJECTS+= $(OBJ)/driver_sdl.o
endif endif
@ -74,7 +75,7 @@ $(OBJNAME): $(OBJECTS)
$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c
-mkdir -p $(OBJ) -mkdir -p $(OBJ)
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
.SILENT: .SILENT: