-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·371 lines (296 loc) · 10.3 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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# Makefile for ARMulator: ARM6 Instruction Emulator.
# Copyright (C) 1994 Advanced RISC Machines Ltd.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Hacked for Archimedes emulation by Dave Gilbert ([email protected])
# Modified for different systems by Peter Naulls <[email protected]>
# These variables can be overridden
# Extension ROM support - currently stable on X, Windows and Mac OS X
EXTNROM_SUPPORT=yes
# Sound support - currently experimental - to enable set to 'yes'
SOUND_SUPPORT=no
# Enable this if sound support uses pthreads
SOUND_PTHREAD=yes
# HostFS support - currently experimental - to enable set to 'yes'
HOSTFS_SUPPORT=no
# Endianess of the Host system, the default is little endian (x86 and
# ARM. If you run on a big endian system such as Sparc and some versions
# of MIPS set this flag
HOST_BIGENDIAN=no
# Which version of the manual to include in the RiscPkg archive
# development, arcem-1.50, etc.
MANUAL?=development
# Windowing System
ifeq ($(SYSTEM),)
SYSTEM=X
endif
CC=gcc
LD=gcc
LDFLAGS=
WARN = -Wno-everything
ifeq ($(PROFILE),yes)
CFLAGS = -O -g -pg -ftest-coverage -fprofile-arcs
LIBS += -lgcov
else
ifeq ($(DEBUG),yes)
CFLAGS += -O0 -g
else
# CFLAGS = -O3
CFLAGS += -O0 -g
# -funroll-loops -fexpensive-optimizations -ffast-math \
-fomit-frame-pointer
#-frerun-cse-after-loop
endif
endif
CFLAGS += \
$(CFL) $(WARN) \
-I$(SYSTEM) -Iarch -I.
prefix=/usr/local
INSTALL_DIR = $(prefix)/bin
INSTALL=cp
# Everything else should be ok as it is.
OBJS = armcopro.o armemu.o arminit.o \
armsupp.o main.o dagstandalone.o eventq.o \
$(SYSTEM)/DispKbd.o arch/i2c.o arch/archio.o \
arch/fdc1772.o $(SYSTEM)/ControlPane.o arch/hdc63463.o arch/ReadConfig.o \
arch/keyboard.o $(SYSTEM)/filecalls.o arch/filecommon.o \
arch/ArcemConfig.o arch/cp15.o arch/newsound.o arch/displaydev.o
SRCS = armcopro.c armemu.c arminit.c arch/armarc.c \
armsupp.c main.c dagstandalone.c eventq.c \
$(SYSTEM)/DispKbd.c arch/i2c.c arch/archio.c \
arch/fdc1772.c $(SYSTEM)/ControlPane.c arch/hdc63463.c \
arch/ReadConfig.c arch/keyboard.c $(SYSTEM)/filecalls.c \
arch/ArcemConfig.c arch/cp15.c arch/newsound.c \
arch/displaydev.c arch/filecommon.c
INCS = armdefs.h armemu.h $(SYSTEM)/KeyTable.h \
arch/i2c.h arch/archio.h arch/fdc1772.h arch/ControlPane.h \
arch/hdc63463.h arch/keyboard.h arch/ArcemConfig.h arch/cp15.h
TARGET=arcem
ifeq (${SYSTEM},amiga)
HOST_BIGENDIAN=yes
HOSTFS_SUPPORT=yes
EXTNROM_SUPPORT=yes
SOUND_SUPPORT=yes
SOUND_PTHREAD=no
SRCS += amiga/wb.c amiga/arexx.c
OBJS += amiga/wb.o amiga/arexx.o
CFLAGS += -mcrt=newlib -D__LARGE64_FILES -D__USE_INLINE__
LDFLAGS += -mcrt=newlib
# The following two lines are for Altivec support via libfreevec
# Uncomment them if you are using a G4 or other PPC with Altivec
#CFLAGS += -maltivec -mabi=altivec
#LDFLAGS += -maltivec -mabi=altivec -lfreevec
endif
ifeq (${SYSTEM},amigaos3)
CC=m68k-amigaos-gcc
LD=$(CC)
HOST_BIGENDIAN=yes
HOSTFS_SUPPORT=yes
EXTNROM_SUPPORT=yes
SOUND_SUPPORT=yes
SOUND_PTHREAD=no
SRCS += amiga/wb.c
OBJS += amiga/wb.o
CFLAGS += -D__amigaos3__ -noixemul
LDFLAGS += -noixemul
endif
ifeq (${SYSTEM},riscos-single)
# HostFS
HOSTFS_SUPPORT=yes
# Sound
SOUND_SUPPORT=yes
SOUND_PTHREAD=no
OBJS += riscos-single/soundbuf.o
# General
EXTNROM_SUPPORT=yes
CFLAGS += -I@ -DSYSTEM_riscos_single -Iriscos-single -mtune=cortex-a8 -march=armv5te -mthrowback -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mfpu=fpa
LDFLAGS += -static
# Disable stack limit checks. -ffixed-sl required to prevent sl being used as temp storage, breaking unixlib and any other code that does do stack checks
CFLAGS += -mno-apcs-stack-check -ffixed-sl -DUSE_FAKEMAIN
OBJS += riscos-single/realmain.o
# No function name poking for a bit extra speed
CFLAGS += -mno-poke-function-name
# Debug options
#CFLAGS += -save-temps -mpoke-function-name
# Profiling
#CFLAGS += -mpoke-function-name -DPROFILE_ENABLED
#OBJS += riscos-single/prof.o
TARGET=!ArcEm/arcem
# Create RiscPkg archive directory structure
# Final step to turn it into a zip archive must be done manually, either on RISC OS or via GCCSDK's native-zip
riscpkg: $(TARGET)
rm -rf ArcEm
mkdir -p ArcEm/Apps/Misc
cp -r riscos-single/RiscPkg ArcEm
cp -r !ArcEm ArcEm/Apps/Misc
rm ArcEm/Apps/Misc/!ArcEm/arcem
elf2aif !ArcEm/arcem ArcEm/Apps/Misc/!ArcEm/arcem,ff8
cp arcemrc ArcEm/Apps/Misc/!ArcEm/.arcemrc
cp hexcmos ArcEm/Apps/Misc/!ArcEm/hexcmos
cp -r docs ArcEm/Apps/Misc/!ArcEm
mkdir -p ArcEm/Apps/Misc/!ArcEm/extnrom
find support_modules -name *,ffa -exec cp '{}' ArcEm/Apps/Misc/!ArcEm/extnrom \;
find ArcEm -name CVS -type d | xargs rm -r
find ArcEm -name .cvsignore -type f | xargs rm
wget http://arcem.sf.net/manual/$(MANUAL).html -O ArcEm/Apps/Misc/!ArcEm/manual.html
cp docs/COPYING ArcEm/Apps/Misc
mkdir ArcEm/Apps/Misc/hostfs
endif
ifeq (${SYSTEM},X)
CFLAGS += -DSYSTEM_X -I/opt/local/include/
ifneq ($(shell uname),Darwin)
CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif
LIBS += -L/opt/local/lib/ -lXext -lX11
OBJS += X/true.o X/pseudo.o
#SOUND_SUPPORT = yes
endif
ifeq (${SYSTEM},win)
CC = gcc-3
LD = gcc-3
CFLAGS += -DSYSTEM_win -mno-cygwin
OBJS += win/gui.o win/win.o
LIBS += -luser32 -lgdi32 -mno-cygwin
# Comment the following line to have a console window
LIBS += -mwindows
endif
ifeq (${SYSTEM},sdl)
CC = gcc
LD = gcc
# CFLAGS += -fsanitize=address -DSYSTEM_sdl -I/usr/local/include/SDL2 -I/usr/include/SDL2
CFLAGS += -DSYSTEM_sdl -I/usr/local/include/SDL2 -I/usr/include/SDL2
LIBS += -lSDL2 -L/usr/local/lib
# -fsanitize=address -lasan
TARGET=arcem
endif
ifeq (${SYSTEM},web)
SYSTEM=sdl
CC = emcc
LD = emcc
CFLAGS += -DSYSTEM_web -D__web__ -s USE_SDL=2 -s TOTAL_MEMORY=67108864 -g4 -I../emsdk/upstream/emscripten/system/include/emscripten/
LDFLAGS += -g4 -s ASSERTIONS=2 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1 --source-map-base http://localhost:8000/ -s USE_SDL=2 -s WASM=1 --preload-file ROM --preload-file arcemrc -s TOTAL_MEMORY=67108864
TARGET=arcem.html
endif
ifeq (${SOUND_SUPPORT},yes)
CFLAGS += -DSOUND_SUPPORT
OBJS += $(SYSTEM)/sound.o
INCS += arch/sound.h
ifeq (${SOUND_PTHREAD},yes)
LIBS += -lpthread
endif
endif
ifeq (${HOSTFS_SUPPORT},yes)
CFLAGS += -DHOSTFS_SUPPORT
HOSTFS_OBJS ?= hostfs.o
OBJS += ${HOSTFS_OBJS}
endif
ifeq (${EXTNROM_SUPPORT},yes)
CFLAGS += -DEXTNROM_SUPPORT
OBJS += arch/extnrom.o
endif
ifeq (${HOST_BIGENDIAN},yes)
CFLAGS += -DHOST_BIGENDIAN
endif
TARED = *.c *.s *.h README COPYING Makefile \
X riscos riscos-single arch
MODEL = arch/armarc
VER=1.0
all: $(TARGET)
install: all
$(INSTALL) $(TARGET) $(INSTALL_DIR)
f=arcemrc; test -f $$HOME/.$$f || $(INSTALL) $$f $(HOME)/.$$f
$(TARGET): $(OBJS) $(MODEL).o
$(LD) $(LDFLAGS) $(OBJS) $(LIBS) $(MODEL).o -o $@
clean:
rm -f *.o arch/*.o $(SYSTEM)/*.o arcem core *.bb *.bbg *.da
distclean: clean
rm -f *~
realclean: distclean
rm -f *.tar *.tar.gz
depend:
makedepend $(SRCS)
arcem.tar.gz:
rm -rf arcem-$(VER)
mkdir arcem-$(VER)
cd arcem-$(VER) ; \
for file in $(TARED) ; do \
cp -a ../$${file} . ; \
done ; \
find -name CVS -type d | xargs rm -r; \
find -name .cvsignore -type f | xargs rm; \
touch dummy.o ; find -type f | grep '\.o$$' | xargs rm -r 2>/dev/null
tar cf arcem.tar arcem-$(VER)
gzip arcem.tar
mv arcem.tar.gz arcem-$(VER).tar.gz
# memory models
arch/armarc.o: armdefs.h arch/armarc.c arch/armarc.h \
arch/fdc1772.h
$(CC) $(CFLAGS) -c $*.c -o arch/armarc.o
# other objects
armcopro.o: armcopro.c armdefs.h
$(CC) $(CFLAGS) -c $*.c
armemu.o: armemu.c armdefs.h armemu.h armemuinstr.c armemudec.c
$(CC) $(CFLAGS) -o armemu.o -c armemu.c
riscos-single/prof.o: riscos-single/prof.s
$(CC) -x assembler-with-cpp riscos-single/prof.s -c -o $@
riscos-single/soundbuf.o: riscos-single/soundbuf.s
$(CC) -x assembler-with-cpp riscos-single/soundbuf.s -c -o $@
riscos-single/realmain.o: riscos-single/realmain.s
$(CC) -x assembler-with-cpp riscos-single/realmain.s -c -o $@
arminit.o: arminit.c armdefs.h armemu.h
$(CC) $(CFLAGS) -c $*.c
armsupp.o: armsupp.c armdefs.h armemu.h
$(CC) $(CFLAGS) -c $*.c
dagstandalone.o: dagstandalone.c armdefs.h
$(CC) $(CFLAGS) -c $*.c
main.o: main.c armdefs.h
$(CC) $(CFLAGS) -c $*.c
eventq.o: eventq.c eventq.h
$(CC) $(CFLAGS) -c $*.c
$(SYSTEM)/DispKbd.o: $(SYSTEM)/DispKbd.c $(SYSTEM)/KeyTable.h \
arch/armarc.h arch/fdc1772.h arch/hdc63463.h \
arch/keyboard.h
$(CC) $(CFLAGS) -c $*.c -o $(SYSTEM)/DispKbd.o
arch/i2c.o: arch/i2c.c arch/i2c.h arch/armarc.h arch/archio.h \
arch/fdc1772.h arch/hdc63463.h
$(CC) $(CFLAGS) -c $*.c -o arch/i2c.o
arch/archio.o: arch/archio.c arch/archio.h arch/armarc.h arch/i2c.h \
arch/fdc1772.h arch/hdc63463.h
$(CC) $(CFLAGS) -c $*.c -o arch/archio.o
arch/fdc1772.o: arch/fdc1772.c arch/fdc1772.h arch/armarc.h
$(CC) $(CFLAGS) -c $*.c -o arch/fdc1772.o
arch/hdc63463.o: arch/hdc63463.c arch/hdc63463.h arch/armarc.h
$(CC) $(CFLAGS) -c $*.c -o arch/hdc63463.o
$(SYSTEM)/ControlPane.o: $(SYSTEM)/ControlPane.c arch/ControlPane.h \
arch/armarc.h
$(CC) $(CFLAGS) -c $*.c -o $(SYSTEM)/ControlPane.o
arch/ReadConfig.o: arch/ReadConfig.c arch/ReadConfig.h \
arch/armarc.h
$(CC) $(CFLAGS) -c $*.c -o arch/ReadConfig.o
arch/keyboard.o: arch/keyboard.c arch/keyboard.h
$(CC) $(CFLAGS) -c $*.c -o arch/keyboard.o
arch/newsound.o: arch/newsound.c arch/sound.h
$(CC) $(CFLAGS) -c $*.c -o arch/newsound.o
arch/displaydev.o: arch/displaydev.c arch/displaydev.h
$(CC) $(CFLAGS) -c $*.c -o arch/displaydev.o
win/gui.o: win/gui.rc win/gui.h win/arc.ico
windres $*.rc -o win/gui.o
X/true.o: X/true.c
$(CC) $(CFLAGS) -c $*.c -o X/true.o
X/pseudo.o: X/pseudo.c
$(CC) $(CFLAGS) -c $*.c -o X/pseudo.o
sdl/sdlDisplayDriver.o: sdl/sdlDisplayDriver.c
$(CC) $(CFLAGS) -c $*.c -o sdl/sdlDisplayDriver.o
# DO NOT DELETE