1 | #
|
---|
2 | # SPDX-FileCopyrightText: 2006 Martin Decky
|
---|
3 | #
|
---|
4 | # SPDX-License-Identifier: BSD-3-Clause
|
---|
5 | #
|
---|
6 |
|
---|
7 | CSCOPE = cscope
|
---|
8 | FORMAT = clang-format
|
---|
9 |
|
---|
10 | ERRNO_HEADER = abi/include/abi/errno.h
|
---|
11 | ERRNO_INPUT = abi/include/abi/errno.in
|
---|
12 |
|
---|
13 | .PHONY: nothing cscope cscope_parts format ccheck ccheck-fix space check_errno
|
---|
14 |
|
---|
15 | nothing:
|
---|
16 |
|
---|
17 | cscope:
|
---|
18 | find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
|
---|
19 |
|
---|
20 | cscope_parts:
|
---|
21 | find abi -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_abi.out
|
---|
22 | find kernel -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_kernel.out
|
---|
23 | find boot -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_boot.out
|
---|
24 | find uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_uspace.out
|
---|
25 |
|
---|
26 | format:
|
---|
27 | find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
|
---|
28 |
|
---|
29 | ccheck:
|
---|
30 | cd tools && ./build-ccheck.sh
|
---|
31 | tools/ccheck.sh
|
---|
32 |
|
---|
33 | ccheck-fix:
|
---|
34 | cd tools && ./build-ccheck.sh
|
---|
35 | tools/ccheck.sh --fix
|
---|
36 |
|
---|
37 | space:
|
---|
38 | tools/srepl '[ \t]\+$$' ''
|
---|
39 |
|
---|
40 | # `sed` pulls a list of "compatibility-only" error codes from `errno.in`,
|
---|
41 | # the following grep finds instances of those error codes in HelenOS code.
|
---|
42 | check_errno:
|
---|
43 | @ ! cat abi/include/abi/errno.in | \
|
---|
44 | sed -n -e '1,/COMPAT_START/d' -e 's/__errno_entry(\([A-Z0-9]\+\).*/\\b\1\\b/p' | \
|
---|
45 | git grep -n -f - -- ':(exclude)abi' ':(exclude)uspace/lib/posix'
|
---|
46 |
|
---|
47 | $(ERRNO_HEADER): $(ERRNO_INPUT)
|
---|
48 | echo '/* Generated file. Edit errno.in instead. */' > $@.new
|
---|
49 | sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
|
---|
50 | mv $@.new $@
|
---|