From 94ef0a7fbfe1687511c82fc9abbcfb40db2a5464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corn=C3=A9=20Plooy?= Date: Tue, 5 Jun 2018 12:32:50 +0200 Subject: [PATCH] Add 'make ncc' target, for source code analysis. --- Makefile | 8 +++++++- doc/HACKING.md | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1e71d5c51..959b24adb 100644 --- a/Makefile +++ b/Makefile @@ -292,6 +292,11 @@ coverage/coverage.info: check pytest coverage: coverage/coverage.info genhtml coverage/coverage.info --output-directory coverage +# We make libwallycore.la a dependency, so that it gets built normally, without ncc. +# Ncc can't handle the libwally source code (yet). +ncc: external/libwally-core/src/libwallycore.la + CC="ncc -ncgcc -ncld -ncfabs" AR=nccar LD=nccld make + # Ignore test/ directories. TAGS: FORCE $(RM) TAGS; find * -name test -type d -prune -o -name '*.[ch]' -print | xargs etags --append @@ -360,6 +365,7 @@ clean: wire-clean $(RM) check-bolt tools/check-bolt tools/*.o find . -name '*gcda' -delete find . -name '*gcno' -delete + find . -name '*.nccout' -delete update-mocks/%: % @tools/update-mocks.sh "$*" @@ -468,7 +474,7 @@ installcheck: @rm -rf testinstall || true .PHONY: installdirs install-program install-data install uninstall \ - installcheck + installcheck ncc ccan-breakpoint.o: $(CCANDIR)/ccan/breakpoint/breakpoint.c $(CC) $(CFLAGS) -c -o $@ $< diff --git a/doc/HACKING.md b/doc/HACKING.md index 2206a3c5a..e2560d024 100644 --- a/doc/HACKING.md +++ b/doc/HACKING.md @@ -185,6 +185,17 @@ valgrind installed, and build with DEVELOPER=1. Our Travis CI instance (see `.travis.yml`) runs all these for each pull request. +Source code analysis +-------------------- +An updated version of the NCC source code analysis tool is available at + +https://github.com/bitonic-cjp/ncc + +It can be used to analyze the lightningd source code by running +`make clean && make ncc`. The output (which is built in parallel with the +binaries) is stored in .nccout files. You can browse it, for instance, with +a command like `nccnav lightningd/lightningd.nccout`. + Subtleties ----------