-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (47 loc) · 1.38 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
all: small-go small-tinygo small-zig small-c small-syscall-zig small-syscall-c sizes
sizes:
ls -lh
small-go:
CGO_ENABLED=0 time go build -trimpath -ldflags="-s -w" -o small-go small.go
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
-./$@
small-tinygo:
CGO_ENABLED=0 time tinygo build -o small-tinygo small.go
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
-./$@
small-syscall-zig: small-syscall.zig
time zig build-exe -O ReleaseSmall --name $@ $<
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
-./$@
small-zig: small.zig
time zig build-exe -O ReleaseSmall --name $@ $<
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
-./$@
GCCFLAGS:= -fno-ident -Os -s -static -fno-asynchronous-unwind-tables
STRIPFLAGS:= -s --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.GNU-stack --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag
small-c: small.c Makefile
# sudo apt install dietlibc-dev
time diet gcc $(GCCFLAGS) -o $@ $<
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
small-syscall-c: small-syscall.c Makefile
time gcc -nostartfiles $(GCCFLAGS) -o $@ $<
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
small-syscall-asm: small-syscall-asm-arm64.c Makefile
time gcc -nostdlib -nostartfiles $(GCCFLAGS) -o $@ $<
ls -l $@
strip $(STRIPFLAGS) $@
ls -l $@
clean:
rm -f small-go small-tinygo small-zig small-c small-syscall-c small-syzcall-sig