X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fuserprog%2FMakefile;h=0fae9628f2867db00ea3e7a2b95f0162d498cce7;hb=e097fdff5cd4b243a7d8fa6344985bbe2b27d69b;hp=9af275f5b27c3afb8e3da85c738ffb6b512b457c;hpb=d46fd132092304422193b717d9a60641604cc1b5;p=pintos-anon diff --git a/src/tests/userprog/Makefile b/src/tests/userprog/Makefile index 9af275f..0fae962 100644 --- a/src/tests/userprog/Makefile +++ b/src/tests/userprog/Makefile @@ -2,13 +2,32 @@ include ../../Make.config SHELL = /bin/sh -LDFLAGS = -nostdlib -static -Wl,-T,elf.x -LDLIBS = $(shell $(CC) -print-libgcc-file-name) - VPATH = ../.. DEFINES = -DUSER -CPPFLAGS = -nostdinc -I../.. -I- -I../../lib -I../../lib/user +CPPFLAGS = -nostdinc -I../.. -I- -I../../lib -I../../lib/user \ + -include constants.h + +# Test programs to compile, and a list of sources for each. +# To add a new test, put its name on the PROGS list +# and then add a name_SRC line that lists its source files. +PROGS = bubsort echo halt insult lineup matmult recursor shell +bubsort_SRC = bubsort.c +echo_SRC = echo.c +halt_SRC = halt.c +insult_SRC = insult.c +lineup_SRC = lineup.c +matmult_SRC = matmult.c +recursor_SRC = recursor.c +shell_SRC = shell.c + +# Linker flags. +LDFLAGS = -nostdlib -static -s +LDLIBS = $(shell $(CC) -print-libgcc-file-name) + +# Uncomment the line below to round up segment sizes to full pages for +# testing purposes only. +#LDFLAGS += -Wl,-T,fullpage.x # C library sources linked into every test program. LIB_SRC = lib/debug.c # Debug code. @@ -22,17 +41,7 @@ LIB_SRC += lib/user/console.c # Console code. LIB_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(LIB_SRC))) LIB_DEP = $(patsubst %.o,%.d,$(LIB_OBJ)) -LIB = libc.a lib/user/entry.o - -PROGS = bubsort echo halt insult lineup matmult recursor shell -bubsort_SRC = bubsort.c -echo_SRC = echo.c -halt_SRC = halt.c -insult_SRC = insult.c -lineup_SRC = lineup.c -matmult_SRC = matmult.c -recursor_SRC = recursor.c -shell_SRC = shell.c +LIB = lib/user/entry.o libc.a PROGS_SRC = $(foreach prog,$(PROGS),$($(prog)_SRC)) PROGS_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(PROGS_SRC))) @@ -42,9 +51,12 @@ all: $(PROGS) define TEMPLATE $(1)_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$($(1)_SRC))) -$(1): $$($(1)_OBJ) $$(LIB) +$(1): $$($(1)_OBJ) $$(LIB) | ./lib/user endef +./lib/user: + $(MKDIR) -p lib/user + $(foreach prog,$(PROGS),$(eval $(call TEMPLATE,$(prog)))) $(PROGS): $(LIB)