-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
424 lines (359 loc) · 17 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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
#-------------------------------------------------------
# Makefile for GNU SPEDE/X86-GCC.
# $Header: /export/home/aleks/Projects/Intel-159/Core/00-Tools/Scripts/RCS/model.makefile,v 2.11 2001/08/31 05:52:42 aleks Exp $
# CSU Sacramento, CA. USA, Dr. J. Clevenger ([email protected])
# brian witt ([email protected])
#
# C++ files have .C, .cxx, cpp or .cc extention. Assembler files use
# .S please. Generated assembler files have .asm extention, so they
# can easily be deleted during a ``make clean'' call.
#
# Dependencies are inserted into user's Makefile.
# Version control is whatever is needed (ie, not coded directly).
# Reads "local.mk" if exists. This requires GNU Make !!
#
# For those wanting backup power, "make tarball" will create a tar
# file of source and headers in the parent directory. The Makefile
# will never erase this file.
#
# (27-mar-97, bwitt) Revised to 68-mkmf
# (19-Jan-2000, bwitt) Now for X86-SPEDE [2.1], based on [1.5]
# (30-March-2000, bwitt) Added "tags" target [2.5]
# (21-April-2000, bwitt) "make bootable" copies RAWRITE.EXE and BOOT.COM
# Added "-include local.mk" [2.7]
# (16-feb-2001, bwitt) Added .cpp for C++ source files [2.8]
# (31-March-2001, bwitt) target "tarball" added [2.9]
# (17-August-2001, bwitt) Put OBJS= before include "local.mk" so it
# can work with $(OBJS) [2.10]
#
MKF_VERSION=$Release$/March2001/bwitt
#
# .asm is an output extension so we can generate assembly files.
# These are for additional suffixes.
#
# NOTE: *.asm files are deleted for `make clean', and should ONLY
# be used for a target, not a source. Use .S for assembler
# files you write (do cpp before assembling).
#
.SUFFIXES: .S .asm .E .cxx .C .cc .cpp
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#--------------------------------------
# This section contains definitions which can (and in some cases MUST)
# be changed. See commentary for details. Don't use quotes in variable
# assignments below. After changing any values here, run "make depend".
#
#
# (1) Please name your operating system. Must be a legal filename,
# and not contain spaces or punctuation. It will be used to
# name you DLI file (see "MY_DLI =" below).
#
OS_NAME = MyOS
#
# (2) This section lists the source files for your executable.
# NOTE: Keep the spaces around the equals sign (=) please.
# If this changes, run "make depend" to update $OBJECTS.
#
SRC = events.S handlers.c main.c proc.c services.c tools.c
#
# (3) Add any compiler options you want. They will be passed to gcc386
# and g++386. Some examples are "-v" to run the compiler in verbose
# mode, will display details compiler takes. Using "-I ../headers"
# will tell the compiler to look in the directory "../headers" for
# additional "include" files.
#
EXTRA_CFLAGS =
#
# (4) If you always want symbolic debugging information added to your
# executable, set this to "-g" . Or always use the "make debug"
# target. Use "-M" to create a mapfile of the image.
#
EXTRA_LINK_FLAGS =
#--------------------------------------
# End of student-customization section
#--------------------------------------
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#--------------------------------------
# Rules of construction:
#
.cc.o:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.cc.asm:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -S -o $@ $<
@echo NOTE: $@ is a temporary file
.cc.E:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -E -o $@ $<
.C.o:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.C.asm:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -S -o $@ $<
@echo NOTE: $@ is a temporary file
.C.E:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -E -o $@ $<
.cpp.o:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.cpp.asm:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -S -o $@ $<
@echo NOTE: $@ is a temporary file
.cpp.E:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -E -o $@ $<
.cxx.o:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.cxx.asm:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -S -o $@ $<
@echo NOTE: $@ is a temporary file
.cxx.E:
$(CPLUS) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -E -o $@ $<
.c.o:
$(CC) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.c.asm:
$(CC) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -S -o $@ $<
@echo NOTE: $@ is a temporary file
.c.E:
$(CC) $(MODEL) $(CFLAGS) $(EXTRA_CFLAGS) -E -o $@ $<
.S.o:
$(CC) -DASSEMBLER $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.S.E:
$(CC) -DASSEMBLER $(CFLAGS) $(EXTRA_CFLAGS) -E -o $@ $<
#--------------------------------------
# Programs to use:
#
## SHELL = /bin/sh
#CPLUS = /root/spede/Target-i386/i686/gnu/bin/i386-unknown-gnu-g++
CC = i386-unknown-gnu-gcc
AS = i386-unknown-gnu-as
AR = i386-unknown-gnu-ar
NM = i386-unknown-gnu-nm
CMD_LINKER = link386
CMD_MAKEMAKE = spede-mkmf
CMD_TAGS = ctags
CMD_DELETE = rm -f
CMD_COPY = cp -p
# Program and options to download a DLI file.
CMD_DOWNLOADER = flash -d
#
# Given the operating system name as a base, add various extensions.
#
MY_DLI = $(OS_NAME).dli
#--------------------------------------
# List of files to be removed by "make clean"
# Emacs rename backup files to foo~ (trailing tilde).
#
CLEAN_FILES = core *.o *.asm mapfile $(MY_DLI) *~ make.orig *.E tags \
TAGS $(OS_NAME).boot $(OS_NAME).bin *.RC
#--------------------------------------
# Options and Flags:
#
#
# Optimizations flags and what they do. (*) Recommended. If generating
# A.OUT files, must specifiy "-fwritable-strings".
#
# -fno-defer-pop Immediately after function return, pop
# the argument off (easier to debug).
# -fdefer-pop Wait until control flow splits before
# popping functions args from stack.
# -fwritable-strings Please string constants in .data segment
# so they can be modified (away from .code).
# -fnowritable-strings Please string constants inside .code segment,
# which makes code dis-assembly confusing.
# -O1 Perform minor optimizations. Also does code
# flow analysis for improved error reporting.
#
## OPTIMIZE = -O1 -fno-defer-pop
OPTIMIZE =
#
# If you set $CF_DEBUG to -g here, source files will _always_ compile
# with symbolic debugging info. Which makes "make debug" redundant.
#
CF_DEBUG = -g
TARGET_MACH = -i386-unknown-gnu
MODEL = $(TARGET_MACH)
#
# $CFLAGS and $EXTRA_CFLAGS will be passed to GCC compiler.
# -Wall Report as many errors and warnings as possible.
# -g ALways include dbeug info on objects.
#
CFLAGS = -Wall $(OPTIMIZE) -g
ASFLAGS = $(TARGET_MACH)
LINK_FLAGS = $(CF_DEBUG) $(EXTRA_LINK_FLAGS)
#--------------------------------------
# Start of "targets" which can be specified when invoking "make":
# Added $(OS_NAME) for people that want a short-hand.
#
# The use of double-colons (::) here allows the "local.mk" file to
# extend all targets This is required for `phony' targets (those
# which don't actually create anything).
#
.PHONY : all debug d clean text depends depend source help \
$(OS_NAME) tags bootable salone tarball
all :: $(MY_DLI)
$(OS_NAME) :: $(MY_DLI)
debug ::
-@$(CMD_DELETE) $(MY_DLI)
@$(MAKE)
d ::
$(CMD_DOWNLOADER) $(MY_DLI)
clean ::
$(CMD_DELETE) $(CLEAN_FILES)
tags ::
$(CMD_TAGS) $(SRC)
text ::
objdump386 --disassemble --file-headers --reloc --source $(MY_DLI) > dli.asm
@echo "Image dis-assembly into dli.asm done."
tarball : source
tar cvf ../$(OS_NAME).tar $(SRC) *.h Makefile
bootable :: $(MY_DLI) $(OS_NAME).ini RAWRITE.EXE
bootmaker -floppy $(OS_NAME).ini $(OS_NAME).boot
@echo "Raw copy using \`dd' or RAWRITE.EXE $(OS_NAME).boot to a floppy."
@echo " dd if=$(OS_NAME).boot of=/dev/rdiskette bs=512"
salone :: $(MY_DLI) $(OS_NAME).ini BOOT.COM
bootmaker $(OS_NAME).ini $(OS_NAME).bin
@echo "Copy $(OS_NAME).bin and BOOT.COM to a floppy."
depends :: depend
depend ::
$(CMD_MAKEMAKE)
source :: $(SRC)
help ::
@echo "This Makefile builds $(MY_DLI)."
@echo " make all -- Builds your program $(MY_DLI)"
@echo " make debug -- Create program ready for symbolic debugging"
@echo " make d -- Download *current* version of $(MY_DLI)"
@echo " make clean -- Remove files which can be regenerated"
@echo " make text -- Dis-assemble $(MY_DLI) into 'dli.asm'"
@echo " make tags -- function tags for Emacs and vi"
@echo " make depend -- Rebuild dependencies"
@echo " make source -- Retrieve all source files from version control"
@echo " make tarball -- Create TAR file in parent directory"
@echo " make bootable -- Create self-booting image '$(OS_NAME).boot'"
@echo " make salone -- Create stand-alone version '$(OS_NAME).bin'"
#-------------------------------------
# List of object files.
#### YQYQYQ-MARK-1 ####
OBJECTS = events.o handlers.o main.o proc.o services.o tools.o
#### YQYQYQ-STOP-1 ####
#-------------------------------------
# If user has a "local.mk" here, then include that too.
# Can add more dependencies to "all". If extending existing targets,
# you must use double-colon rules (see them above). These rules are
# executed in the order seen, ie those above, then from "local.mk".
#
# Using "-include local.mk", GNU Make won't complain if file not found.
#
-include local.mk
#
# Create a bootmaker INI file on demand.
#
$(OS_NAME).ini :
@echo "Note: creating $(OS_NAME).INI file for bootmaker utility."
@echo '# Bootmaker INI file ($(MKF_VERSION)), created ' `date` > $(OS_NAME).ini
@echo "[kernel]" >> $(OS_NAME).ini
@echo "type=boot" >> $(OS_NAME).ini
@echo "file=$(MY_DLI)" >> $(OS_NAME).ini
@echo "ventry=128" >> $(OS_NAME).ini
#--------------------------------------
# Programs to support booting from a floppy disk.
# Files are stored in tools/etc/ dir. Use dirname to remove "flash".
# Climb to parent and back down to ../etc/ directory. This convolution
# means this file has no SPEDE paths hard-coded into it.
#
RAWRITE.EXE BOOT.COM :
( d=`which flash` ; $(CMD_COPY) `dirname $$d`/../etc/$@ . );
#-------------------------------------
# end of primary targets
#--------------------------------------
#--------------------------------------
# Targets that every SPEDE GCC project will have.
#
$(MY_DLI) : $(OBJECTS) Makefile
$(CMD_LINKER) $(LINK_FLAGS) -o $(MY_DLI) $(OBJECTS)
#--------------------------------------
#
# Dependencies.
#### YQYQYQ-MARK-2 ####
#
# Dependencies generated Sun Feb 17 19:48:13 PST 2019 by (spede-mkmf $Revision: 1.2 $/1)
#
events.o: events.S \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/asmacros.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/cdefs.h \
events.h types.h FStypes.h
handlers.o: handlers.c spede.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/flames.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/cdefs.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/types.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/ascii.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/bits.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdio.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdarg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/assert.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/io.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stddef.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/proc_reg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/seg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/asmacros.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/parallel.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/rs232.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/string.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdlib.h \
types.h FStypes.h handlers.h tools.h data.h proc.h
main.o: main.c spede.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/flames.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/cdefs.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/types.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/ascii.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/bits.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdio.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdarg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/assert.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/io.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stddef.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/proc_reg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/seg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/asmacros.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/parallel.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/rs232.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/string.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdlib.h \
handlers.h types.h FStypes.h tools.h proc.h events.h services.h \
FSdata.h bin-code/sleep3.txt bin-code/printer_msg.txt \
bin-code/PF_test.txt
proc.o: proc.c spede.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/flames.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/cdefs.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/types.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/ascii.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/bits.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdio.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdarg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/assert.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/io.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stddef.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/proc_reg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/seg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/asmacros.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/parallel.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/rs232.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/string.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdlib.h \
data.h types.h FStypes.h proc.h services.h tools.h
services.o: services.c data.h types.h FStypes.h tools.h services.h
tools.o: tools.c spede.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/flames.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/cdefs.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/types.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/ascii.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/sys/bits.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdio.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdarg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/assert.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/io.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stddef.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/proc_reg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/seg.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/asmacros.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/parallel.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/machine/rs232.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/string.h \
/gaia/home/project/spede2/Target-i386/i686/gnu/i386-unknown-gnu/include/spede/stdlib.h \
types.h FStypes.h data.h
#### YQYQYQ-STOP-2 ####
# eof