Hi -

I am looking for a general solution to a type of problem I frequently encounter 
at work.

Suppose I have a program called "foo" that reads text from STDIN, does 
something useful to the text, and sends output to STDOUT. For example:

$ foo infile.txt > outfile.txt

I have several .txt files in a directory called "in". I want to process each of 
those files with "foo" and send the output to the "out" directory. For example:

in/file001.txt ---> foo ---> out/file001.txt
in/file002.txt ---> foo ---> out/file002.txt
...
in/file999.txt ---> foo ---> out/file999.txt

Directory "in" contains a large number of text files. Files are frequently 
added to, changed, and deleted from directory "in".

I have the following Makefile:

$ cat Makefile
out/%.txt: in/%.txt
        foo    $<   >   $@
$

This does not work as expected (I get an error message I do not understand).

I have also tried:

$ cat Makefile
out/*.txt: in/*.txt
        foo    $<   >   $@
$

This also does not work.

(BTW, yes, a tab precedes foo)

What am I doing wrong?

I am using Linux Mint.

Thanks for your help.


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to