Fixed Makefiles for non-MSYS builds. Unfortunately had to revert a lot of the automated configuration that Harry had inserted. Users will again need to hand-edit Makefile.Win32 for their configuration. Verbose warnings (-Wall) have been restored.

This commit is contained in:
Bart Trzynadlowski 2018-05-06 18:52:23 +00:00
parent 4d275ba49e
commit 4d5c9e7231
2 changed files with 223 additions and 240 deletions

View file

@ -24,26 +24,42 @@
# #
# Makefile for Windows systems using gcc and the standard Command Prompt. # Makefile for Windows systems using gcc and the standard Command Prompt.
# #
# Set variables in the "Configuration" section as required by your system
# configuration.
#
############################################################################### ###############################################################################
# Build Options # Configuration
#
# Edit as necessary. Some users may need to edit the "Platform Configuration"
# section as well, namely SDL_LIBS and PLATFORM_LIBS.
############################################################################### ###############################################################################
# #
# Bitness of build ('32' or '64') # Bitness of build ('32' or '64')
# #
BITS = 64 BITS = 64
# First check if we're under MSYS2 or not, and then get bitness of CPU
ifeq ($(strip $(MSYSTEM)),) #
ifeq ($(findstring 64,$(strip $(PROCESSOR_ARCHITECTURE))),) # Path to SDL
BITS = 32 #
endif SDL_INCLUDE_DIR = c:/tdm-gcc-64/include/SDL
else SDL_LIB_DIR = c:/tdm-gcc-64/lib
ifeq ($(findstring 32,$(strip $(MSYSTEM_CARCH))),32)
BITS = 32 #
endif # Toolchain
endif #
CC = gcc
CXX = g++
LD = g++
###############################################################################
# Platform Configuration
###############################################################################
# Safety check: can be only '32' or '64' otherwise defaults to '64' # Safety check: can be only '32' or '64' otherwise defaults to '64'
ifneq ($(filter $(strip $(BITS)),32 64),$(strip $(BITS))) ifneq ($(filter $(strip $(BITS)),32 64),$(strip $(BITS)))
override BITS = 64 override BITS = 64
@ -57,35 +73,6 @@ ifeq ($(strip $(MSYSTEM)),)
DELETE = rmdir /s /q DELETE = rmdir /s /q
endif endif
###############################################################################
# Platform Configuration
#
# Edit library and include paths as needed.
###############################################################################
#
# Build environment
#
# Leave empty if 'mingwXX' folder is located on the root filesystem
MINGW_ROOT =
# 'mingw64' or 'mingw32' for respectively 64 or 32 bits builds.
# MSYS2 uses that scheme, customize it if necessary
MINGW_BASE = mingw$(strip $(BITS))
# The resulting 'mingwXX' base name for includes and libs
MINGW_DIR = $(strip $(MINGW_ROOT))/$(strip $(MINGW_BASE))
#
# Toolchain
#
CC = gcc
CXX = g++
LD = g++
# #
# SDL # SDL
# #
@ -94,19 +81,16 @@ LD = g++
# https://stackoverflow.com/questions/24596596/sdl-doesnt-compile-in-native-enviroment # https://stackoverflow.com/questions/24596596/sdl-doesnt-compile-in-native-enviroment
# http://www.cplusplus.com/forum/beginner/110753/ # http://www.cplusplus.com/forum/beginner/110753/
# #
SDL_LIBS = -lmingw32 -static-libgcc -static-libstdc++ -lSDLmain -lSDL -lm -luser32 -lgdi32 -lwinmm -ldxguid
SDL_INCLUDE_DIR = $(MINGW_DIR)/include/SDL
SDL_LIB_DIR = $(MINGW_DIR)/lib
SDL_LIBS = -lmingw32 -static-libgcc -static-libstdc++ -lSDLmain -lSDL -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid
SDL_CFLAGS = -D_GNU_SOURCE=1 -Dmain=SDL_main SDL_CFLAGS = -D_GNU_SOURCE=1 -Dmain=SDL_main
# #
# MinGW/Windows-specific # MinGW/Windows-specific
# #
PLATFORM_INCLUDE_DIR = $(SDL_INCLUDE_DIR) $(MINGW_DIR)/include PLATFORM_INCLUDE_DIR = $(SDL_INCLUDE_DIR)
PLATFORM_LIB_DIR = $(SDL_LIB_DIR) PLATFORM_LIB_DIR = $(SDL_LIB_DIR)
PLATFORM_LIBS = -ldinput8 -lglew32 -lglu32 -lole32 -loleaut32 -lopengl32 -lwbemuuid -lws2_32 -lz PLATFORM_LIBS = -ldinput8 -lglu32 -lole32 -loleaut32 -lopengl32 -lwbemuuid -lws2_32 -lz
PLATFORM_CFLAGS = $(SDL_CFLAGS) -DSUPERMODEL_WIN32 $(addprefix -I,$(sort $(PLATFORM_INCLUDE_DIR))) PLATFORM_CFLAGS = $(SDL_CFLAGS) -DSUPERMODEL_WIN32 $(addprefix -I,$(sort $(PLATFORM_INCLUDE_DIR)))
PLATFORM_LDFLAGS = -static -L$(sort $(PLATFORM_LIB_DIR)) $(SDL_LIBS) $(PLATFORM_LIBS) PLATFORM_LDFLAGS = -static -L$(sort $(PLATFORM_LIB_DIR)) $(SDL_LIBS) $(PLATFORM_LIBS)
@ -122,6 +106,6 @@ PLATFORM_SRC_FILES = \
include Makefiles/Makefile.inc include Makefiles/Makefile.inc
clean: clean:
$(SILENT)echo Cleaning up \"$(BIN_DIR)\" and \"$(OBJ_DIR)\"... $(SILENT)echo Cleaning up $(BIN_DIR) and $(OBJ_DIR)...
$(SILENT)$(DELETE) $(BIN_DIR) $(SILENT)$(DELETE) $(BIN_DIR)
$(SILENT)$(DELETE) $(OBJ_DIR) $(SILENT)$(DELETE) $(OBJ_DIR)

