1 include ../../Make.config
5 LDFLAGS = -nostdlib -static -Wl,-T,elf.x
6 LDLIBS = $(shell $(CC) -print-libgcc-file-name)
11 CPPFLAGS = -nostdinc -I../.. -I- -I../../lib -I../../lib/user
13 # C library sources linked into every test program.
14 LIB_SRC = lib/debug.c # Debug code.
15 LIB_SRC += lib/random.c # Pseudo-random numbers.
16 LIB_SRC += lib/stdio.c # I/O library.
17 LIB_SRC += lib/stdlib.c # atoi()
18 LIB_SRC += lib/string.c # String functions.
19 LIB_SRC += lib/user/syscall.c # System calls.
20 LIB_SRC += lib/user/syscall-stub.S # System call stub.
21 LIB_SRC += lib/user/console.c # Console code.
23 LIB_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(LIB_SRC)))
24 LIB_DEP = $(patsubst %.o,%.d,$(LIB_OBJ))
25 LIB = libc.a lib/user/entry.o
27 PROGS = bubsort echo halt insult lineup matmult recursor shell
28 bubsort_SRC = bubsort.c
33 matmult_SRC = matmult.c
34 recursor_SRC = recursor.c
37 PROGS_SRC = $(foreach prog,$(PROGS),$($(prog)_SRC))
38 PROGS_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(PROGS_SRC)))
39 PROGS_DEP = $(patsubst %.o,%.d,$(PROGS_OBJ))
44 $(1)_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$($(1)_SRC)))
45 $(1): $$($(1)_OBJ) $$(LIB) | ./lib/user
51 $(foreach prog,$(PROGS),$(eval $(call TEMPLATE,$(prog))))
61 rm -f $(PROGS) $(PROGS_OBJ) $(PROGS_DEP)
62 rm -f $(LIB_DEP) $(LIB_OBJ) lib/user/entry.[do] libc.a
66 -include $(LIB_DEP) $(PROGS_DEP)