I’m working on a C++ project that I am starting with uses a GNU Makefile, The makefile contains many functions, one of which calls other functions. I noticed that in the Travis-CI log, this function does not successfully call the other functions, instead, it leaves a blank space, which causes the build to fail. it does work locally however…
The function is:
define Compile
mkdir -p $(@D)
if [[ $(2) == Linking ]]; then \
$(call Print,$(2) $(@F),$(WIDTH)); \
else \
$(call PrintCpp,$(2) $(@F),$(WIDTH)); \
fi
$(1) 2> $@.log; \
RESULT=$?; \
if [ $RESULT -ne 0 ]; then \
$(cross); \
else \
$(check); \
fi; \
cat $@.log; \
rm -f $@.log
endef
The functions called are:
define Line =
$(shell printf '%0.1s' "$(2)"{1..$(1)})
endef
define Print
var="$(1)"; \
width="$(2)";\
printf '%s%*.*s' "$var" 0 $(($width - ${#var} - 1)) "$(call
Line,$(2),.)"
endef
define PrintCpp
var="$(1)"; \
var=${var%.*}.cpp; \
width="$(2)";\
printf '%s%*.*s' "$var" 0 $(($width - ${#var} - 1)) "$(call
Line,$(2),.)"
endef
define check =
printf "%b\n" "$(OK_COLOR)\xE2\x9C\x94 $(NO_COLOR)"
endef
define cross =
printf "%b\n" "$(ERR_COLOR)\xE2\x9D\x8C $(NO_COLOR)"
endef
any help would be great…