-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile_w
117 lines (90 loc) · 2.98 KB
/
makefile_w
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#
################################################################################
#
# File: makefile_w
#
# This file is part of ZR. Released under licence GPL-3.0-or-later.
# You should have received a copy of the GNU General Public License
# along with ZR. If not, see <https://www.gnu.org/licenses/>.
#
# Windows/MinGW version of makefile for use with SDL2 or GLUT
#
# See README.MAKEFILE
#
# HOMEPATH = /Users/user_name
# PATH = [Path of bin files]
#
# mingw32-make -f makefile_w
#
################################################################################
#
ifeq ($(OS),Windows_NT)
SHELL := bash.exe
endif
# Define interface: SDL2 or (default) GLUT
# The later conditional command does not work if one or more spaces follow SDL2
IFACE=SDL2
# Specify include and source directories relative to this directory
INC_DIR := include
SRC_DIR := src/core src/graphics src/input src/dynamics src/layout
MinGW64_HOME = C:/opt/mingw64
SDL2_HOME = C:/opt/sdl2
# Specify Compiler and Compiler Options
CC = gcc
CFLAGS = -m64 -march=native -mcmodel=large
CFLAGS = -O3 # Level 3 compiler optimisation
CFLAGS += -Wall -pedantic
CFLAGS += -Wextra
CFLAGS += -Wno-unused-variable
CFLAGS += -I$(MinGW64_HOME)/include
CFLAGS += -I$(SDL2_HOME)/include
CFLAGS += $(foreach dir, $(INC_DIR), $(addprefix -I, $(dir)))
CFLAGS += $(foreach dir, $(SRC_DIR), $(addprefix -I, $(dir)))
# Specify pre-processor options
CFLAGS += -DMinGW # Use system_alt.c routines with MinGW
CFLAGS += -DWINDOWS # Handle windows specifics
#CFLAGS += -Dsketch_tracks_and_roads # Plot outline of roads/tracks
CFLAGS += -Dgrid_lines # Outline tiles
#CFLAGS += -Dfull_topog # Plot all topography
CFLAGS += -Dkb_dev # Keyboard with modified 'flying' keys
#CFLAGS += -D_Display_Shapes
#CFLAGS += -D_Display_Wagons
#CFLAGS += -D_Display_Textures
CFLAGS += -Duse_vertex_arrays
#CFLAGS += -Dtexture_short
#CFLAGS += -Dnormal_byte
CFLAGS += -Dculling_off_for_wagons
#CFLAGS += -DROUTE_USA1 # Northeast Corridor
#CFLAGS += -DROUTE_USA2 # Marias Pass
#CFLAGS += -DROUTE_EUROPE1 # Settle line
#CFLAGS += -DROUTE_EUROPE2 # Innsbruck - St Anton
#CFLAGS += -DROUTE_JAPAN1 # Tokyo - Hakone
#CFLAGS += -DROUTE_JAPAN2 # Hisatsu Line
#CFLAGS += -DROUTE_TUTORIAL # MSTS Tutorial Route
# Conditionals
ifeq ($(IFACE),SDL2)
CFLAGS += -DSDL2
LIBGL = -lSDL2main -lSDL2
else
LIBGL = -lglut
endif
# Specify libraries
LDFLAGS = -L$(SDL2_HOME)\lib
LDFLAGS += -lopengl32 -lglu32 -lmingw32 $(LIBGL) -lz
# Generate list of prerequisits
HFILES := $(shell find $(INC_DIR) -name "*.h")
CFILES := $(shell find $(SRC_DIR) -name "*.c")
# Which suffixes to process
.SUFFIXES:
.SUFFIXES: .c .h .o
# Targets that are not the name of a file
.PHONEY: clean cleaner paths
# Makefile targets:
zr: zr.c $(HFILES) $(CFILES) makefile
$(CC) zr.c -o $@ $(CFLAGS) $(LDFLAGS)
paths:
$(CC) zr.c -o $@ $(CFLAGS) $(LDFLAGS) -E -v
clean:
rm -f *.o *~
cleaner:
rm -f zr *.o *~