-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
696 lines (607 loc) · 22.6 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
# Makefile for colr_tool
# -Christopher Welborn 06-10-2019
# vim: set ts=4 sw=4
SHELL=bash
# This is only for testing standard differences. ColrC must use at least c11/gnu11.
STD=gnu11
# The flags will be different for clang, so just use the `clang` target (`make clang`).
CC=gcc
# More warnings may be added, but none should be taken away just to get a clean compile.
CFLAGS=-Wall -Wextra -Wfloat-equal -Wenum-compare -Winline -Wlogical-op \
-Wimplicit-fallthrough -Wlogical-not-parentheses \
-Wmissing-include-dirs -Wnull-dereference -Wpedantic -Wshadow \
-Wstrict-prototypes -Wunused \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 \
-std=$(STD)
# Gnu-support can be disabled for testing by specifying a non-gnu std and
# setting COLR_GNU to 0: COLR_GNU=0 STD=c11 make -e debug
COLR_GNU=1
ifeq ($(COLR_GNU), 1)
CFLAGS+=-D_GNU_SOURCE
else
CFLAGS+=-D_GNU_SOURCE=0
endif
# ColrC uses libm right now, but it's pretty standard.
LIBS=-lm
# Sanitizers/protectors to optionally enable.
FFLAGS=-fno-omit-frame-pointer -fstack-protector-strong \
-fsanitize=address -fsanitize=leak -fsanitize=undefined
# Colr tool executable.
binary=colrc
# Source for libcolr only.
colr_source=colr.c colr.controls.c
# Source for the colr tool.
source=colr_tool.c $(colr_source)
# Objects that make up the colr tool.
objects:=$(source:.c=.o)
# Output name for libcolr.
lib_binary=libcolr.so
# Objects that make up libcolr.so.
lib_objects=$(colr_source:.c=.o)
# Header files for libcolr only.
colr_headers=colr.h colr.controls.h
# Header files that should trigger rebuilds.
headers=colr_tool.h $(colr_headers)
# Output for coverage info.
cov_dir=coverage
# Command to run cppcheck (this script has some sane defaults set).
cppcheck_cmd=bash ./tools/cppcheck_run.sh
# Main output file for cppcheck (for target dependencies).
cppcheck_html=./cppcheck_report/index.html
# Command to install the ColrC tool, if not building/using a debian package.
install_cmd=bash ./tools/install.sh
# Command to install libcolr.so, if not building/using a debian package.
lib_install_cmd=bash ./tools/install.sh --lib
# Command to determine what type of build `colrc` or `libcolr.so` is.
is_build_cmd=bash tools/is_build.sh
# Command to format `make help` output.
make_help_fmt_cmd=python3 tools/make_help_fmter.py
# Command to turn a basic doxygen index.md into a GitHub README.md.
undoxy_md_cmd=python3 tools/undoxy_markdown.py
# Arguments for $undoxy_md_cmd to generate the GitHub README.
readme_title="ColrC Documentation"
readme_header="![CI](https://github.com/welbornprod/colrc/workflows/CI/badge.svg?event=push)\n\nFor full documentation see [welbornprod.com/colrc](https://welbornprod.com/colrc/index.html)"
# Command to get current ColrC version.
version_cmd=bash tools/get_version.sh
# Directory for source/debian-binary packages.
dist_dir=./dist
# Files to include in a source package. This is not the same as debian-source
# package (see the `distdebfull` target).
dist_files=colr.h colr.c colr.controls.h colr.controls.c
# Command to make source/debian packages.
make_dist_cmd=bash tools/make_dist.sh
# Directory for doc input/config files.
doc_dep_dir=doc_deps
# Doxygen config for all output formats.
docs_config=$(doc_dep_dir)/Doxyfile_common
# Doxygen config for HTML/MAN output.
docs_html_config=$(doc_dep_dir)/Doxyfile_html
# Doxygen config for LaTeX/PDF output.
docs_latex_config=$(doc_dep_dir)/Doxyfile_latex
# Output directory for generated docs.
docs_dir=docs
# GitHub-friendly README file (generated with $undoxy_md_cmd).
docs_github_readme=README.md
docs_index_md=$(doc_dep_dir)/index.md
docs_md=$(wildcard $(doc_dep_dir)/*.md)
docs_main_file=$(docs_dir)/html/index.html
docs_css=$(doc_dep_dir)/customdoxygen.css
docs_examples=$(wildcard examples/*.c)
docs_deps=$(docs_config) $(docs_html_config) $(docs_examples) $(docs_css) $(docs_md) \
$(doc_dep_dir)/header.html $(doc_dep_dir)/footer.html
docs_pdf=$(docs_dir)/ColrC-manual.pdf
docs_cj_src=$(docs_dir)/html
docs_cj_dir=$(realpath ../../../cjwelborn.github.io/colrc)
docs_cj_main_file=$(docs_cj_dir)/index.html
dist_cj_dir=$(docs_cj_dir)/dist
latex_dir=$(docs_dir)/latex
latex_header=$(doc_dep_dir)/header.tex
latex_style=$(doc_dep_dir)/doxygen.sty
latex_deps=$(docs_config) $(docs_latex_config) $(docs_index_md) $(latex_header) $(latex_style)
latex_tex=$(latex_dir)/refman.tex
latex_pdf=$(latex_dir)/refman.pdf
doxy_latex_files=\
$(wildcard $(latex_dir)/*.tex) $(wildcard $(latex_dir)/*.md5) \
$(wildcard $(latex_dir)/*.pdf) $(wildcard $(latex_dir)/*.sty) \
$(latex_dir)/Makefile
latex_files=\
$(wildcard $(latex_dir)/*.ps) $(wildcard $(latex_dir)/*.dvi) \
$(wildcard $(latex_dir)/*.aux) $(wildcard $(latex_dir)/*.toc) \
$(wildcard $(latex_dir)/*.idx) $(wildcard $(latex_dir)/*.ind) \
$(wildcard $(latex_dir)/*.ilg) $(wildcard $(latex_dir)/*.log) \
$(wildcard $(latex_dir)/*.out) $(wildcard $(latex_dir)/*.brf) \
$(wildcard $(latex_dir)/*.blg) $(wildcard $(latex_dir)/*.bbl) \
$(wildcard $(latex_dir)/*.pyg) $(latex_dir)/refman.pdf
examples_dir=examples
examples_source=$(wildcard $(examples_dir)/*.c)
valgrind_cmd=bash tools/valgrind_run.sh
# Set `viewing_file` to a filepath, and run $(view_file) to open it with `xdg-open`.
define view_file =
@if [[ -n "$(viewing_file)" ]]; then \
if [[ -e "$(viewing_file)" ]]; then \
printf "Viewing: $(viewing_file)\n"; \
xdg-open "$(viewing_file)" &>/dev/null; \
else \
printf "Missing file: $(viewing_file)\n" 1>&2; \
fi; \
else \
printf "No filepath provided to make target!\n" 1>&2; \
fi;
endef
.PHONY: all
all: debug
.PHONY: coveragecompile
coveragecompile: clean
coveragecompile: cleancoverage
coveragecompile: CFLAGS+=-O0 -DDEBUG
coveragecompile: CFLAGS+=-fprofile-arcs -ftest-coverage
coveragecompile: CFLAGS+=-fkeep-inline-functions -fkeep-static-functions
coveragecompile: $(binary)
.PHONY: coverage
coverage: coveragecompile
coverage:
@./tools/gen_coverage_html.sh "$(realpath $(binary))" "$(realpath $(cov_dir))" $(COLR_ARGS)
.PHONY: debug
debug: tags
debug: CFLAGS+=-gdwarf-4 -g3 -DDEBUG -DCOLR_DEBUG
debug: $(binary)
.PHONY: lib
lib: cleancolrobjects
lib: CFLAGS+=-fpic
lib: $(lib_objects)
lib:
$(CC) -shared -o $(lib_binary) $(lib_objects)
.PHONY: libdebug
libdebug: CFLAGS+=-g3 -DDEBUG -DCOLR_DEBUG
libdebug: lib
.PHONY: libinstall
libinstall: librelease
libinstall:
@$(lib_install_cmd)
.PHONY: libinstalldebug
libinstalldebug: libdebug
libinstalldebug:
@$(lib_install_cmd)
.PHONY: liblink
liblink: librelease
liblink:
@$(lib_install_cmd) --link
.PHONY: liblinkdebug
liblinkdebug: libdebug
liblinkdebug:
@$(lib_install_cmd) --link
.PHONY: librelease
librelease: CFLAGS+=-O3 -DNDEBUG
librelease: lib
.PHONY: libuninstall
libuninstall:
@$(lib_install_cmd) --uninstall
.PHONY: release
release: CFLAGS+=-O3 -DNDEBUG
release: $(binary)
.PHONY: release2
release2: CFLAGS+=-O2 -DNDEBUG
release2: $(binary)
# Build the tests with all of the -fsanitize options. This will make the
# executable slower and bigger, but helps to catch things that valgrind doesn't.
# This should never be used as a release build.
.PHONY: sanitize
sanitize: CFLAGS+=-g3 -DDEBUG $(FFLAGS)
sanitize: LIBS+=-lasan
sanitize: $(binary)
$(binary): $(objects)
@printf "\nCompiling $(binary) executable...\n "
$(CC) -o $(binary) $(CFLAGS) $(objects) $(LIBS)
%.o: %.c %.h
@printf "\nCompiling $<...\n ";
$(CC) -c $< $(CFLAGS)
# Build all docs (html and pdf) if needed (docs_cj_main_file must come after docs_pdf).
docs: $(docs_main_file)
docs: $(docs_pdf)
docs: $(docs_cj_main_file)
docs: $(docs_github_readme)
# Build the github-friendly README.
$(docs_github_readme): $(docs_index_md)
@printf "\nGenerating the GitHub README: $(docs_github_readme)\n"
@$(undoxy_md_cmd) \
-t $(readme_title) \
-H $(readme_header) \
$(docs_index_md) \
$(docs_github_readme)
# Build the html docs, with example code included.
$(docs_main_file): $(source) $(headers) $(docs_deps)
@printf "\nBuilding html doxygen docs...\n Target: $@\n For: $?\n "
@(cat $(docs_html_config); $(version_cmd) -p) | doxygen -
@printf "\n"
# Build the doxygen latex docs, without example code (latex_pdf and docs_pdf need this).
# The example code (custom html-wrapper aliases) cause latex to fail.
$(latex_tex): $(source) $(headers) $(latex_deps)
@printf "\nBuilding latex doxygen docs...\n Target: $@\n For: $?\n "
@(cat $(docs_latex_config); $(version_cmd) -p) | doxygen -
@printf "\n"
$(latex_pdf): $(latex_tex)
@./tools/gen_latex_pdf.sh --reference && \
[[ -e "$(latex_pdf)" ]] && \
printf "\nPDF reference: $(latex_pdf)\n"
$(docs_pdf): $(latex_pdf)
@./tools/gen_latex_pdf.sh && \
[[ -e "$(docs_pdf)" ]] && \
printf "\nPDF manual: $(docs_pdf)\n"
# This will copy the html docs to cjwelborn.github.io, to make them public.
$(docs_cj_main_file): $(docs_main_file)
@if [[ -n "$(docs_cj_dir)" ]] && [[ -d "$(docs_cj_dir)" ]]; then \
if [[ -f "$(docs_dir)/ColrC-manual.pdf" ]]; then \
printf "\nCopying docs for cjwelborn.github.io.\n"; \
cp -r "$(docs_cj_src)"/* "$(docs_cj_dir)"; \
printf "Copying PDF for cjwelborn.github.io.\n"; \
cp "$(docs_dir)/ColrC-manual.pdf" "$(docs_cj_dir)/ColrC-manual.pdf"; \
else \
printf "\nColrC PDF missing: %s\n" "$(docs_dir)/ColrC-manual.pdf" 1>&2; \
fi; \
else \
if [[ -n "$(docs_cj_dir)" ]]; then \
if [[ "$$NAME" == "cj" ]]; then \
printf "\nSite dir missing: %s\n" $(docs_cj_dir) 1>&2; \
else \
printf "\nSkipping \`distdocs\`, for user %s\n" "$$USER" 1>&2; \
fi; \
else \
printf "\nSite dir missing, \`distdocs\` is not for everyone.\n" 1>&2; \
fi; \
fi;
tags: $(source) $(headers)
@if hash ctags &>/dev/null; then \
printf "Building ctags...\n "; \
ctags $(source) $(headers); \
else \
printf "No \`ctags\` available!\n" 1>&2; \
fi;
.PHONY: clangdebug
clangdebug: CC=clang
clangdebug: CFLAGS+=-Wno-unknown-warning-option -Wliblto
clangdebug: debug
.PHONY: clang
clang: CC=clang
clang: CFLAGS+=-Wno-unknown-warning-option -Wliblto
clang: release
.PHONY: clean
clean:
@./tools/clean.sh "$(binary)"
.PHONY: cleanquiet
cleanquiet:
@./tools/clean.sh --quiet "$(binary)"
.PHONY: cleancolrobjects
cleancolrobjects:
@./tools/clean.sh -m "Colr Objects" $(lib_objects)
.PHONY: cleandebug
cleandebug: clean
cleandebug: debug
.PHONY: cleandocs
cleandocs: cleanhtml
cleandocs: cleanlatex
cleandocs: cleanpdf
cleandocs: cleandistdocs
.PHONY: cleandistdocs
cleandistdocs:
@./tools/clean.sh -D "$(docs_cj_dir)"
PHONY: cleanhtml
cleanhtml:
@./tools/clean.sh -d "$(docs_dir)" "$(docs_dir)/html" "$(docs_dir)/man"
PHONY: cleanlatex
cleanlatex:
@./tools/clean.sh -m "Latex" $(doxy_latex_files)
PHONY: cleanexamples
cleanexamples:
@$(MAKE) clean && \
cd examples && \
$(MAKE) --no-print-directory clean
PHONY: cleanpdf
cleanpdf:
@./tools/clean.sh -m "PDF" $(docs_pdf) $(latex_files)
.PHONY: cleancoverage
cleancoverage:
@shopt -s nullglob; \
declare -a covfiles=($(cov_dir)/*.gc{da,no} $(cov_dir)/*.info $(cov_dir)/html); \
if (($${#covfiles[@]})) && [[ "$${covfiles[*]}" != $(cov_dir)/html ]]; then \
printf "Removing coverage files...\n"; \
for covfile in "$${covfiles[@]}"; do \
if rm -r "$$covfile" &>/dev/null; then \
printf " Cleaned: $$covfile\n"; \
elif [[ -e "$$covfile" ]]; then \
printf " Failed: $$covfile\n"; \
fi; \
done; \
else \
printf "Coverage files already clean.\n"; \
fi;
.PHONY: coveragesummary
coveragesummary:
@./tools/gen_coverage_html.sh "$(binary)" "$(cov_dir)" --summary
.PHONY: coverageview
coverageview:
@./tools/gen_coverage_html.sh "$(binary)" "$(cov_dir)" --view
.PHONY: cppcheck
cppcheck:
@$(cppcheck_cmd)
.PHONY: cppcheckreport
cppcheckreport:
@$(cppcheck_cmd) -r
.PHONY: cppcheckreportall
cppcheckreportall:
@$(cppcheck_cmd) -r && $(cppcheck_cmd) -t -r
.PHONY: cppcheckview
cppcheckview:
@$(cppcheck_cmd) --view
.PHONY: cppcheckviewall
cppcheckviewall:
@$(cppcheck_cmd) --view && $(cppcheck_cmd) -t --view
.PHONY:
distcj: dist
@if [[ -n "$(dist_cj_dir)" ]] && [[ -d "$(dist_cj_dir)" ]]; then \
printf "\nCleaning existing public dist files...\n"; \
for dist_ext in .tar.gz .deb; do \
if ls "$(dist_cj_dir)"/*"$$dist_ext"; then \
rm "$(dist_cj_dir)"/*"$$dist_ext" || { \
printf "\nFailed to remove public '%s' dist files!" "$$dist_ext" 1>&2; \
}; \
fi; \
done; \
if cp "$(dist_dir)"/* "$(dist_cj_dir)"; then \
printf "\nCopied dist files to public dir: %s\n" "$(dist_cj_dir)"; \
else \
printf "\nFailed to copy dist files to public dir!: %s\n" "$(dist_cj_dir)" 1>&2; \
fi; \
elif [[ -n "$(dist_cj_dir)" ]] && [[ "$$USER" == "cj" ]] && mkdir -p "$(dist_cj_dir)"; then \
if cp "$(dist_dir)"/* "$(dist_cj_dir)"; then \
printf "\nCopied dist files to new public dir: %s\n" "$(dist_cj_dir)"; \
else \
printf "\nFailed to copy dist files to public dir!: %s\n" "$(dist_cj_dir)" 1>&2; \
fi; \
else \
printf "\nMissing public dist dir: %s\n" "$(dist_cj_dir)" 1>&2; \
fi;
.PHONY: distdeb
distdeb: $(dist_files)
@$(make_dist_cmd) -D -d "$(dist_dir)";
.PHONY: distdebfull
distdebfull: $(dist_files)
@$(make_dist_cmd) -D -F -d "$(dist_dir)";
.PHONY: distdocs
distdocs: $(docs_cj_main_file)
.PHONY: distsrc
distsrc: $(dist_files)
@$(make_dist_cmd) -S -d $(dist_dir) $(dist_files)
.PHONY: distall
# Build docs, copy to cjwelborn.github.io.
distall: distdocs
# Build a basic source package (only source files, not the whole project)
distall: distsrc
# Build binary debian packages for this machine (colr and libcolr).
distall: distdeb
# Copy source/binary packages to cjwelborn.github.io.
distall: distcj
.PHONY: docshtml
docshtml: $(docs_main_file)
.PHONY: docslatex
docslatex: $(latex_idx)
.PHONY: docspdf
docspdf: $(docs_pdf)
.PHONY: docsreadme
docsreadme: $(docs_github_readme)
.PHONY: docsreadmepreview
docsreadmepreview: $(docs_index_md)
@printf "\nPreviewing the GitHub README: $(docs_github_readme)\n" 1>&2
@$(undoxy_md_cmd) \
-t $(readme_title) \
-H $(readme_header) \
$(docs_index_md)
.PHONY: docsrebuild
docsrebuild: cleandocs
docsrebuild: docs
.PHONY: docsview
docsview: viewing_file=$(docs_main_file)
docsview:
@$(view_file)
.PHONY: docsviewpdf
docsviewpdf: viewing_file=$(docs_pdf)
docsviewpdf:
@$(view_file)
.PHONY: examples
examples: $(examples_source)
@cd examples && $(MAKE) --no-print-directory $(COLR_ARGS)
.PHONY: install
install: $(binary)
@$(install_cmd)
.PHONY: installlink
installlink: $(binary)
@$(install_cmd) -l
.PHONY: memcheck
memcheck: debug
memcheck:
@if $(is_build_cmd) "sanitize" || ! $(is_build_cmd) "debug"; then \
printf "\nRebuilding in debug non-sanitized mode for memcheck.\n"; \
$(MAKE) clean debug; \
fi;
@$(valgrind_cmd) -- $(COLR_ARGS)
.PHONY: memcheckquiet
memcheckquiet: debug
memcheckquiet:
@if $(is_build_cmd) "sanitize" || ! $(is_build_cmd) "debug"; then \
printf "\nRebuilding in debug non-sanitized mode for memcheck.\n"; \
$(MAKE) clean debug; \
fi;
@$(valgrind_cmd) -q -- $(COLR_ARGS)
.PHONY: run
run:
-@if [[ -e $(binary) ]]; then \
./$(binary) $$COLR_ARGS; \
else \
printf "No binary built yet: $(binary)" 1>&2; \
fi; \
.PHONY: runexamples
runexamples:
@cd examples && ./run_examples.sh $(COLR_ARGS)
.PHONY: strip
strip:
@if strip $(binary); then \
printf "\n%s was stripped.\n" "$(binary)"; \
else \
printf "\nError stripping executable: %s\n" "$(binary)" 1>&2; \
fi;
.PHONY: uninstall
uninstall:
@$(install_cmd) --uninstall
.PHONY: help, targets
help targets:
-@printf "Make targets available:\n\
all : Build with no optimization or debug symbols.\n\
clang : Use \`clang\` to build the \`release\` target.\n\
clangdebug : Use \`clang\` to build the \`debug\` target.\n\
clean : Delete previous build files.\n\
cleancoverage : Delete previous coverage files.\n\
cleandebug : Like running \`make clean debug\`.\n\
cleandocs : Delete Doxygen docs from ./$(docs_dir).\n\
cleanexamples : Delete previous build files from the examples in $(examples_dir).\n\
cleantest : Delete previous build files, build the binary and the \n\
test binary, and run the tests.\n\
coverage : Compile the \`debug\` build and generate coverage reports.\n\
This only checks the main binary, not the tests.\n\
See the \`testcoverage\` target.\n\
coveragecompile : Compile the \`debug\` build with coverage enabled.\n\
coveragesummary : View a summary of previously generated coverage reports.\n\
This is only for the main binary, not the tests.\n\
See the \`testsummary\` target.\n\
coverageview : View previously generated html coverage reports.\n\
This is only for the main binary, not the tests.\n\
See the \`testview\` target.\n\
cppcheck : Run \`cppcheck\` ($(cppcheck_cmd)).\n\
cppcheckreport : Generate a cppcheck HTML report.\n\
cppcheckreportall : Generate a cppcheck HTML report.\n\
This will also generate a report for the tests.\n\
cppcheckview : View previously generated cppcheck HTML report.\n\
cppcheckviewall : View previously generated cppcheck HTML report.\n\
This will also view the report for the tests.\n\
debug : Build the executable with debug symbols.\n\
distsrc : Create a package with colr.h and colr.c in ./dist.\n\
docs : Build the Doxygen docs.\n\
docsreadme : Build the GitHub README.\n\
docsrebuild : Like running \`make cleandocs docs\`.\n\
docsview : View previously generated HTML docs in your browser.\n\
docsviewpdf : View previously generated PDF docs in your viewer.\n\
examples : Build example executables in $(examples_dir).\n\
install : Install the \`colrc\` executable.\n\
installlink : Install the \`colrc\` executable as a symlink.\n\
lib : Build libcolr with no optimizations or debug info.\n\
libdebug : Build libcolor with debug info.\n\
libinstall : Build and install libcolr with optimizations.\n\
libinstalldebug : Build and install libcolr with debug info.\n\
liblink : Build and install libcolr with optimizations as a symlink.\n\
liblinkdebug : Build and install libcolr with debug info as a symlink.\n\
librelease : Build libcolr with optimizations.\n\
libuninstall : Uninstall a previously installed libcolr.\n\
memcheck : Run \`valgrind --tool=memcheck\` on the executable.\n\
release : Build the executable with optimization, and strip it.\n\
release2 : Same as \`release\` target, but with -O2 instead of -O3.\n\
run : Run the executable. Args are set with COLR_ARGS.\n\
runexamples : Run the example executables in $(examples_dir).\n\
sanitize : Build debug with \`-fsanitize\` options.\n\
strip : Run \`strip\` on the executable.\n\
tags : Build tags for this project using \`ctags\`.\n\
test : Build debug (if needed), build the test sanitize (if needed),\n\
and run the tests.\n\
testcoverage : Delete previous test build files, and build the tests for coverage.\n\
testeverything : Alias for \`./test/run_tests.sh --all --quiet\`.\n\
testfast : Build the \`test debug\` and run the tests.\n\
It's not as thorough as \`test\`, but it catches some\n\
errors.\n\
testfull : Build/run \`testfast\`, if nothing fails run \`memcheck\`,\n\
and if that succeeds, run the tests in \`sanitize\` mode.\n\
This will show errors early, and if everything passes\n\
then there is a low chance of show-stopping bugs.\n\
testgdb : Build \`debug\` (if needed), build the test \`debug\` (if needed),\n\
and run the tests through GDB.\n\
testkdbg : Build \`debug\` (if needed), build the test \`debug\` (if needed),\n\
and run the tests through KDbg.\n\
testmemcheck : Build \`debug\` tests (if needed), and run them through \`valgrind\`.\n\
testquiet : Build \`debug\` (if needed), build the test \`debug\` (if needed),\n\
and run the tests with \`--quiet\`.\n\
testsummary : View a summary of previously built test coverage reports.\n\
testview : View previously generated html test coverage reports.\n\
uninstall : Uninstall a previously installed \`colrc\` executable.\n\
" | $(make_help_fmt_cmd);
.PHONY: cleantest
cleantest:
-@$(MAKE) --no-print-directory clean debug && { \
cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory cleantest; \
};
.PHONY: test
test:
-@$(MAKE) --no-print-directory debug && { \
cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory test; \
};
.PHONY: testcppcheckreport
testcppcheckreport:
@cd test && $(MAKE) cppcheckreport;
.PHONY: testcoverage
testcoverage:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory clean coverage;
# This is the same as `testview`.
.PHONY: testcoverageview
testcoverageview:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory coverageview;
.PHONY: testeverything
testeverything:
@cd test && \
$(MAKE) --no-print-directory testeverything;
.PHONY: github_testeverything
github_testeverything:
@cd test && \
$(MAKE) --no-print-directory github_testeverything;
.PHONY: testfast
testfast:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory testfast;
.PHONY: testfastquiet
testfastquiet:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory testfastquiet;
.PHONY: testfull
testfull:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory testfull;
.PHONY: testfullquiet
testfullquiet:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory testfullquiet;
.PHONY: testgdb
testgdb:
@$(MAKE) --no-print-directory debug && { \
cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory debug testgdb; \
};
.PHONY: testkdbg
testkdbg:
@$(MAKE) --no-print-directory debug && { \
cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory debug testkdbg; \
};
.PHONY: testmemcheck
testmemcheck:
@cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory debug memcheck;
.PHONY: testquiet
testquiet:
@$(MAKE) --no-print-directory debug && { \
cd test && \
TEST_ARGS=$(TEST_ARGS) $(MAKE) --no-print-directory debug testquiet; \
};
.PHONY: testsummary
testsummary:
@cd test && $(MAKE) --no-print-directory coveragesummary;
.PHONY: testview
testview:
@cd test && $(MAKE) --no-print-directory coverageview;