-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (28 loc) · 816 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
NASM = nasm
CPPFLAGS = -nostdinc -Iinclude
CFLAGS = -Wall -Wextra -fno-PIC -fno-stack-protector -fno-builtin
# Remove the line below to disable debugging support.
CFLAGS += -g -O0
.PHONY: all clean
SRCS = syscall.c \
process/exit.c \
mm/malloc.c mm/mmap.c mm/mem_list.c mm/malloc_helper.c\
string/string.c \
io/puts.c \
process/nanosleep.c process/sleep.c\
stat/fstatat.c stat/fstat.c stat/stat.c \
io/open.c io/close.c io/read_write.c \
io/lseek.c io/truncate.c io/ftruncate.c \
errno.c \
crt/__libc_start_main.c
OBJS = $(patsubst %.c,%.o,$(SRCS))
all: libc.a
libc.a: $(OBJS) crt/start.o
$(AR) -rc $@ $^
$(OBJS): %.o:%.c
crt/start.o: crt/start.asm
$(NASM) -f elf64 -o $@ $<
clean:
-rm -f *~
-rm -f $(OBJS) crt/start.o
-rm -f libc.a