# The goal, for all of these cases:
# input is updated
# one is deleted (or doesn't exist yet)
# two is deleted (or doesn't exist yet)
# both one and two are deleted (or don't exist yet)
# The build-cmd script should run once and only once, even with make -j
all: one two
one: input
$(build-cmd)
two: input
$(build-cmd)
# Pretend this is some external script that creates both one and two
# using the file input
define build-cmd
@echo "Running build, for $@"
@touch one
@touch two
endef
input:
touch input
clean:
rm input one two