View file

@ -191,7 +191,7 @@ endif
# #
# Sorted-path compile order # Sorted-path compile order
# #
OBJ_FILES = $(foreach file,$(sort $(SRC_FILES)),$(OBJ_DIR)/$(basename $(notdir $(file))).o) OBJ_FILES = $(foreach file,$(SRC_FILES),$(OBJ_DIR)/$(basename $(notdir $(file))).o)
# #
# Deduce include directories from the source file list. The sort function # Deduce include directories from the source file list. The sort function
@ -208,7 +208,6 @@ OBJ_DIR = obj$(strip $(BITS))
BIN_DIR = bin$(strip $(BITS)) BIN_DIR = bin$(strip $(BITS))
OUTFILE = supermodel OUTFILE = supermodel
MUSASHI_OUTFILE = m68kmake
############################################################################### ###############################################################################
@ -218,8 +217,7 @@ MUSASHI_OUTFILE = m68kmake
ARCH = -march=native -mfpmath=sse ARCH = -march=native -mfpmath=sse
BUILD_CFLAGS = BUILD_CFLAGS =
OPT = -O3 OPT = -O3
#WARN = -Wall WARN = -Wall
WARN = -w
CSTD = -std=iso9899:2011 CSTD = -std=iso9899:2011
CXXSTD = -std=c++11 CXXSTD = -std=c++11
@ -317,39 +315,40 @@ $(OBJ_DIR)/%.o: %.c
# All generated source files are emitted to the object directory. For MSVC, # All generated source files are emitted to the object directory. For MSVC,
# INLINE must be redefined as "static __inline", which is the syntax in C mode. # INLINE must be redefined as "static __inline", which is the syntax in C mode.
# #
# The .exe suffix is absolutely required for native Windows non-MSYS builds!
#
MUSASHI_OUTFILE = $(OBJ_DIR)/m68kmake.exe # do not remove the .exe suffix!
MUSASHI_CFLAGS = -ISrc/CPU/68K/Musashi -I$(OBJ_DIR) -DINLINE="static inline" -Wno-unused-variable MUSASHI_CFLAGS = -ISrc/CPU/68K/Musashi -I$(OBJ_DIR) -DINLINE="static inline" -Wno-unused-variable
MUSASHI_LDFLAGS = -o $(OBJ_DIR)/$(MUSASHI_OUTFILE) $(OBJ_DIR)/m68kmake.o -s MUSASHI_LDFLAGS = -o $(MUSASHI_OUTFILE) $(OBJ_DIR)/m68kmake.o -s
$(OBJ_DIR)/$(MUSASHI_OUTFILE): Src/CPU/68K/Musashi/m68kmake.c $(MUSASHI_OUTFILE): Src/CPU/68K/Musashi/m68kmake.c Src/CPU/68K/Musashi/m68k_in.c
$(info --------------------------------------------------------------------------------) $(info --------------------------------------------------------------------------------)
$(info Compiling : $< -> $(OBJ_DIR)/m68kmake.o) $(info Compiling : $< -> $(OBJ_DIR)/m68kmake.o)
$(SILENT)$(CC) $< $(CFLAGS) -o $(OBJ_DIR)/m68kmake.o $(SILENT)$(CC) $< $(CFLAGS) -o $(OBJ_DIR)/m68kmake.o
$(info Linking : $(MUSASHI_OUTFILE)) $(info Linking : $(MUSASHI_OUTFILE))
$(SILENT)$(LD) $(MUSASHI_LDFLAGS) $(SILENT)$(LD) $(MUSASHI_LDFLAGS)
$(OBJ_DIR)/m68kops.h: $(OBJ_DIR)/$(MUSASHI_OUTFILE) Src/CPU/68K/Musashi/m68k_in.c $(OBJ_DIR)/m68kops.h $(OBJ_DIR)/m68kops.c $(OBJ_DIR)/m68kopac.c $(OBJ_DIR)/m68kopdm.c $(OBJ_DIR)/m68kopnz.c: $(MUSASHI_OUTFILE) Src/CPU/68K/Musashi/m68k_in.c Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(info Generating 68K emulator: $@) $(info Generating 68K emulator: $@)
$(SILENT)$(OBJ_DIR)/$(MUSASHI_OUTFILE) $(OBJ_DIR) Src/CPU/68K/Musashi/m68k_in.c @$(MUSASHI_OUTFILE) $(OBJ_DIR) Src/CPU/68K/Musashi/m68k_in.c
$(OBJ_DIR)/m68kops.c $(OBJ_DIR)/m68kopac.c $(OBJ_DIR)/m68kopdm.c $(OBJ_DIR)/m68kopnz.c: $(OBJ_DIR)/m68kops.h
$(OBJ_DIR)/m68kcpu.o: Src/CPU/68K/Musashi/m68kcpu.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(OBJ_DIR)/m68kcpu.o: Src/CPU/68K/Musashi/m68kcpu.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(info Compiling : $< -> $@) $(info Compiling : $< -> $@)
$(SILENT)$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $(OBJ_DIR)/m68kcpu.o @$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $(OBJ_DIR)/m68kcpu.o
$(OBJ_DIR)/m68kops.o: $(OBJ_DIR)/m68kops.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(OBJ_DIR)/m68kops.o: $(OBJ_DIR)/m68kops.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(MUSASHI_OUTFILE)
$(info Compiling : $< -> $@) $(info Compiling : $< -> $@)
$(SILENT)$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@ @$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@
$(OBJ_DIR)/m68kopac.o: $(OBJ_DIR)/m68kopac.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(OBJ_DIR)/m68kopac.o: $(OBJ_DIR)/m68kopac.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(MUSASHI_OUTFILE)
$(info Compiling : $< -> $@) $(info Compiling : $< -> $@)
$(SILENT)$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@ @$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@
$(OBJ_DIR)/m68kopdm.o: $(OBJ_DIR)/m68kopdm.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(OBJ_DIR)/m68kopdm.o: $(OBJ_DIR)/m68kopdm.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(MUSASHI_OUTFILE)
$(info Compiling : $< -> $@) $(info Compiling : $< -> $@)
$(SILENT)$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@ @$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@
$(OBJ_DIR)/m68kopnz.o: $(OBJ_DIR)/m68kopnz.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(OBJ_DIR)/m68kopnz.o: $(OBJ_DIR)/m68kopnz.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h $(MUSASHI_OUTFILE)
$(info Compiling : $< -> $@) $(info Compiling : $< -> $@)
$(SILENT)$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@ @$(CC) $< $(CFLAGS) $(MUSASHI_CFLAGS) -o $@