-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (31 loc) · 789 Bytes
/
Makefile
File metadata and controls
41 lines (31 loc) · 789 Bytes
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
37
38
39
40
41
# swtest
# Simple examples for understanding the usage of xv6 swtch
# Copyright (C) 2017 Takuo Watanabe
LIB_SRCS = context.c
ASM_SRCS = swtch.S
EXE_SRCS = swtest.c schtest.c
LIB_OBJS = $(LIB_SRCS:%.c=%.o) $(ASM_SRCS:%.S=%.o)
ALL_OBJS = $(EXE_SRCS:%.c=%.o) $(LIB_OBJS)
EXES = swtest schtest
CC = gcc
CPPFLAGS =
CFLAGS = -std=c99 -pedantic -Wall -Wextra -Werror -g -m32 -mstackrealign
LDFLAGS =
RM = rm -f
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
%.o: %.S
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
.PHONY: all clean allclean
all: $(EXES)
swtest: $(LIB_OBJS) swtest.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
schtest: $(LIB_OBJS) schtest.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
clean:
$(RM) $(EXES)
$(RM) $(ALL_OBJS)
allclean: clean
$(RM) *.o a.out
$(RM) -r *.dSYM
$(RM) *~