gcb
gcb

Reputation: 14558

makefile, multiple inputs, one output. keeping fresh state. possible?

I have one target that takes several input files and generate one.

right now i'm ignoring the freshness state of the input files and running it as a .PHONY

file.out:
    $(CMD) input/* file.out

i'd like to have something like:

file.out: $(wildcard input/*)
    $(CMD) $^ $@

...So that make would not run CMD every time the input haven't changed.

Upvotes: 0

Views: 332

Answers (1)

Stephen Niedzielski
Stephen Niedzielski

Reputation: 2637

Remove the .PHONY target.

CMD := cat

file.out: $(wildcard input/*)
    $(CMD) $^ > $@

Upvotes: 1

Related Questions