-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.MinGW
143 lines (122 loc) · 1.94 KB
/
Makefile.MinGW
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#
# fxQuake Makefile for MinGW with MSYS
#
DEBUG?=N
MOUNT_DIR=.
ifeq ($(DEBUG),Y)
BUILD_DIR=build_mingw_debug
else
BUILD_DIR=build_mingw_release
endif
#
# SETUP ENVIRONMENT
#
ifneq (,$(findstring MINGW32,$(shell uname -s)))
CC=gcc
STRIP=strip
WINDRES=windres
else
CC=mingw32-gcc
STRIP=mingw32-strip
WINDRES=mingw32-windres
endif
CPUFLAGS=-m32
LDFLAGS=-L/mingw/lib -L/mingw/lib/w32api -mwindows -ldxguid -ldinput -ldsound -lwinmm -lwsock32 -lopengl32
BASE_CFLAGS=-I/mingw/include -I/mingw/include/w32api -Wall
ifeq ($(DEBUG),Y)
CFLAGS=$(BASE_CFLAGS) -DDEBUG -g
do_strip=
else
CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O2
cmd_strip=$(STRIP) $(1)
define do_strip
$(call cmd_strip,$(1))
endef
endif
CFLAGS+=$(CPUFLAGS)
DO_OBJ_CC=$(CC) $(CFLAGS) -o $@ -c $<
DO_RES_WINDRES=$(WINDRES) -J rc -i $< -O coff -o $@
#
# RULES FOR MAKE
#
OBJ_DIR=$(BUILD_DIR)/obj
BIN=fxquake.exe
.PHONY: default clean
default: all
all: $(OBJ_DIR) $(BIN)
$(OBJ_DIR):
mkdir -p $@
$(OBJ_DIR)/%.o: $(MOUNT_DIR)/%.c
$(DO_OBJ_CC)
$(OBJ_DIR)/%.res: $(MOUNT_DIR)/%.rc
$(DO_RES_WINDRES)
#
# OBJS
#
OBJS= \
cd_win.o \
chase.o \
cl_demo.o \
cl_input.o \
cl_main.o \
cl_parse.o \
cl_tent.o \
cmd.o \
common.o \
conproc.o \
console.o \
crc.o \
cvar.o \
gl_anim.o \
gl_draw.o \
gl_efrag.o \
gl_light.o \
gl_main.o \
gl_mesh.o \
gl_misc.o \
gl_model.o \
gl_part.o \
gl_screen.o \
gl_surf.o \
host.o \
host_cmd.o \
in_win.o \
keys.o \
mathlib.o \
menu.o \
net_dgrm.o \
net_loop.o \
net_main.o \
net_win.o \
net_wins.o \
pr_cmds.o \
pr_edict.o \
pr_exec.o \
sbar.o \
snd_dma.o \
snd_mem.o \
snd_mix.o \
snd_win.o \
sv_main.o \
sv_move.o \
sv_phys.o \
sv_user.o \
sys_win.o \
vid_wgl.o \
view.o \
wad.o \
world.o \
zone.o \
winquake.res
#
# BUILD PROJECT
#
$(BIN): $(OBJ_DIR) $(addprefix $(OBJ_DIR)/,$(OBJS))
$(CC) $(CFLAGS) -o $@ $(addprefix $(OBJ_DIR)/,$(OBJS)) $(LDFLAGS)
$(call do_strip,$@)
mv $@ $(BUILD_DIR)/
#
# CLEAN PROJECT
#
clean:
rm -rf $(BUILD_DIR)