ArchiCheck is a simple tool to describe software architecture and check code compliance with it

root / 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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
.SILENT:

all: build check doc

release: build_release check
	cp -p Obj/archicheck Linux_amd64_release/

	> Doc/Download.txt
	echo "File: Download"			 				>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	echo "<Here at http://lionel.draghi.free.fr/Archicheck/archicheck> is an exe build on my Debian amd64,"	>> Doc/Download.txt
	echo "with -O3 option." 						>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	echo "About: Build" 							>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	echo "(start code)" 							>> Doc/Download.txt
	echo "> date -r archicheck --iso-8601=seconds" 				>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	date -r Linux_amd64_release/archicheck --iso-8601=seconds 		>> Doc/Download.txt
	echo "(end)" 								>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	echo "About: Dependencies" 						>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	echo "(start code)" 							>> Doc/Download.txt
	echo "> readelf -d archicheck | grep 'NEEDED'" 				>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	readelf -d Linux_amd64_release/archicheck | grep 'NEEDED'		>> Doc/Download.txt
	echo "(end)" 								>> Doc/Download.txt
	echo "" 								>> Doc/Download.txt
	
build: 
	echo Make debug build

	gnat make -q -s -Xmode=debug -Parchicheck.gpr
	# -q : quiet
	# -s : recompile if compiler switches have changed

build_release:
	echo Make release build

	gnat make -q -s -Xmode=release -Parchicheck.gpr
	# -q : quiet
	# -s : recompile if compiler switches have changed

check: Obj/archicheck
	# depend on the exe, may be either build or build_release, test have to pass with both
	echo Make check

	@ # initializing coverage data before run
	lcov --quiet --capture --initial --directory Obj -o Obj/coverage.info
	# lcov error are ignored because this is also runned when in release mode, without 
	# coverage info generated

	echo Make Tests
	$(MAKE) --directory=Tests

	@ # capturing coverage data
	lcov --quiet --capture           --directory Obj -o Obj/coverage.info


dashboard: build 
	echo Make dashboard

	@ # Language pie
	@ # --------------------------------------------------------------------
	sloccount Src Tests | grep "ada=" |  ploticus  -prefab pie 	\
		data=stdin labels=2 colors="blue red green orange"	\
		explode=0.1 values=1 title="Ada sloc `date +%x`"	\
		-png -o Doc/sloc.png

	@ # Code coverage Pie
	@ # --------------------------------------------------------------------
	lcov -q --remove Obj/coverage.info -o Obj/coverage.info \
		"/usr/*" "*.ads" "*/Obj/b__archicheck-main.adb"
	@ # Ignorting :
	@ # - spec (results are not consistent with current gcc version) 
	@ # - the false main
	@ # - libs (Standart and OpenToken) 

	@ # --------------------------------------------------------------------
	genhtml Obj/coverage.info -o Doc/lcov -t "ArchiCheck tests coverage" \
		-p "/home/lionel/Proj/ArchiCheck" | tail -n 2 > cov_sum.txt

	# Processing the lines line :
	@ # --------------------------------------------------------------------
	> lines_cov.dat
	head -n 1 cov_sum.txt | sed "s/.*(/\"Covered lines\" /" | sed "s/ of .*//" 	>> lines_cov.dat
	head -n 1 cov_sum.txt | sed "s/.* of /\"Total   lines\" /" | sed "s/ lines)//"	>> lines_cov.dat
	ploticus -prefab pie 	\
			data=lines_cov.dat labels=1 colors="green blue" \
			explode=0.1 values=2 title="Lines coverage `date +%x`"	\
			labelfmtstring=@2 -png -o Doc/lines_coverage.png
	
	# Processing the functions line :
	@ # --------------------------------------------------------------------
	> functions_cov.dat
	tail -n 1 cov_sum.txt | sed "s/.*(/\"Covered functions\" /" | sed "s/ of .*//" 	   	>> functions_cov.dat
	tail -n 1 cov_sum.txt | sed "s/.* of /\"Total   functions\" /" | sed "s/ functions)//" 	>> functions_cov.dat
	ploticus -prefab pie data=functions_cov.dat labels=1 colors="green blue" 		\
		explode=0.1 values=2 title="Functions coverage `date +%x`"	\
		labelfmtstring=" @2\\n (@PCT%)" -png -o Doc/functions_coverage.png
	
	@ # Test pie	
	@ # --------------------------------------------------------------------
	ploticus -prefab pie legend=yes							\
		data=Tests/short_tests_summary.txt labels=1 colors="green red orange"	\
		explode=0.1 values=2 title="Tests results `date +%x`"			\
		-png -o Doc/tests.png

	@ # --------------------------------------------------------------------
	>  Doc/Dashboard.txt
	echo "File: Dashboard"			>> Doc/Dashboard.txt
	echo 					>> Doc/Dashboard.txt
	echo "About: Test results"		>> Doc/Dashboard.txt
	echo "(start code)"			>> Doc/Dashboard.txt
	cat Tests/short_tests_summary.txt	>> Doc/Dashboard.txt
	echo "(end)"				>> Doc/Dashboard.txt
	echo "(see tests.png)"			>> Doc/Dashboard.txt
	echo 					>> Doc/Dashboard.txt
	echo "About: Lines coverage rate"	>> Doc/Dashboard.txt
	echo "(start code)"			>> Doc/Dashboard.txt
	head -n 1 cov_sum.txt			>> Doc/Dashboard.txt
	echo "(end)"				>> Doc/Dashboard.txt
	echo "(see lines_coverage.png)"		>> Doc/Dashboard.txt
	echo 					>> Doc/Dashboard.txt
	echo "About: Function coverage rate"	>> Doc/Dashboard.txt
	echo "(start code)"			>> Doc/Dashboard.txt
	tail -n 1 cov_sum.txt			>> Doc/Dashboard.txt
	echo "(end)"				>> Doc/Dashboard.txt
	echo "(see functions_coverage.png)"	>> Doc/Dashboard.txt
	echo 					>> Doc/Dashboard.txt

