-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
140 lines (118 loc) · 1.79 KB
/
Makefile
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
#
# fxQuake Makefile for GNU Make
#
DEBUG?=N
MOUNT_DIR=.
ifeq ($(DEBUG),Y)
BUILD_DIR=build_debug
else
BUILD_DIR=build_release
endif
QBASE_DIR?=.
#
# SETUP ENVIRONMENT
#
ifneq (,$(findstring $(shell uname -s),FreeBSD NetBSD OpenBSD))
UNIX=bsd
else
ifneq (,$(findstring Linux,$(shell uname -s)))
UNIX=linux
endif
endif
CC=gcc
STRIP=strip
CPUFLAGS=-m32
LDFLAGS=-L/usr/local/lib -lm -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm -lGL
BASE_CFLAGS=-I/usr/local/include -DQBASEDIR="$(QBASE_DIR)" -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 $<
#
# RULES FOR MAKE
#
OBJ_DIR=$(BUILD_DIR)/obj
BIN=fxquake
.PHONY: default clean
default: all
all: $(OBJ_DIR) $(BIN)
$(OBJ_DIR):
mkdir -p $@
$(OBJ_DIR)/%.o: $(MOUNT_DIR)/%.c
$(DO_OBJ_CC)
#
# OBJS
#
OBJS= \
cd_$(UNIX).o \
chase.o \
cl_demo.o \
cl_input.o \
cl_main.o \
cl_parse.o \
cl_tent.o \
cmd.o \
common.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_x.o \
keys.o \
mathlib.o \
menu.o \
net_dgrm.o \
net_loop.o \
net_main.o \
net_bsd.o \
net_udp.o \
pr_cmds.o \
pr_edict.o \
pr_exec.o \
sbar.o \
snd_dma.o \
snd_mem.o \
snd_mix.o \
snd_unix.o \
sv_main.o \
sv_move.o \
sv_phys.o \
sv_user.o \
sys_unix.o \
vid_glx.o \
view.o \
wad.o \
world.o \
zone.o
#
# 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)