xref: /btstack/tool/metrics/Makefile (revision cfc3484e524b743efd4af5d8f1c58df2f9ba3bbd)
1b59454f6SMatthias RingwaldC_HEADERS    ?= ~/Projects/c_headers/include/
26360ea13SMatthias RingwaldBTSTACK_ROOT ?= ../..
36360ea13SMatthias Ringwald
47846277fSMatthias RingwaldVPATH=${BTSTACK_ROOT}/src
57846277fSMatthias Ringwald
67846277fSMatthias RingwaldINCLUDES= \
77846277fSMatthias Ringwald	-I ${BTSTACK_ROOT}/src \
81b81ae2aSMatthias Ringwald	-I ${BTSTACK_ROOT}/3rd-party/micro-ecc \
91b81ae2aSMatthias Ringwald	-I ${BTSTACK_ROOT}/3rd-party/rijndael \
101b81ae2aSMatthias Ringwald	-I ${BTSTACK_ROOT}/platform/embedded \
111b81ae2aSMatthias Ringwald	-I ${BTSTACK_ROOT}/platform/freertos \
127846277fSMatthias Ringwald	-I .
137846277fSMatthias Ringwald
141b81ae2aSMatthias RingwaldSRCS = \
151b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \
161b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c \
171b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ad_parser.c \
181b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/att_db.c \
191b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/att_db_util.c \
201b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/att_dispatch.c \
211b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/att_server.c \
221b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/gatt_client.c \
231b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/gatt-service/ancs_client.c \
241b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \
251b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_client.c \
261b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \
271b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_client.c \
281b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \
291b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/ble/sm.c \
301b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_crypto.c \
311b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_linked_list.c \
321b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_memory.c \
331b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_memory_pool.c \
341b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_run_loop.c \
351b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_run_loop_base.c \
361b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_tlv.c \
371b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/btstack_util.c \
381b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/hci.c \
391b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/hci_cmd.c \
401b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/hci_dump.c \
411b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/hci_transport_h4.c \
421b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/l2cap.c \
431b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/src/l2cap_signaling.c \
441b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \
451b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \
461b81ae2aSMatthias Ringwald	${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \
477846277fSMatthias Ringwald
48a6e1ba90SMatthias Ringwaldall: metrics.md metrics.html metrics.txt
497846277fSMatthias Ringwald
507846277fSMatthias Ringwaldmetrics.tsv: ${SRCS}
51*cfc3484eSMatthias Ringwald	ccsm --disable-file --disable-global --exclude-std-headers --exclude-file=.h$$ --output-format=tsv --output-metrics=HIS_.* $^ -- -DuECC_NO_DEFAULT_RNG -isystem ${C_HEADERS}/c90 -isystem ${C_HEADERS}/c99 ${INCLUDES} > metrics_raw.tsv
52*cfc3484eSMatthias Ringwald	echo "# file\tfunction\tGOTO\tRETURN\t_\tSTMT \t_\tCCN\tPATH\tCALLS\tPARAM\tLEVEL\t_\t_\t_" > metrics_header.tsv
53*cfc3484eSMatthias Ringwald	cat metrics_header.tsv metrics_raw.tsv > $@
54*cfc3484eSMatthias Ringwald	rm metrics_header.tsv metrics_raw.tsv
557846277fSMatthias Ringwald
568fb780d8SMilanka Ringwaldmetrics.md: metrics.tsv metrics_ccsm.py
578fb780d8SMilanka Ringwald	./metrics_ccsm.py > metrics.md
58227c17e4SMatthias Ringwald
59227c17e4SMatthias Ringwaldmetrics.html: metrics.md
60227c17e4SMatthias Ringwald	pandoc --from markdown --to html -o metrics.html metrics.md
617846277fSMatthias Ringwald
62a6e1ba90SMatthias Ringwaldmetrics.txt: metrics.tsv
63*cfc3484eSMatthias Ringwald	expand -t 70,160,170,180,190,210,220,230,240,250,260,270,280,290,300 metrics.tsv > metrics.txt
64a6e1ba90SMatthias Ringwald
657846277fSMatthias Ringwaldclean:
66*cfc3484eSMatthias Ringwald	rm -f metrics.tsv metrics.md metrics.txt metrics.html metrics_header.tsv metrics_raw.tsv
67