forked from fifteenhex/smolutils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.mk
More file actions
90 lines (73 loc) · 1.62 KB
/
Copy pathcommon.mk
File metadata and controls
90 lines (73 loc) · 1.62 KB
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
MAKEFLAGS += --no-builtin-rules
# Make sure we know where to get nolibc
ifndef NOLIBCDIR
$(error Please pass NOLIBCDIR with the path to your copy of nolibc (tools/include/nolibc/ in the linux source))
endif
# Make sure we know where the toolchain is
ifndef CROSS_COMPILE
$(error Please pass CROSS_COMPILE with the prefix of you toolchain)
endif
# Make sure we know where tarwak is
ifndef TARWAK
$(error Please pass TARWAK with the path of your tarwak binary)
endif
CC=$(CROSS_COMPILE)gcc
BFDLD=$(CROSS_COMPILE)ld.bfd
STRIP=$(CROSS_COMPILE)strip
PROGS_SYSTEM = init \
getty \
startup
PROGS_USER = \
smolsh \
dmesg \
ls \
ps \
cat \
sha256sum \
xxd \
man \
less \
uname \
cp \
touch \
chmod \
chown \
kill \
df \
mount
# Make some warnings into errors because I am bad at the programming
_COPTS = -Werror=return-type
_COPTS += -Werror=implicit-function-declaration
_COPTS += -flto
_COPTS += -ggdb -nostdlib -std=c99 -Os
# Feature parsing
fempty :=
fspace := $(empty) $(empty)
fcomma := ,
DISABLE_LIST := $(subst $(fcomma),$(fspace),$(FEATURE_DISABLE))
ifeq ($(filter net,$(DISABLE_LIST)),)
_COPTS += -DCONFIG_NET=n
else
PROGS_NET_SYSTEM = \
sntp \
dhcpc
PROGS_NET_USER = \
ping \
resolv \
tftp
_TARWAKFEATURES += -fnet
endif
COPTS= -include $(NOLIBCDIR)/nolibc.h \
-Wl,--hash-style=gnu \
$(_COPTS)
C_FILES = $(addsuffix .c,$(PROGS_SYSTEM)) $(addsuffix .c,$(PROGS_USER))
ifdef UAPIDIR
COPTS += -I$(UAPIDIR)
endif
HEADERS = common.h \
users.h \
net.h \
resolv.h \
memfd.h \
multicall.h
EROFS_CMD = mkfs.erofs -E force-inode-compact,all-fragments,dedupe -zlz4hc --tar