dev: add check_headers rule in the Makefile
This commit is contained in:
parent
65c31c3899
commit
120dcc6391
1 changed files with 25 additions and 0 deletions
25
Makefile
25
Makefile
|
@ -343,3 +343,28 @@ endef
|
|||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
# Added by Zy
|
||||
# To check if the headers are protected and if they include everything they need.
|
||||
|
||||
check_headers :
|
||||
@ERROR=0; \
|
||||
for HEADER in $(wildcard **/*.h); \
|
||||
do \
|
||||
echo "check header $$HEADER..."; \
|
||||
> __tmp_check_header.c echo "#include \"$$HEADER\""; \
|
||||
>> __tmp_check_header.c echo "#include \"$$HEADER\""; \
|
||||
>> __tmp_check_header.c echo "int main(void) {}"; \
|
||||
$(CPP) -o __tmp_check_header.out __tmp_check_header.c; \
|
||||
if [ $$? -ne 0 ]; \
|
||||
then \
|
||||
ERROR=1; \
|
||||
echo " error \e[31m:(\e[0m"; \
|
||||
fi; \
|
||||
echo " good \e[32m:)\e[0m"; \
|
||||
2> /dev/null rm -- "__tmp_check_header.out" "__tmp_check_header.c"; \
|
||||
done; \
|
||||
2> /dev/null rm __tmp_check_header.out __tmp_check_header.c; \
|
||||
if [ $$ERROR -eq 0 ]; then true; else false; fi;
|
||||
|
||||
.PHONY : check_headers
|
||||
|
|
Loading…
Add table
Reference in a new issue