79637633

Date: 2025-05-25 12:01:01
Score: 2
Natty:
Report link

If you need something to stick around as a GNUMake variable, this somewhat tacky solution can work. It gets squirrelly looking with a parallel make. This is a working example ripped from a working project. Focus on the YHCOUNTER variable.

SHELL       := /bin/bash
YHCOUNTER   := 0

cache/%.yhjson: cache/%.cache
    @: $(eval YHCOUNTER=$(shell echo $$(($(YHCOUNTER) + 1))))
    @echo YHCOUNTER = $(YHCOUNTER)
    @if [[ $(YHCOUNTER) -lt 10 ]] ; then \
        echo do work ; \
    else echo skipping $(@) ; \
    fi

If someone has a classier way to do it, please post it. Thanks.

-E

GNU Make 4.3

Built for x86_64-pc-linux-gnu

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (2.5): please post
  • Long answer (-0.5):
  • Has code block (-0.5):
Posted by: Erik Bennett