p2/test/Makefile

63 lines
1.7 KiB
Makefile

# 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
ARCHDIR = ../../mips-x86.linux-xgcc
GCCDIR = $(ARCHDIR)/mips-
ASFLAGS = -mips1
CPPFLAGS =
CFLAGS = -O2 -B$(GCCDIR) -G 0 -Wa,-mips1 -nostdlib -ffreestanding
LDFLAGS = -s -T script -N -warn-common -warn-constructors -warn-multiple-gp
PATH=$(ARCHDIR)
CC = $(GCCDIR)gcc
AS = $(GCCDIR)as
LD = $(GCCDIR)ld
CPP = $(GCCDIR)cpp
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 mytest1 mytest2a mytest2b mytest2c mytest2d mytest3 mytest4 #chat chatserver
.SECONDARY: $(patsubst %.c,%.o,$(wildcard *.c))
all: $(patsubst %,%.coff,$(TARGETS))
ag: grade-file.coff grade-exec.coff grade-mini.coff grade-dumb.coff
clean:
/bin/rm -f strt.s *.o *.coff $(NLIB)
agclean: clean
/bin/rm -f f1-* f2-*
$(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
/bin/rm strt.s
%.o: %.c *.h
$(CC) $(CFLAGS) -c $<
%.coff: %.o $(NLIB)
$(LD) $(LDFLAGS) -o $@ $< start.o -lnachos