-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (36 loc) · 921 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
37
38
39
40
41
42
43
44
45
46
47
ifeq ($(V),)
Q=@
else
Q=
endif
CFLAGS += -D__ENABLE_HARDCODE_LOGIN___ -D__ENABLE_LOGIN__
ifeq ($(shell uname),Darwin)
OS=MAC
else
OS=LINUX
endif
ifeq ($(OS),MAC)
CC := $(Q)clang
OBJDUMP := $(Q)symbols
else
#CROSS = arm-none-eabi-
CC := $(Q)$(CROSS)$(CC)
OBJDUMP := $(Q)$(CROSS)objdump -x
endif
.PHONY: sizing
all: ut_cli sizing
clean:
$(Q)rm -f *.o cli
CFLAGS += -g -Os -Wall
%.o: %.c io.h
$(CC) -c -o $@ $< $(CFLAGS)
ut_cli: io.o knock.o ut_cli.o term.o
$(CC) -o $@ $^ $(CFLAGS)
sizing:
ifeq ($(OS),MAC)
$(OBJDUMP) cli|grep FUNC|grep cli_|awk '{printf("%5d %s\n", $$3, $$4);}'|sed s/\)//
$(OBJDUMP) cli|grep FUNC|grep cli_|awk '{printf(" + %d", $$3);}'|sed s/\)//g|xargs echo 0 | bc
else
$(OBJDUMP) cli|grep text|grep cli_|awk '{s = ("0x" $$5) + 0; printf("%5d %s\n", s, $$6);}'
$(OBJDUMP) cli|grep text|grep cli_|awk '{s = ("0x" $$5) + 0; printf(" + %d\n", s);}'| xargs echo 0 | bc
endif