# Functions not being called in travis

**URL:** <https://travis-ci.community/t/functions-not-being-called-in-travis/12541>\
**Category:** v2\
**Created:** [December 27, 2021, 4:36pm UTC](https://travis-ci.community/t/functions-not-being-called-in-travis/12541 "2021-12-27T16:36:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HILLBILLYHeisT](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hillbillyheist/32/7476_2.png) [@HILLBILLYHeisT](https://travis-ci.community/u/HILLBILLYHeisT)\
**Post date:** [December 27, 2021, 4:36pm UTC](https://travis-ci.community/t/functions-not-being-called-in-travis/12541/1 "2021-12-27T16:36:22Z")

</div>

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:

```cpp
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:

```cpp
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…

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [December 27, 2021, 4:38pm UTC](https://travis-ci.community/t/functions-not-being-called-in-travis/12541/2 "2021-12-27T16:38:19Z")

</div>

Hey @HILLBILLYHeisT,

Looking over your Makefile, it seems to me that the nested calling of functions is causing the error.

---

<div class="post-metadata">

**Author:** ![HILLBILLYHeisT](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hillbillyheist/32/7476_2.png) [@HILLBILLYHeisT](https://travis-ci.community/u/HILLBILLYHeisT)\
**Post date:** [December 27, 2021, 5:44pm UTC](https://travis-ci.community/t/functions-not-being-called-in-travis/12541/3 "2021-12-27T17:44:12Z")

</div>

made my makefile a bit less complex and renested some functions, it worked… thanks @Montana

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [December 27, 2021, 5:52pm UTC](https://travis-ci.community/t/functions-not-being-called-in-travis/12541/4 "2021-12-27T17:52:45Z")

</div>

Great to hear I could solve your issue.