Cmd_Line.txt:
	echo Make Cmd_Line.txt
	> Doc/Cmd_Line.txt
	echo "File: Archicheck command line"		>> Doc/Cmd_Line.txt
	echo ""						>> Doc/Cmd_Line.txt
	echo "About: Archicheck command line"		>> Doc/Cmd_Line.txt
	echo ""						>> Doc/Cmd_Line.txt
	echo "(start code)"				>> Doc/Cmd_Line.txt
	echo "> archicheck -h" 				>> Doc/Cmd_Line.txt
	echo "(end)"					>> Doc/Cmd_Line.txt
	echo ""						>> Doc/Cmd_Line.txt
	echo "(start code)"				>> Doc/Cmd_Line.txt
	Obj/archicheck -h 				>> Doc/Cmd_Line.txt
	echo "(end)"					>> Doc/Cmd_Line.txt

	echo ""						>> Doc/Cmd_Line.txt
	echo "About: Archicheck current version"	>> Doc/Cmd_Line.txt
	echo ""						>> Doc/Cmd_Line.txt
	echo "(start code)"				>> Doc/Cmd_Line.txt
	echo "> archicheck --version"			>> Doc/Cmd_Line.txt
	echo "(end)"					>> Doc/Cmd_Line.txt
	echo ""						>> Doc/Cmd_Line.txt
	echo "(start code)"				>> Doc/Cmd_Line.txt
	Obj/archicheck --version			>> Doc/Cmd_Line.txt
	echo "(end)"					>> Doc/Cmd_Line.txt

	echo ""						>> Doc/Cmd_Line.txt

doc: dashboard Cmd_Line.txt
	echo Make Doc

	naturaldocs -q -i Doc -i Src -i Tests 		\
		-s Default archicheck			\
		-xi _darcs -xi Src/backup -xi Obj	\
		-o FramedHTML Doc/Generated -p Doc/Natural_Docs
	cp -p  Doc/Archicheck_Overview.pdf Doc/Generated
	cp -rp Doc/lcov Doc/Generated
	cp -rp Linux_amd64_release/archicheck Doc/Generated

.PHONY : clean
clean:
	echo Make clean
	gnat clean -q -Parchicheck.gpr
	- ${RM} -rf Obj/* Doc/Generated/* Doc/lcov/* tmp.txt *.lst *.dat cov_sum.txt
	$(MAKE) --directory=Tests clean