[3654684] | 1 | #
|
---|
[8624d1f] | 2 | # SPDX-FileCopyrightText: 2006 Martin Decky
|
---|
[41f7564] | 3 | #
|
---|
[8624d1f] | 4 | # SPDX-License-Identifier: BSD-3-Clause
|
---|
[41f7564] | 5 | #
|
---|
| 6 |
|
---|
[218e50c] | 7 | CSCOPE = cscope
|
---|
[b1efe3e] | 8 | FORMAT = clang-format
|
---|
[4e9aaf5] | 9 |
|
---|
[3529fbf0] | 10 | ERRNO_HEADER = abi/include/abi/errno.h
|
---|
| 11 | ERRNO_INPUT = abi/include/abi/errno.in
|
---|
[feab36ae] | 12 |
|
---|
[05d97eef] | 13 | .PHONY: nothing cscope cscope_parts format ccheck ccheck-fix space check_errno
|
---|
[a5c468e] | 14 |
|
---|
[05d97eef] | 15 | nothing:
|
---|
[656437a0] | 16 |
|
---|
| 17 | cscope:
|
---|
[6eda732] | 18 | find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
|
---|
[656437a0] | 19 |
|
---|
[efb94a77] | 20 | cscope_parts:
|
---|
[6eda732] | 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
|
---|
[efb94a77] | 25 |
|
---|
[b1efe3e] | 26 | format:
|
---|
| 27 | find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
|
---|
| 28 |
|
---|
[be9702e0] | 29 | ccheck:
|
---|
[a4eb3ba2] | 30 | cd tools && ./build-ccheck.sh
|
---|
[db3089d] | 31 | tools/ccheck.sh
|
---|
| 32 |
|
---|
[be9702e0] | 33 | ccheck-fix:
|
---|
[a4eb3ba2] | 34 | cd tools && ./build-ccheck.sh
|
---|
[e347396] | 35 | tools/ccheck.sh --fix
|
---|
| 36 |
|
---|
[34e1206] | 37 | space:
|
---|
| 38 | tools/srepl '[ \t]\+$$' ''
|
---|
| 39 |
|
---|
[3c7702c0] | 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 |
|
---|
[3529fbf0] | 47 | $(ERRNO_HEADER): $(ERRNO_INPUT)
|
---|
| 48 | echo '/* Generated file. Edit errno.in instead. */' > $@.new
|
---|
[10de842] | 49 | sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
|
---|
[3529fbf0] | 50 | mv $@.new $@
|
---|