From d70a79a127860f897ef26fef2877b8dd002680d4 Mon Sep 17 00:00:00 2001 From: SpinDizzy Date: Fri, 6 Nov 2020 09:24:16 +0000 Subject: [PATCH] Makefiles update --- Makefiles/Makefile.OSX | 2 +- Makefiles/Makefile.UNIX | 2 +- Makefiles/Makefile.Win32 | 8 +-- Makefiles/Rules.inc | 106 +++++++++++++++++++++------------------ 4 files changed, 64 insertions(+), 54 deletions(-) diff --git a/Makefiles/Makefile.OSX b/Makefiles/Makefile.OSX index ad68804..30a90e1 100644 --- a/Makefiles/Makefile.OSX +++ b/Makefiles/Makefile.OSX @@ -66,7 +66,7 @@ endif # OSX-specific # -PLATFORM_CFLAGS = $(SDL_CFLAGS) -DSUPERMODEL_OSX -F/Library/Frameworks/ +PLATFORM_CXXFLAGS = $(SDL_CFLAGS) -DSUPERMODEL_OSX -F/Library/Frameworks/ PLATFORM_LDFLAGS = $(SDL_LIBS) -lz -lm -lstdc++ -F/Library/Frameworks/ diff --git a/Makefiles/Makefile.UNIX b/Makefiles/Makefile.UNIX index 7c4ce5e..dd7872a 100644 --- a/Makefiles/Makefile.UNIX +++ b/Makefiles/Makefile.UNIX @@ -63,7 +63,7 @@ SDL2_LIBS = `sdl2-config --libs` # UNIX-specific # -PLATFORM_CFLAGS = $(SDL2_CFLAGS) +PLATFORM_CXXFLAGS = $(SDL2_CFLAGS) -Ofast PLATFORM_LDFLAGS = $(SDL2_LIBS) -lGL -lGLU -lz -lm -lstdc++ -lpthread -lSDL2_net diff --git a/Makefiles/Makefile.Win32 b/Makefiles/Makefile.Win32 index 0dce4b1..f9d4eb7 100644 --- a/Makefiles/Makefile.Win32 +++ b/Makefiles/Makefile.Win32 @@ -50,8 +50,8 @@ BITS = 64 # # Path to SDL2 # -SDL2_INCLUDE_DIR = \msys64\mingw64\include\SDL2 #C:\TDM-GCC-64\x86_64-w64-mingw32\include\SDL2 -SDL2_LIB_DIR = \msys64\mingw64\lib #C:\TDM-GCC-64\x86_64-w64-mingw32\lib +SDL2_INCLUDE_DIR = \msys64\mingw64\include\SDL2 +SDL2_LIB_DIR = \msys64\mingw64\lib # # Toolchain @@ -93,8 +93,8 @@ endif PLATFORM_INCLUDE_DIR = $(SDL2_INCLUDE_DIR) PLATFORM_LIB_DIR = $(SDL2_LIB_DIR) -PLATFORM_LIBS = -ldxerr8 -ldinput8 -lglu32 -lole32 -loleaut32 -lopengl32 -lwbemuuid -lws2_32 -lz -PLATFORM_CFLAGS = $(SDL2_CFLAGS) -DSUPERMODEL_WIN32 $(addprefix -I,$(sort $(PLATFORM_INCLUDE_DIR))) -O2 +PLATFORM_LIBS = -ldxerr8 -ldinput8 -lglu32 -lole32 -loleaut32 -lopengl32 -lwbemuuid -lws2_32 -lz +PLATFORM_CXXFLAGS = $(SDL2_CFLAGS) -DSUPERMODEL_WIN32 $(addprefix -I,$(sort $(PLATFORM_INCLUDE_DIR))) PLATFORM_LDFLAGS = -static -L$(sort $(PLATFORM_LIB_DIR)) $(SDL2_LIBS) $(PLATFORM_LIBS) diff --git a/Makefiles/Rules.inc b/Makefiles/Rules.inc index 3f2690d..5aa7ec6 100644 --- a/Makefiles/Rules.inc +++ b/Makefiles/Rules.inc @@ -27,6 +27,64 @@ # +############################################################################### +# Output Locations +############################################################################### + +OBJ_DIR = obj$(strip $(BITS)) +BIN_DIR = bin$(strip $(BITS)) + +OUTFILE = supermodel + + +############################################################################### +# Compiler Flags +############################################################################### + +# +# Construct Supermodel build options +# +SUPERMODEL_BUILD_FLAGS = + +# If render state analyser is enabled, need to define DEBUG +ifeq ($(strip $(DEBUG)),1) + SUPERMODEL_BUILD_FLAGS += -DDEBUG +endif + +# If Net Board support is enabled, need to define NET_BOARD +ifeq ($(strip $(NET_BOARD)),1) + SUPERMODEL_BUILD_FLAGS += -DNET_BOARD +endif + +# If Bart's new frame timing is enabled, need to define NEW_FRAME_TIMING +ifeq ($(strip $(NEW_FRAME_TIMING)),1) + SUPERMODEL_BUILD_FLAGS += -DNEW_FRAME_TIMING +endif + +# If built-in debugger enabled, need to define SUPERMODEL_DEBUGGER +ifeq ($(strip $(ENABLE_DEBUGGER)),1) + SUPERMODEL_BUILD_FLAGS += -DSUPERMODEL_DEBUGGER +endif + +# +# Compiler options +# +ARCH = +OPT = -Ofast +WARN = -Wall +CSTD = -std=iso9899:2011 +CXXSTD = -std=c++14 + + +# +# Construct the compiler (C and C++) and linker flags +# +COMMON_CFLAGS = -c $(ARCH) $(OPT) $(WARN) $(addprefix -I,$(sort $(INCLUDE_DIRS))) -DGLEW_STATIC $(SUPERMODEL_BUILD_FLAGS) +CFLAGS = $(COMMON_CFLAGS) $(CSTD) +CXXFLAGS = $(PLATFORM_CXXFLAGS) $(COMMON_CFLAGS) $(CXXSTD) +LDFLAGS = -o $(BIN_DIR)/$(OUTFILE) $(PLATFORM_LDFLAGS) -s + + ############################################################################### # Source Files ############################################################################### @@ -143,54 +201,6 @@ OBJ_FILES = $(foreach file,$(SRC_FILES),$(OBJ_DIR)/$(basename $(notdir $(file))) INCLUDE_DIRS = $(sort $(foreach file,$(SRC_FILES),$(dir $(file)))) -############################################################################### -# Output Locations -############################################################################### - -OBJ_DIR = obj$(strip $(BITS)) -BIN_DIR = bin$(strip $(BITS)) - -OUTFILE = supermodel - - -############################################################################### -# Compiler Flags -############################################################################### - -ARCH = -march=native -mfpmath=sse -BUILD_CFLAGS = -OPT = -O3 -WARN = -Wall -CSTD = -std=iso9899:2011 -CXXSTD = -std=c++14 - -COMMON_CFLAGS = -c $(ARCH) $(OPT) $(WARN) $(addprefix -I,$(sort $(INCLUDE_DIRS))) -DGLEW_STATIC - -CFLAGS = $(COMMON_CFLAGS) $(CSTD) -CXXFLAGS = $(PLATFORM_CFLAGS) $(COMMON_CFLAGS) $(BUILD_CFLAGS) $(CXXSTD) -LDFLAGS = -o $(BIN_DIR)/$(OUTFILE) $(PLATFORM_LDFLAGS) -s - -# If render state analyser is enabled, need to define DEBUG -ifeq ($(strip $(DEBUG)),1) - BUILD_CFLAGS += -DDEBUG -endif - -# If Net Board support is enabled, need to define NET_BOARD -ifeq ($(strip $(NET_BOARD)),1) - BUILD_CFLAGS += -DNET_BOARD -endif - -# If Bart's new frame timing is enabled, need to define NEW_FRAME_TIMING -ifeq ($(strip $(NEW_FRAME_TIMING)),1) - BUILD_CFLAGS += -DNEW_FRAME_TIMING -endif - -# If built-in debugger enabled, need to define SUPERMODEL_DEBUGGER -ifeq ($(strip $(ENABLE_DEBUGGER)),1) - BUILD_CFLAGS += -DSUPERMODEL_DEBUGGER -endif - - ############################################################################### # Targets ###############################################################################