1 include ../../Make.config
8 CPPFLAGS = -nostdinc -I../.. -I- -I../../lib -I../../lib/user \
11 # Test programs to compile, and a list of sources for each.
12 # To add a new test, put its name on the PROGS list
13 # and then add a name_SRC line that lists its source files.
14 PROGS = bubsort echo halt insult lineup matmult recursor shell
15 bubsort_SRC = bubsort.c
20 matmult_SRC = matmult.c
21 recursor_SRC = recursor.c
25 LDFLAGS = -nostdlib -static -s
26 LDLIBS = $(shell $(CC) -print-libgcc-file-name)
28 # Uncomment the line below to round up segment sizes to full pages for
29 # testing purposes only.
30 #LDFLAGS += -Wl,-T,fullpage.x
32 # C library sources linked into every test program.
33 LIB_SRC = lib/debug.c # Debug code.
34 LIB_SRC += lib/random.c # Pseudo-random numbers.
35 LIB_SRC += lib/stdio.c # I/O library.
36 LIB_SRC += lib/stdlib.c # atoi()
37 LIB_SRC += lib/string.c # String functions.
38 LIB_SRC += lib/user/syscall.c # System calls.
39 LIB_SRC += lib/user/syscall-stub.S # System call stub.
40 LIB_SRC += lib/user/console.c # Console code.
42 LIB_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(LIB_SRC)))
43 LIB_DEP = $(patsubst %.o,%.d,$(LIB_OBJ))
44 LIB = lib/user/entry.o libc.a
46 PROGS_SRC = $(foreach prog,$(PROGS),$($(prog)_SRC))
47 PROGS_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(PROGS_SRC)))
48 PROGS_DEP = $(patsubst %.o,%.d,$(PROGS_OBJ))
53 $(1)_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$($(1)_SRC)))
54 $(1): $$($(1)_OBJ) $$(LIB) | ./lib/user
60 $(foreach prog,$(PROGS),$(eval $(call TEMPLATE,$(prog))))
70 rm -f $(PROGS) $(PROGS_OBJ) $(PROGS_DEP)
71 rm -f $(LIB_DEP) $(LIB_OBJ) lib/user/entry.[do] libc.a
75 -include $(LIB_DEP) $(PROGS_DEP)