Re: How to fail on a find with grep using make?

Eli Zaretskii <[email protected]>
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
> From: "Gary Turner" <[email protected]>
> Date: Mon, 23 Feb 2009 21:41:00 +1300
> 
> I'm using grep to compile files created by a gui editor. Occasionally a 'bad 
> thing' gets into the files, and I'd like the compile to fail if that 'bad 
> thing' is found in the file. By default grep 'fails' on not found, which 
> would normally stop make.
> What I want is something like  error if not grep 'bad thing' $<
> I'm using cmd.exe.

Does the following work for you?  It should work on W2K and later,
AFAIK.

foo: bar
	cmd /c "grep BADTHING $< & if not ERRORLEVEL 1 exit 1"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.