Supermodel/Makefiles/Makefile.Win32
2024-08-09 22:44:51 -07:00

139 lines
4.3 KiB
Makefile

##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2003-2024 The Supermodel Team
##
## This file is part of Supermodel.
##
## Supermodel is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation, either version 3 of the License, or (at your option)
## any later version.
##
## Supermodel is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
## more details.
##
## You should have received a copy of the GNU General Public License along
## with Supermodel. If not, see <http://www.gnu.org/licenses/>.
##
#
# Makefile.Win32
#
# Makefile for Windows systems using gcc and the standard Command Prompt.
#
# Set variables in the "Configuration" section as required by your system
# configuration.
#
###############################################################################
# Configuration
#
# Edit as necessary. Some users may need to edit the "Platform Configuration"
# section as well, namely SDL2_LIBS and PLATFORM_LIBS.
###############################################################################
#
# Must be included first
#
include Makefiles/Options.inc
###############################################################################
# Release Package Options
###############################################################################
PKG_TYPE = zip
#
# Bitness of build ('32' or '64')
#
BITS = 64
#
# Toolchain
#
CC = gcc
CXX = g++
LD = g++
###############################################################################
# Platform Configuration
###############################################################################
# Safety check: can be only '32' or '64' otherwise defaults to '64'
ifneq ($(filter $(strip $(BITS)),32 64),$(strip $(BITS)))
override BITS = 64
endif
#
# Use Bash or Windows Command Prompt shell commands?
#
ifneq (,$(findstring cmd.exe,$(shell echo %COMSPEC%)))
# 'echo %COMSPEC%' returns path to cmd.exe on Windows, '%COMSPEC%' in bash
RMDIR = rmdir /s /q
else
RMDIR = rm -d -r -f
endif
#
# SDL2
#
ifneq (,$(findstring cmd.exe,$(shell echo %COMSPEC%)))
# When building in Command Prompt, we don't have sdl2-config and must hard-code the SDL2 include
# and library directories
SDL2_INCLUDE_DIR = \msys64\mingw64\include\SDL2
SDL2_LIB_DIR = \msys64\mingw64\lib
SDL2_LIBS = -lmingw32 -lSDL2main -lSDL2 -Wl,--no-undefined -lshell32 -lsetupapi -ladvapi32 -luuid -lversion -limm32 -lwinmm -lgdi32 -luser32 -lm -pipe
SDL2_CFLAGS =
else
# Must strip out -mwindows so we don't create a GUI app (will not work in Command Prompt)
SDL2_LIBS = $(shell sdl2-config --static-libs | sed 's/-mwindows//g')
SDL2_CFLAGS = $(shell sdl2-config --cflags)
endif
ifeq ($(strip $(NET_BOARD)),1)
SDL2_LIBS += -lSDL2_net -liphlpapi
endif
#
# MinGW/Windows-specific
#
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_CXXFLAGS = $(SDL2_CFLAGS) -DSUPERMODEL_WIN32 $(addprefix -I,$(sort $(PLATFORM_INCLUDE_DIR)))
PLATFORM_LDFLAGS = -static -L$(sort $(PLATFORM_LIB_DIR)) $(SDL2_LIBS) $(PLATFORM_LIBS)
###############################################################################
# Core Makefile
###############################################################################
PLATFORM_SRC_FILES = \
Src/OSD/Windows/DirectInputSystem.cpp \
Src/OSD/Windows/FileSystemPath.cpp \
Src/OSD/Windows/WinOutputs.cpp \
Src/OSD/Windows/SupermodelResources.rc
include Makefiles/Rules.inc
clean:
$(SILENT)echo Cleaning up $(BIN_DIR) and $(OBJ_DIR)...
$(SILENT)$(RMDIR) $(BIN_DIR)
$(SILENT)$(RMDIR) $(OBJ_DIR)
###############################################################################
# Platform-specific Rules
#
# This section must be placed *after* the inclusion of Makefiles/Rules.inc.
###############################################################################
$(OBJ_DIR)/SupermodelResources.o: Src/OSD/Windows/SupermodelResources.rc Src/OSD/Windows/SupermodelManifest.xml | $(OBJ_DIR)
$(info Compiling : $< -> $@)
$(SILENT)windres -i Src/OSD/Windows/SupermodelResources.rc -o $@