|
| 1 | +# |
| 2 | +# Builds the Ivory Emulator (VLM) |
| 3 | +# |
| 4 | +# The command line to build an emulator is |
| 5 | +# |
| 6 | +# make {OPTIONS="option1 option2 ..."} {NONSHARED=YES} TARGET |
| 7 | +# |
| 8 | +# where TARGET is either "genera", "minima", or "iverify". The makefile will |
| 9 | +# automatically include the -DGENERA, -DMINIMA, or -DIVERIFY preprocessor option |
| 10 | +# when invoking the compiler and assembler. |
| 11 | +# |
| 12 | +# On the make command line, use OPTIONS="option1 option2 ..." to specify compiler |
| 13 | +# and assembler options, notably preprocessor options. |
| 14 | +# |
| 15 | +# The main preprocessor options used throughout the sources are |
| 16 | +# GENERA to build an emulator that is intended to run Genera |
| 17 | +# MINIMA to build an emulator that is intended to run Minima |
| 18 | +# IVERIFY to build an emulator that is intended to run the instruction test suite |
| 19 | +# TRACING to enable instruction tracing and counting |
| 20 | +# CACHEMETERING to enable instruction cache metering facilities |
| 21 | +# TRAPMETERING to enable trap metering facilities |
| 22 | +# STATISTICS to enable other statistics-gathering facilities |
| 23 | +# if enabled: |
| 24 | +# EXECTIMES : enable execution times statistics |
| 25 | +# ends up in "usagedata.lisp" / "usagedata.text" after a vlm run |
| 26 | +# DEBUGGING to enable debugging facilities |
| 27 | +# DEBUG* to enable other, more specific debugging facilities |
| 28 | +# AUTOSTART to immediately start execution of the loaded image without waiting for |
| 29 | +# a :Start Interactor command from the Minima Debugger. (This option is defined |
| 30 | +# automatically when the TARGET is "genera".) |
| 31 | +# USE_CPU_FOR_MICROSECOND_CLOCK to use the process CPU time rather than elapsed time |
| 32 | +# as the value of Ivory's microsecond clock |
| 33 | +# DISK_SIZE_1536 to enable disks.c to read 1536 bytes sectors |
| 34 | +# instead of the default 8192 byte sectors |
| 35 | +# DEBUG_DISK |
| 36 | +# enable disk read/write verbosity |
| 37 | +# DEBUG_NETWORk |
| 38 | +# Networking debug verbosity |
| 39 | +# if enabled: |
| 40 | +# DEBUG_CHAOS |
| 41 | +# DEBUG_IP |
| 42 | +# DEBUG_ARP |
| 43 | +# DEBUG_ICMP |
| 44 | +# verbosity of indiv. netwoeking parts |
| 45 | +# |
| 46 | +# For example, to create an emulator that runs Genera but waits for a :Start Interactor |
| 47 | +# command from the Minima Debugger before booting and also has debugging features enabled, |
| 48 | +# |
| 49 | +# make genera OPTIONS="-DDEBUGGING -UAUTOSTART" |
| 50 | +# |
| 51 | +# If you specify a target different from your last build, you must remove all object |
| 52 | +# files first to ensure that everything is properly compiled. Use the "clean" target. |
| 53 | +# |
| 54 | +# In fact, if you change any settings between builds, it's a good idea to build from scratch |
| 55 | +# |
| 56 | +# On the make command line, use PROFILE=YES to build the VLM using the profiling option |
| 57 | +# to gather statistics on execution frequencies. |
| 58 | +# |
| 59 | +# On the make command line, use NONSHARED=YES to build the VLM using the non-shared |
| 60 | +# libraries. (The default is to use the shared libraries.) |
| 61 | +# |
| 62 | + |
| 63 | + |
| 64 | +LIFE = ./life-support |
| 65 | +EMULATOR = ./emulator |
| 66 | +G5EMULATOR = ./g5-emulator |
| 67 | +X86EMULATOR = ./x86_64-emulator |
| 68 | +OTHER = ./other |
| 69 | + |
| 70 | +CPU = $(X86EMULATOR) |
| 71 | +CLISP = /usr/bin/clisp |
| 72 | +CCL=/home/lispm/ccl/scripts/ccl64 |
| 73 | +OPTIMOPT = -Ofast -march=native -fno-strict-aliasing |
| 74 | +NOCONAOPTIMOPT = -Ofast -march=nocona -fno-strict-aliasing |
| 75 | + |
| 76 | +genera: MAINOPTIONS = -DGENERA -DAUTOSTART -DUSE_TAP #-DUSE_CPU_FOR_MICROSECOND_CLOCK |
| 77 | +minima: MAINOPTIONS = -DMINIMA -DUSE_TAP |
| 78 | +iverify: MAINOPTIONS = -DIVERIFY -DUSE_TAP |
| 79 | + |
| 80 | +genera.nocona: MAINOPTIONS = -DGENERA -DAUTOSTART -DUSE_TAP #-DUSE_CPU_FOR_MICROSECOND_ |
| 81 | + |
| 82 | +SYMBOLSOPT = |
| 83 | +#SYMBOLSOPT = -g |
| 84 | + |
| 85 | +# -foptimize-sibling-calls -fstrength-reduce \ |
| 86 | +# -fexpensive-optimizations \ |
| 87 | +# -fsched-interblock -fsched-spec -fpeephole2 \ |
| 88 | +# -freorder-blocks -freorder-functions \ |
| 89 | +# -funit-at-a-time \ |
| 90 | +# -falign-functions -falign-jumps -falign-loops -falign-labels \ |
| 91 | +# -fcrossjumping \ |
| 92 | +# -finline-functions -frename-registers -funswitch-loops \ |
| 93 | +# -fregmove \ |
| 94 | +# -fcse-follow-jumps \ |
| 95 | +# -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse \ |
| 96 | +# -fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks \ |
| 97 | +# -foptimize-sibling-calls -fcaller-saves -Winline \ |
| 98 | +# -fno-strict-aliasing \ |
| 99 | +# -fschedule-insns -fschedule-insns2 |
| 100 | + |
| 101 | +# broken |
| 102 | +#-fstrict-aliasing |
| 103 | +#-fschedule-insns -fschedule-insns2 |
| 104 | + |
| 105 | +#-fforce-mem -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps |
| 106 | +#-fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse |
| 107 | +#-fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks |
| 108 | +#-fexpensive-optimizations -fregmove -fschedule-insns -fsched-ule-insns2 |
| 109 | +#-fsched-interblock -fsched-spec -fcaller-saves -fpeep-hole2 |
| 110 | +#-freorder-blocks -freorder-functions -fstrict-aliasing |
| 111 | +#-funit-at-a-time -falign-functions -falign-jumps -falign-loops |
| 112 | +#-falign-labels -fcrossjumping |
| 113 | + |
| 114 | +#-finline-functions, -fweb, -frename-registers and -funswitch-loops |
| 115 | + |
| 116 | +CFLAGS = $(OPTIMOPT) $(SYMBOLSOPT) -std=gnu99 -I/usr/X11R6/include -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS) |
| 117 | +AFLAGS = $(SYMBOLSOPT) -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS) |
| 118 | + |
| 119 | +.SUFFIXES: |
| 120 | +.SUFFIXES: .o .c .S |
| 121 | + |
| 122 | +.c.o: |
| 123 | + $(CC) $(CFLAGS) -o $@ -c $< |
| 124 | + |
| 125 | +.S.o: |
| 126 | + $(CC) $(AFLAGS) -o $@ -c $< |
| 127 | + |
| 128 | +SRCS = main.c spy.c world_tools.c utilities.c \ |
| 129 | + $(LIFE)/cold_load.c $(LIFE)/console.c $(LIFE)/disks.c $(LIFE)/initialization.c \ |
| 130 | + $(LIFE)/network.c $(LIFE)/message_channels.c $(LIFE)/polling.c $(LIFE)/queues.c \ |
| 131 | + $(LIFE)/signals.c $(LIFE)/unixcrypt.c \ |
| 132 | + $(EMULATOR)/interfac.c $(EMULATOR)/interpds.c $(EMULATOR)/externals.c \ |
| 133 | + $(EMULATOR)/memory.c |
| 134 | + |
| 135 | +NETWORKSOURCES = $(LIFE)/network-osf.c \ |
| 136 | + $(LIFE)/network-linux.c $(LIFE)/network-tun-linux.c \ |
| 137 | + $(LIFE)/network-darwin.c $(LIFE)/network-libpcap.c |
| 138 | + |
| 139 | +FAKEEMULATOR=y |
| 140 | +ifndef FAKEEMULATOR |
| 141 | + ASMS = $(EMULATOR)/emulator.S |
| 142 | + EMULATOROBJ = $(EMULATOR)/emulator.o |
| 143 | + COMPONENTS = $(CPU)/idispat.s $(CPU)/ifuncom1.s $(CPU)/ifuncom2.s \ |
| 144 | + $(CPU)/ifungene.s $(CPU)/ifunfcal.s $(CPU)/ifunloop.s \ |
| 145 | + $(CPU)/ifunlist.s $(CPU)/ifuninst.s $(CPU)/ifunmath.s \ |
| 146 | + $(CPU)/ifunarra.s $(CPU)/ifunmove.s $(CPU)/ifunpred.s \ |
| 147 | + $(CPU)/ifunsubp.s $(CPU)/ifunfext.s $(CPU)/ifunlexi.s \ |
| 148 | + $(CPU)/ifunbits.s $(CPU)/ifunblok.s $(CPU)/ifunbind.s \ |
| 149 | + $(CPU)/ifunfull.s $(CPU)/ifunbnum.s $(CPU)/ifuntrap.s \ |
| 150 | + $(CPU)/ihalt.s $(CPU)/idouble.s $(CPU)/ifunjosh.s \ |
| 151 | + $(CPU)/ifuntran.s |
| 152 | +else |
| 153 | +# ASMS = $(EMULATOR)/fake_emulator.c |
| 154 | +# EMULATOROBJ = $(EMULATOR)/fake_emulator.o |
| 155 | + ASMS = stub/stub.c |
| 156 | + EMULATOROBJ = stub/stub.o |
| 157 | + COMPONENTS = |
| 158 | +endif |
| 159 | + |
| 160 | +OBJS = $(LIFE)/cold_load.o $(LIFE)/console.o $(LIFE)/disks.o $(LIFE)/initialization.o \ |
| 161 | + $(LIFE)/network.o $(LIFE)/message_channels.o $(LIFE)/polling.o $(LIFE)/queues.o \ |
| 162 | + $(LIFE)/signals.o $(LIFE)/unixcrypt.o \ |
| 163 | + world_tools.o utilities.o spy.o \ |
| 164 | + $(EMULATOR)/interfac.o $(EMULATOR)/interpds.o $(EMULATOR)/externals.o \ |
| 165 | + $(EMULATOR)/memory.o $(EMULATOROBJ) |
| 166 | + |
| 167 | +EMULATORINCLUDES = $(EMULATOR)/aihead.h $(CPU)/aistat.h $(EMULATOR)/ivoryrep.h |
| 168 | + |
| 169 | +OTHEROBJS = |
| 170 | + |
| 171 | +ifdef NONSHARED |
| 172 | + OTHEROBJS += |
| 173 | +# LIBRARIES = -lpthread -lc -lX11 -lm -lpcap |
| 174 | + LIBRARIES = -lpthread -lc -lX11 -lm |
| 175 | + EARLYLIBS = -L/opt/ppc64/X11R6/lib |
| 176 | +else |
| 177 | + OTHEROBJS += |
| 178 | +# LIBRARIES = -lpthread -lc -lX11 -lm |
| 179 | +# EARLYLIBS = -L/opt/ppc64/X11R6/lib |
| 180 | +# LIBRARIES = -rdynamic -lpthread -lc -lX11 -lm -ldl -lX11-xcb -lpcap |
| 181 | +# LIBRARIES = -rdynamic -lpthread -lc -lX11 -lm -ldl -lX11-xcb |
| 182 | + LIBRARIES = -rdynamic -lpthread -lc -lX11 -lm -ldl -lcrypt |
| 183 | + EARLYLIBS = -L/usr/X11R6/lib64 -L/usr/X11R6/lib |
| 184 | +endif |
| 185 | + |
| 186 | +ifdef PROFILE |
| 187 | + override PROFILE = -p |
| 188 | +endif |
| 189 | + |
| 190 | +all: clean genera |
| 191 | +nocona: clean genera.nocona |
| 192 | + |
| 193 | +$(SRCS): $(EMULATORINCLUDES) |
| 194 | + |
| 195 | +$(LIFE)/network.o: $(NETWORKSOURCES) $(EMULATORINCLUDES) |
| 196 | + |
| 197 | +alpha-emulator/aistat.h: alpha-emulator/aistat.sid |
| 198 | + $(CCL) -b -Q -l compile-alpha-emulator.lisp </dev/null |
| 199 | + |
| 200 | +emulator/aihead.h: emulator/aihead.sid |
| 201 | + $(CCL) -b -Q -l compile-alpha-emulator.lisp </dev/null |
| 202 | + |
| 203 | +$(CPU)/aistat.h: alpha-emulator/aistat.sid |
| 204 | + $(CCL) -b -Q -l compile-alpha-emulator.lisp </dev/null |
| 205 | + cp alpha-emulator/aistat.h $(CPU)/aistat.h |
| 206 | + |
| 207 | +stub/stub.o: stub/i*.c stub/float2 stub/dispatch stub/*.c alpha-emulator/*.lisp $(EMULATORINCLUDES) |
| 208 | + |
| 209 | +stub/i*.c: alpha-emulator/*.as alpha-emulator/*lisp alpha-emulator/*.c alpha-emulator/*.h stub/*.lisp $(EMULATORINCLUDES) |
| 210 | + cd stub ; $(CLISP) process.lisp |
| 211 | + |
| 212 | +$(EMULATOROBJ): $(ASMS) $(COMPONENTS) $(EMULATORINCLUDES) |
| 213 | + |
| 214 | +$(EMULATOR)/externals.o: $(EMULATOR)/externals.c $(EMULATORINCLUDES) |
| 215 | +$(EMULATOR)/interpds.o: $(EMULATOR)/interpds.c $(EMULATORINCLUDES) $(EMULATOR)/asmfuns.h |
| 216 | +$(EMULATOR)/interfac.o: $(EMULATOR)/interfac.c $(EMULATORINCLUDES) |
| 217 | +spy.o: spy.c $(EMULATORINCLUDES) |
| 218 | + |
| 219 | +genera: CFLAGS = $(OPTIMOPT) $(SYMBOLSOPT) -std=gnu99 -I/usr/X11R6/include -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS) |
| 220 | + |
| 221 | +genera: main.o byteswap_world.o $(OBJS) $(OTHEROBJS) |
| 222 | + cc $(PROFILE) -o genera $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES) |
| 223 | + cc $(PROFILE) -o byteswap_world $(EARLYLIBS) $(OTHEROBJS) byteswap_world.o $(OBJS) $(LIBRARIES) |
| 224 | + |
| 225 | +#OPTIMOPT = -Ofast -march=nocona -fno-strict-aliasing |
| 226 | +genera.nocona: CFLAGS = $(NOCONAOPTIMOPT) $(SYMBOLSOPT) -std=gnu99 -I/usr/X11R6/include -I. -I$(LIFE) -I$(EMULATOR) -I$(X86EMULATOR) $(MAINOPTIONS) $(OPTIONS) |
| 227 | + |
| 228 | +genera.nocona: main.o byteswap_world.o $(OBJS) $(OTHEROBJS) |
| 229 | + cc $(PROFILE) -o genera.nocona $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES) |
| 230 | + cc $(PROFILE) -o byteswap_world.nocona $(EARLYLIBS) $(OTHEROBJS) byteswap_world.o $(OBJS) $(LIBRARIES) |
| 231 | + |
| 232 | +minima: main.o $(OBJS) $(OTHEROBJS) |
| 233 | + cc $(PROFILE) -o minima $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES) |
| 234 | + |
| 235 | +iverify: main.o $(OBJS) $(OTHEROBJS) |
| 236 | + cc $(PROFILE) -o iverify $(EARLYLIBS) $(OTHEROBJS) main.o $(OBJS) $(LIBRARIES) |
| 237 | + |
| 238 | +clean: |
| 239 | + rm -f main.o byteswap_world.o $(OBJS) *~ ./stub/i*.c ./stub/*~ $(LIFE)/*~ $(EMULATOR)/*~ $(CPU)/*~ **/*~ |
| 240 | + |
0 commit comments