summaryrefslogtreecommitdiffstats
path: root/pintos-progos/Makefile.userprog
diff options
context:
space:
mode:
Diffstat (limited to 'pintos-progos/Makefile.userprog')
-rw-r--r--pintos-progos/Makefile.userprog52
1 files changed, 0 insertions, 52 deletions
diff --git a/pintos-progos/Makefile.userprog b/pintos-progos/Makefile.userprog
deleted file mode 100644
index 0df391a..0000000
--- a/pintos-progos/Makefile.userprog
+++ /dev/null
@@ -1,52 +0,0 @@
1# -*- makefile -*-
2
3$(PROGS): CPPFLAGS += -I$(SRCDIR)/lib/user -I.
4
5# Linker flags.
6$(PROGS): LDFLAGS += -nostdlib -static -Wl,-T,$(LDSCRIPT)
7$(PROGS): LDSCRIPT = $(SRCDIR)/lib/user/user.lds
8
9# Library code shared between kernel and user programs.
10lib_SRC = lib/debug.c # Debug code.
11lib_SRC += lib/random.c # Pseudo-random numbers.
12lib_SRC += lib/stdio.c # I/O library.
13lib_SRC += lib/stdlib.c # Utility functions.
14lib_SRC += lib/string.c # String functions.
15lib_SRC += lib/arithmetic.c # 64-bit arithmetic for GCC.
16lib_SRC += lib/ustar.c # Unix standard tar format utilities.
17
18# User level only library code.
19lib/user_SRC = lib/user/debug.c # Debug helpers.
20lib/user_SRC += lib/user/syscall.c # System calls.
21lib/user_SRC += lib/user/console.c # Console code.
22
23LIB_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(lib_SRC) $(lib/user_SRC)))
24LIB_DEP = $(patsubst %.o,%.d,$(LIB_OBJ))
25LIB = lib/user/entry.o libc.a
26
27PROGS_SRC = $(foreach prog,$(PROGS),$($(prog)_SRC))
28PROGS_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(PROGS_SRC)))
29PROGS_DEP = $(patsubst %.o,%.d,$(PROGS_OBJ))
30
31all: $(PROGS)
32
33define TEMPLATE
34$(1)_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$($(1)_SRC)))
35$(1): $$($(1)_OBJ) $$(LIB) $$(LDSCRIPT)
36 $$(CC) $$(LDFLAGS) $$($(1)_OBJ) $$(LIB) -o $$@
37endef
38
39$(foreach prog,$(PROGS),$(eval $(call TEMPLATE,$(prog))))
40
41libc.a: $(LIB_OBJ)
42 rm -f $@
43 ar r $@ $^
44 ranlib $@
45
46clean::
47 rm -f $(PROGS) $(PROGS_OBJ) $(PROGS_DEP)
48 rm -f $(LIB_DEP) $(LIB_OBJ) lib/user/entry.[do] libc.a
49
50.PHONY: all clean
51
52-include $(LIB_DEP) $(PROGS_DEP)