Skip to content

Commit

Permalink
fix(ci.mk): check if 'root_dir' and 'cc' variables are defined
Browse files Browse the repository at this point in the history
Certain variables must be defined before including 'ci.mk' or
instantiating some of its rules. This commits adds checks for two of
them 'root_dir' that should contain the repositories root directory
where the ci repo is located, and 'cc' which defines the compiler to be
used.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
  • Loading branch information
josecm committed Jan 20, 2023
1 parent 4d8980b commit dcf3b8a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ci.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) Bao Project and Contributors. All rights reserved

include util.mk

$(call check_variable_defined, root_dir, \
"To include ci.mk the 'root_dir' must be defined")

ci_dir?=$(realpath $(root_dir)/ci)
cur_dir:=$(realpath .)

Expand Down Expand Up @@ -138,6 +143,8 @@ endef
# Cppcheck static-analyzer
# Run it by:
# make cppcheck
# @pre the make variable 'cc' must be defined with the target's cross-compiler
# to run any cppcheck-based rules
# @param files a single space-separated list of C files (header or source)
# @param headers a list of preprocessor flags, including header files root path
# @example $(call ci, cppcheck, file1.c file2.c file3.h, -I/my/include/dir/inc)
Expand Down Expand Up @@ -165,6 +172,8 @@ clean: cppcheck-clean
non_build_targets+=cppcheck cppcheck-clean

define cppcheck
$(call check_variable_defined, cc, \
"For running cppcheck-based tests 'cc' must be defined")
_cppcheck_files+=$1
_cppcheck_flags+=$2
endef
Expand Down

0 comments on commit dcf3b8a

Please sign in to comment.