-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (43 loc) · 1.59 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
# GNU Makefile for building user programs to run on top of Nachos
#
# Things to be aware of:
#
# The value of the ARCHDIR environment variable must be set before using
# this makefile. If you are using an instructional machine, this should
# be automatic. However, if you are not using an instructional machine,
# you need to point ARCHDIR at the cross-compiler directory, e.g.
# setenv ARCHDIR ../mips-x86.win32-xgcc
# you need to point to the right executables
GCCDIR = /Users/pauljohnson/ConcurrentTeaching/bin/decstation-ultrix-
ASFLAGS = -mips1
CPPFLAGS = -E
CFLAGS = -O2 -B$(GCCDIR) -G 0 -Wa,-mips1 -nostdlib -ffreestanding
LDFLAGS = -s -T script -N -warn-common -warn-constructors -warn-multiple-gp
CC = $(GCCDIR)gcc
AS = $(GCCDIR)as
LD = $(GCCDIR)ld
CPP = $(GCCDIR)g++
AR = $(GCCDIR)ar
RANLIB = $(GCCDIR)ranlib
STDLIB_H = stdio.h stdlib.h ag.h
STDLIB_C = stdio.c stdlib.c
STDLIB_O = start.o stdio.o stdlib.o
LIB = assert atoi printf readline stdio strncmp strcat strcmp strcpy strlen memcpy memset
NLIB = libnachos.a
TARGETS = halt sh matmult sort echo cat cp mv rm kernel idle testwrite testexecute testproc forktest sharedtest dirtest #chat chatserver
.SECONDARY: $(patsubst %.c,%.o,$(wildcard *.c))
all: $(patsubst %,%.coff,$(TARGETS))
clean:
rm -f strt.s *.o *.coff $(NLIB)
rm -f ../files/*.coff
$(NLIB): $(patsubst %,$(NLIB)(%.o),$(LIB)) start.o
$(RANLIB) $(NLIB)
start.o: start.S syscall.h
$(CPP) $(CPPFLAGS) start.S > strt.s
$(AS) $(ASFLAGS) -o start.o strt.s
rm strt.s
%.o: %.c *.h
$(CC) $(CFLAGS) -c $<
%.coff: %.o $(NLIB)
$(LD) $(LDFLAGS) -o $@ $< start.o -lnachos
cp $@ ../files