[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Newbie and not very techie - using GNU make for non-C-development tasks
From: |
John Christopher |
Subject: |
Newbie and not very techie - using GNU make for non-C-development tasks |
Date: |
Sun, 6 Jul 2014 07:14:30 -0700 |
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.
- Newbie and not very techie - using GNU make for non-C-development tasks,
John Christopher <=