bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditional recipe execution


From: Paul Smith
Subject: Re: Conditional recipe execution
Date: Fri, 23 Jan 2015 16:45:50 -0500

On Fri, 2015-01-23 at 22:24 +0100, SF Markus Elfring wrote:
> > it means that the open parenthesis that it didn't match was the
> > "info" function on line 95.
> 
> I find this detail hard to believe.
> 
> I hope that the current KDevelop editor does not misguide me. The parentheses
> pairs are found there as expected.

Then KDevelop is wrong.  It appears that KDevelop's "makefile" editing
mode doesn't properly handle backslash continuations.

> Do you read the shown rule example eventually in the way that its recipe
> does not end with "…_NOTIFICATION8)'))"?

The _RULE_ does end with it, because the rule includes all the recipe
lines that appear after the target.  But variable/function invocations
cannot span different lines of a recipe.  They all must be contained
within the same logical line, as I mentioned before.

This is trivial to try out for yourself (like most things in make); just
write a simple makefile:

  $ cat > Makefile <<EOF
  all:
          $(info hello \
          there)
          $(info hello
          there)

  $ make
  hello there
  Makefile:2: *** unterminated call to function 'info': missing ')'.  Stop.

So the backslashed version (same logical line) works but the
non-backslashed version (different logical lines) fails.  I'm not sure
why the linenumber is wrong though... hm...

> > If you want that then you need a backslash at the end of line 96, to
> > continue the logical line:
> 
> I find that a backslash would not be needed at this place if would like to
> keep the "RM command" on a separate logical line.

It is definitely needed.  As I've said, it is not possible for a single
variable or function reference to span multiple logical lines.

If you want to do this you have to use define/endef to create a variable
that contains newlines, then use the variable in the recipe; see example
below.

I'm really not at all sure why you're using $(info ...) here... it won't
actually do anything if you do that.


define RUN_PARALLEL
$(eval LET_RUN_DATA_EXPORT1_PARALLEL::=)@$(RM) 
'$(RESULT_SQL_DATABASE_NOTIFICATION8)'
        $(DATABASE_CLI) -c \
'$(SQL_SELECT_START)_parallel1 where static = 0 $(SQL_SELECT_END)' \
'$(DATABASE_NAME)' \
> '$(RESULT_FUNCTIONS_WITH_PREFIX_PARALLEL)' \
&& $(TOUCH) '$(RESULT_SQL_DATABASE_NOTIFICATION8)'
endef

$(RESULT_FUNCTIONS_WITH_PREFIX1_PARALLEL) \
$(RESULT_SQL_DATABASE_NOTIFICATION8): \
initialise_database \
$(RESULT_SQL_DATABASE_NOTIFICATION4)
        $(info $(if $(LET_RUN_DATA_EXPORT1_PARALLEL),$(RUN_PARALLEL)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]