blob: 30abcc2e79cd76d52e39276d429965f122498747 (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
OBJS = \
id.o \
sh.o \
ps.o \
ls.o \
sleep.o \
date.o \
true.o \
false.o \
hostname.o \
cat.o \
uname.o \
clear.o \
tst.o \
mm.o \
kill.o \
ft.o \
ft2.o \
strsignal.o \
fgrep.o \
tty.o \
mkdir.o \
touch.o
APPS = \
id \
sh \
ps \
ls \
sleep \
date \
true \
false \
hostname \
cat \
uname \
clear \
tst \
mm \
kill \
ft \
ft2 \
strsignal \
fgrep \
tty \
mkdir \
touch
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
FLAVOR_FLAGS = -march=i386 -mregparm=3 -m32 -fno-exceptions -fno-rtti -fmerge-all-constants -fno-unroll-loops -fno-pie -fno-pic
OPTIMIZATION_FLAGS = -Oz -fno-asynchronous-unwind-tables
INCLUDE_FLAGS = -I.. -I. -I../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 --build-id=none -z norelro -z now -e _start --gc-sections
all: $(OBJS) $(APPS)
id: id.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
sh: sh.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
ps: ps.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
ls: ls.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
fgrep: fgrep.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
sleep: sleep.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
date: date.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
true: true.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
false: false.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
hostname: hostname.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
cat: cat.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
uname: uname.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
clear: clear.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
tst: tst.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
ft: ft.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
ft2: ft2.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
mm: mm.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
kill: kill.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
tty: tty.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
strsignal: strsignal.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
mkdir: mkdir.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
touch: touch.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
.cpp.o:
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
clean:
@echo "CLEAN"; rm -f $(LIBRARY) $(OBJS)
|