-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile.orig
240 lines (200 loc) · 9.42 KB
/
GNUmakefile.orig
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
#
# Builds the Ivory Emulator (VLM)
#
# The command line to build an emulator is
#
# make {OPTIONS="option1 option2 ..."} {NONSHARED=YES} TARGET
#
# where TARGET is either "genera", "minima", or "iverify". The makefile will
# automatically include the -DGENERA, -DMINIMA, or -DIVERIFY preprocessor option
# when invoking the compiler and assembler.
#
# On the make command line, use OPTIONS="option1 option2 ..." to specify compiler
# and assembler options, notably preprocessor options.
#
# The main preprocessor options used throughout the sources are
# GENERA to build an emulator that is intended to run Genera
# MINIMA to build an emulator that is intended to run Minima
# IVERIFY to build an emulator that is intended to run the instruction test suite
# TRACING to enable instruction tracing and counting
# CACHEMETERING to enable instruction cache metering facilities
# TRAPMETERING to enable trap metering facilities
# STATISTICS to enable other statistics-gathering facilities
# if enabled:
# EXECTIMES : enable execution times statistics
# ends up in "usagedata.lisp" / "usagedata.text" after a vlm run
# DEBUGGING to enable debugging facilities
# DEBUG* to enable other, more specific debugging facilities
# AUTOSTART to immediately start execution of the loaded image without waiting for
# a :Start Interactor command from the Minima Debugger. (This option is defined
# automatically when the TARGET is "genera".)
# USE_CPU_FOR_MICROSECOND_CLOCK to use the process CPU time rather than elapsed time
# as the value of Ivory's microsecond clock
# DISK_SIZE_1536 to enable disks.c to read 1536 bytes sectors
# instead of the default 8192 byte sectors
# DEBUG_DISK
# enable disk read/write verbosity
# DEBUG_NETWORk
# Networking debug verbosity
# if enabled:
# DEBUG_CHAOS
# DEBUG_IP
# DEBUG_ARP
# DEBUG_ICMP
# verbosity of indiv. netwoeking parts
#
# For example, to create an emulator that runs Genera but waits for a :Start Interactor
# command from the Minima Debugger before booting and also has debugging features enabled,
#
# make genera OPTIONS="-DDEBUGGING -UAUTOSTART"
#
# If you specify a target different from your last build, you must remove all object
# files first to ensure that everything is properly compiled. Use the "clean" target.
#
# In fact, if you change any settings between builds, it's a good idea to build from scratch
#
# On the make command line, use PROFILE=YES to build the VLM using the profiling option
# to gather statistics on execution frequencies.
#
# On the make command line, use NONSHARED=YES to build the VLM using the non-shared
# libraries. (The default is to use the shared libraries.)
#
LIFE = ./life-support
EMULATOR = ./emulator
G5EMULATOR = ./g5-emulator
X86EMULATOR = ./x86_64-emulator
OTHER = ./other
CPU = $(X86EMULATOR)
CLISP = /usr/bin/clisp
CCL=/home/lispm/ccl/scripts/ccl64
OPTIMOPT = -Ofast -march=native -fno-strict-aliasing
NOCONAOPTIMOPT = -Ofast -march=nocona -fno-strict-aliasing
genera: MAINOPTIONS = -DGENERA -DAUTOSTART -DUSE_TAP #-DUSE_CPU_FOR_MICROSECOND_CLOCK
minima: MAINOPTIONS = -DMINIMA -DUSE_TAP
iverify: MAINOPTIONS = -DIVERIFY -DUSE_TAP
genera.nocona: MAINOPTIONS = -DGENERA -DAUTOSTART -DUSE_TAP #-DUSE_CPU_FOR_MICROSECOND_
SYMBOLSOPT =
#SYMBOLSOPT = -g
# -foptimize-sibling-calls -fstrength-reduce \
# -fexpensive-optimizations \
# -fsched-interblock -fsched-spec -fpeephole2 \
# -freorder-blocks -freorder-functions \
# -funit-at-a-time \
# -falign-functions -falign-jumps -falign-loops -falign-labels \
# -fcrossjumping \
# -finline-functions -frename-registers -funswitch-loops \
# -fregmove \
# -fcse-follow-jumps \
# -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse \
# -fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks \
# -foptimize-sibling-calls -fcaller-saves -Winline \
# -fno-strict-aliasing \
# -fschedule-insns -fschedule-insns2
# broken
#-fstrict-aliasing
#-fschedule-insns -fschedule-insns2
#-fforce-mem -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps
#-fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse
#-fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks
#-fexpensive-optimizations -fregmove -fschedule-insns -fsched-ule-insns2
#-fsched-interblock -fsched-spec -fcaller-saves -fpeep-hole2
#-freorder-blocks -freorder-functions -fstrict-aliasing
#-funit-at-a-time -falign-functions -falign-jumps -falign-loops
#-falign-labels -fcrossjumping
#-finline-functions, -fweb, -frename-registers and -funswitch-loops
CFLAGS = $(OPTIMOPT) $(SYMBOLSOPT) -std=gnu99 -I/usr/X11R6/include -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS)
AFLAGS = $(SYMBOLSOPT) -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS)
.SUFFIXES:
.SUFFIXES: .o .c .S
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
.S.o:
$(CC) $(AFLAGS) -o $@ -c $<
SRCS = main.c spy.c world_tools.c utilities.c \
$(LIFE)/cold_load.c $(LIFE)/console.c $(LIFE)/disks.c $(LIFE)/initialization.c \
$(LIFE)/network.c $(LIFE)/message_channels.c $(LIFE)/polling.c $(LIFE)/queues.c \
$(LIFE)/signals.c $(LIFE)/unixcrypt.c \
$(EMULATOR)/interfac.c $(EMULATOR)/interpds.c $(EMULATOR)/externals.c \
$(EMULATOR)/memory.c
NETWORKSOURCES = $(LIFE)/network-osf.c \
$(LIFE)/network-linux.c $(LIFE)/network-tun-linux.c \
$(LIFE)/network-darwin.c $(LIFE)/network-libpcap.c
FAKEEMULATOR=y
ifndef FAKEEMULATOR
ASMS = $(EMULATOR)/emulator.S
EMULATOROBJ = $(EMULATOR)/emulator.o
COMPONENTS = $(CPU)/idispat.s $(CPU)/ifuncom1.s $(CPU)/ifuncom2.s \
$(CPU)/ifungene.s $(CPU)/ifunfcal.s $(CPU)/ifunloop.s \
$(CPU)/ifunlist.s $(CPU)/ifuninst.s $(CPU)/ifunmath.s \
$(CPU)/ifunarra.s $(CPU)/ifunmove.s $(CPU)/ifunpred.s \
$(CPU)/ifunsubp.s $(CPU)/ifunfext.s $(CPU)/ifunlexi.s \
$(CPU)/ifunbits.s $(CPU)/ifunblok.s $(CPU)/ifunbind.s \
$(CPU)/ifunfull.s $(CPU)/ifunbnum.s $(CPU)/ifuntrap.s \
$(CPU)/ihalt.s $(CPU)/idouble.s $(CPU)/ifunjosh.s \
$(CPU)/ifuntran.s
else
# ASMS = $(EMULATOR)/fake_emulator.c
# EMULATOROBJ = $(EMULATOR)/fake_emulator.o
ASMS = stub/stub.c
EMULATOROBJ = stub/stub.o
COMPONENTS =
endif
OBJS = $(LIFE)/cold_load.o $(LIFE)/console.o $(LIFE)/disks.o $(LIFE)/initialization.o \
$(LIFE)/network.o $(LIFE)/message_channels.o $(LIFE)/polling.o $(LIFE)/queues.o \
$(LIFE)/signals.o $(LIFE)/unixcrypt.o \
world_tools.o utilities.o spy.o \
$(EMULATOR)/interfac.o $(EMULATOR)/interpds.o $(EMULATOR)/externals.o \
$(EMULATOR)/memory.o $(EMULATOROBJ)
EMULATORINCLUDES = $(EMULATOR)/aihead.h $(CPU)/aistat.h $(EMULATOR)/ivoryrep.h
OTHEROBJS =
ifdef NONSHARED
OTHEROBJS +=
# LIBRARIES = -lpthread -lc -lX11 -lm -lpcap
LIBRARIES = -lpthread -lc -lX11 -lm
EARLYLIBS = -L/opt/ppc64/X11R6/lib
else
OTHEROBJS +=
# LIBRARIES = -lpthread -lc -lX11 -lm
# EARLYLIBS = -L/opt/ppc64/X11R6/lib
# LIBRARIES = -rdynamic -lpthread -lc -lX11 -lm -ldl -lX11-xcb -lpcap
# LIBRARIES = -rdynamic -lpthread -lc -lX11 -lm -ldl -lX11-xcb
LIBRARIES = -rdynamic -lpthread -lc -lX11 -lm -ldl -lcrypt
EARLYLIBS = -L/usr/X11R6/lib64 -L/usr/X11R6/lib
endif
ifdef PROFILE
override PROFILE = -p
endif
all: clean genera
nocona: clean genera.nocona
$(SRCS): $(EMULATORINCLUDES)
$(LIFE)/network.o: $(NETWORKSOURCES) $(EMULATORINCLUDES)
alpha-emulator/aistat.h: alpha-emulator/aistat.sid
$(CCL) -b -Q -l compile-alpha-emulator.lisp </dev/null
emulator/aihead.h: emulator/aihead.sid
$(CCL) -b -Q -l compile-alpha-emulator.lisp </dev/null
$(CPU)/aistat.h: alpha-emulator/aistat.sid
$(CCL) -b -Q -l compile-alpha-emulator.lisp </dev/null
cp alpha-emulator/aistat.h $(CPU)/aistat.h
stub/stub.o: stub/i*.c stub/float2 stub/dispatch stub/*.c alpha-emulator/*.lisp $(EMULATORINCLUDES)
stub/i*.c: alpha-emulator/*.as alpha-emulator/*lisp alpha-emulator/*.c alpha-emulator/*.h stub/*.lisp $(EMULATORINCLUDES)
cd stub ; $(CLISP) process.lisp
$(EMULATOROBJ): $(ASMS) $(COMPONENTS) $(EMULATORINCLUDES)
$(EMULATOR)/externals.o: $(EMULATOR)/externals.c $(EMULATORINCLUDES)
$(EMULATOR)/interpds.o: $(EMULATOR)/interpds.c $(EMULATORINCLUDES) $(EMULATOR)/asmfuns.h
$(EMULATOR)/interfac.o: $(EMULATOR)/interfac.c $(EMULATORINCLUDES)
spy.o: spy.c $(EMULATORINCLUDES)
genera: CFLAGS = $(OPTIMOPT) $(SYMBOLSOPT) -std=gnu99 -I/usr/X11R6/include -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS)
genera: main.o byteswap_world.o $(OBJS) $(OTHEROBJS)
cc $(PROFILE) -o genera $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES)
cc $(PROFILE) -o byteswap_world $(EARLYLIBS) $(OTHEROBJS) byteswap_world.o $(OBJS) $(LIBRARIES)
#OPTIMOPT = -Ofast -march=nocona -fno-strict-aliasing
genera.nocona: CFLAGS = $(NOCONAOPTIMOPT) $(SYMBOLSOPT) -std=gnu99 -I/usr/X11R6/include -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS)
genera.nocona: main.o byteswap_world.o $(OBJS) $(OTHEROBJS)
cc $(PROFILE) -o genera.nocona $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES)
cc $(PROFILE) -o byteswap_world.nocona $(EARLYLIBS) $(OTHEROBJS) byteswap_world.o $(OBJS) $(LIBRARIES)
minima: main.o $(OBJS) $(OTHEROBJS)
cc $(PROFILE) -o minima $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES)
iverify: main.o $(OBJS) $(OTHEROBJS)
cc $(PROFILE) -o iverify $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES)
clean:
rm -f main.o byteswap_world.o $(OBJS) *~ ./stub/i*.c ./stub/*~ $(LIFE)/*~ $(EMULATOR)/*~ $(CPU)/*~ **/*~