Hi On 31 May 2017 at 14:28, icvallejo <ignacio.carbajo.vall...@nfrance.com> wrote:
> Hello all, I'm rookie with gnu make and I have a question; I'm doing a > Makefile like this: > > #!/bin/bash > ^^^^^ This doesn't make any sense - this is not a bash script. > # Makefile > > IMPORT_PATH := github.com/... > CHECK := 0 > > .PHONY: install > install: > $Q printf "\\nLet's install..." > # $Q export CHECK=0 > $Q if grep -q \!string "$(DIR)" ; then CHECK = $($CHECK + 1) ; fi > ^^^^ The assignment here creates a shell variable "CHECK" which doesn't exist after the recipe finishes and it tries to assign a make variable called " + 1" into it which also doesn't make sense. > $Q printf "done!" > You're going to get into trouble here with the difference between make variables $(VARIABLE) and bash variables $VARIABLE and also with the time at which recipes are expanded. Expansion in a recipe usually happens just before the recipe is executed. You can change the value of a variable (using $(eval)) before the recipe is run but that's no use to you here because you want the change to depend on something the recipe does. It might seem dull but I think you should probably read the GNU make manual for a while and then post here again with the thing you're trying to achieve. Regards, Tim _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make