forked from msikma/allegro-4.2.2-xc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.qnx
232 lines (152 loc) · 5.65 KB
/
makefile.qnx
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#
# Rules for building the Allegro library with QNX. This file is included
# by the primary makefile, and should not be used directly.
#
# The "depend" target uses sed.
#
# See makefile.all for a list of the available targets.
# -------- define some variables that the primary makefile will use --------
PLATFORM = QNX
CC = gcc
OBJ_DIR = obj/qnx/$(VERSION)
LIB_NAME = lib/qnx/lib$(VERSION).a
EXE =
OBJ = .o
HTML = html
PLATFORM_DIR = obj/qnx
UNIX_TOOLS = 1
# -------- give a sensible default target for make without any args --------
.PHONY: _default
_default: default
# -------- decide what compiler options to use --------
ifdef WARNMODE
WFLAGS = -Wall -W -Werror -Wno-unused
else
WFLAGS = -Wall -Wno-unused
endif
ifdef TARGET_ARCH_COMPAT
TARGET_ARCH = $(GCC_MTUNE)=$(TARGET_ARCH_COMPAT)
else
ifdef TARGET_ARCH_EXCL
TARGET_ARCH = -march=$(TARGET_ARCH_EXCL)
else
TARGET_ARCH = $(GCC_MTUNE)=i586
endif
endif
ifndef TARGET_OPTS
TARGET_OPTS = -O2 -funroll-loops -ffast-math
endif
OFLAGS = $(TARGET_ARCH) $(TARGET_OPTS)
CFLAGS = -DALLEGRO_LIB_BUILD
ifdef DEBUGMODE
# -------- debugging build --------
CFLAGS += -DDEBUGMODE=$(DEBUGMODE) $(WFLAGS) -g
SFLAGS = -DDEBUGMODE=$(DEBUGMODE) $(WFLAGS)
LFLAGS = -g
else
ifdef PROFILEMODE
# -------- profiling build --------
CFLAGS += $(WFLAGS) $(OFLAGS) -pg
SFLAGS = $(WFLAGS)
LFLAGS = -pg
else
# -------- optimised build --------
CFLAGS += $(WFLAGS) $(OFLAGS) -fomit-frame-pointer
SFLAGS = $(WFLAGS)
ifndef SYMBOLMODE
LFLAGS += -s
endif
endif
endif
# -------- list platform specific objects and programs --------
VPATH = src/qnx src/unix src/misc
ifdef ALLEGRO_USE_C
# ------ build a C-only version ------
VPATH += src/c
MY_OBJECTS = $(C_OBJECTS) cmiscs
CFLAGS += -DALLEGRO_NO_ASM
else
# ------ build the normal asm version ------
VPATH += src/i386
MY_OBJECTS = $(I386_OBJECTS)
endif # ALLEGRO_USE_C
OBJECT_LIST = $(COMMON_OBJECTS) $(MY_OBJECTS) $(basename $(notdir $(ALLEGRO_SRC_QNX_FILES)))
LIBRARIES = -lm -lph -lasound
# -------- rules for installing and removing the library files --------
INSTALLDIR = /usr
LIBDIR = lib
INCDIR = include
$(INSTALL_DIR)/lib/lib$(VERSION).a: $(LIB_NAME)
cp $(LIB_NAME) $(INSTALL_DIR)/lib
$(INSTALL_DIR)/bin/allegro-config:
cp misc/allegro-config-qnx.sh $(INSTALL_DIR)/bin/allegro-config
chmod +x $(INSTALL_DIR)/bin/allegro-config
HEADERS = $(INSTALL_DIR)/include/qnxalleg.h \
$(INSTALL_DIR)/include/allegro/platform/aintqnx.h \
$(INSTALL_DIR)/include/allegro/platform/al386gcc.h \
$(INSTALL_DIR)/include/allegro/platform/alqnxcfg.h \
$(INSTALL_DIR)/include/allegro/platform/alplatf.h \
$(INSTALL_DIR)/include/allegro/platform/astdint.h \
$(INSTALL_DIR)/include/allegro/platform/alqnx.h
INSTALL_FILES = $(INSTALL_DIR)/lib/lib$(VERSION).a \
$(HEADERS) \
$(INSTALL_DIR)/bin/allegro-config
install: generic-install
@echo The $(DESCRIPTION) $(PLATFORM) library has been installed.
UNINSTALL_FILES = $(INSTALL_DIR)/lib/liballeg.a \
$(INSTALL_DIR)/lib/liballd.a \
$(INSTALL_DIR)/lib/liballp.a \
$(HEADERS) \
$(INSTALL_DIR)/bin/allegro-config
uninstall: generic-uninstall
@echo All gone!
# -------- test capabilities --------
TEST_CPP = $(CC) -fno-exceptions -c src/misc/test.cpp -o $(PLATFORM_DIR)/test.o
include makefile.tst
# -------- finally, we get to the fun part... --------
define MAKE_LIB
ar rs $(LIB_NAME) $(OBJECTS)
endef
COMPILE_FLAGS = $(subst src/,-DALLEGRO_SRC ,$(findstring src/, $<))$(CFLAGS)
$(OBJ_DIR)/%.o: %.c
$(CC) $(COMPILE_FLAGS) -I. -I./include -o $@ -c $<
$(OBJ_DIR)/%.o: %.cpp
$(CC) -fno-exceptions $(COMPILE_FLAGS) -I. -I./include -o $@ -c $<
$(OBJ_DIR)/%.o: %.s
$(CC) $(SFLAGS) -I. -I./include -x assembler-with-cpp -o $@ -c $<
demo/demo: $(OBJECTS_DEMO) $(LIB_NAME)
$(CC) $(LFLAGS) -o $@ $(OBJECTS_DEMO) $(LIB_NAME) $(LIBRARIES)
*/%: $(OBJ_DIR)/%.o $(LIB_NAME)
$(CC) $(LFLAGS) -o $@ $< $(LIB_NAME) $(LIBRARIES)
obj/qnx/asmdef.inc: obj/qnx/asmdef
obj/qnx/asmdef obj/qnx/asmdef.inc
obj/qnx/asmdef: src/i386/asmdef.c include/*.h include/allegro/*.h obj/qnx/asmcapa.h
$(CC) -O $(WFLAGS) -I. -I./include -o obj/qnx/asmdef src/i386/asmdef.c
define LINK_WITHOUT_LIB
$(CC) $(LFLAGS) -o $@ $^
endef
PLUGIN_LIB = lib/qnx/lib$(VERY_SHORT_VERSION)dat.a
PLUGINS_H = obj/qnx/plugins.h
PLUGIN_DEPS = $(LIB_NAME) $(PLUGIN_LIB)
PLUGIN_SCR = scr
define GENERATE_PLUGINS_H
cat tools/plugins/*.inc > obj/qnx/plugins.h
endef
define MAKE_PLUGIN_LIB
ar rs $(PLUGIN_LIB) $(PLUGIN_OBJS)
endef
define LINK_WITH_PLUGINS
$(CC) $(LFLAGS) -o $@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(LIB_NAME) $(LIBRARIES))
endef
# -------- generate automatic dependencies --------
DEPEND_PARAMS = -MM -MG -I. -I./include -DSCAN_DEPEND -DALLEGRO_QNX
depend:
$(CC) $(DEPEND_PARAMS) src/*.c src/qnx/*.c src/unix/*.c src/i386/*.c src/misc/*.c demo/*.c > _depend.tmp
$(CC) $(DEPEND_PARAMS) docs/src/makedoc/*.c examples/*.c setup/*.c tests/*.c tools/*.c tools/plugins/*.c >> _depend.tmp
$(CC) $(DEPEND_PARAMS) -x c tests/*.cpp >> _depend.tmp
$(CC) $(DEPEND_PARAMS) -x assembler-with-cpp src/i386/*.s src/qnx/*.s src/misc/*.s >> _depend.tmp
sed -e "s/^[a-zA-Z0-9_\/]*\///" _depend.tmp > _depend2.tmp
sed -e "s/^\([a-zA-Z0-9_]*\.o *:\)/obj\/qnx\/alleg\/\1/" _depend2.tmp > obj/qnx/alleg/makefile.dep
sed -e "s/^\([a-zA-Z0-9_]*\.o *:\)/obj\/qnx\/alld\/\1/" _depend2.tmp > obj/qnx/alld/makefile.dep
sed -e "s/^\([a-zA-Z0-9_]*\.o *:\)/obj\/qnx\/allp\/\1/" _depend2.tmp > obj/qnx/allp/makefile.dep
rm _depend.tmp _depend2.tmp