Mail Archives: djgpp/2000/01/28/19:47:32
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> Default wrote:
> >
> > I am using make to compile embedded code for an HC16, so I am not using
> > DJGPP. I am wondering if there is a way to check if a file exists from
> > within make.
>
> If you really need that, you could use the function $(wildcard) and see if it
> returns an empty list.
>
> > I want to delete the listing and absolute listing file
> > each time I recreate the object file. I suppose that I could just do it
> > manually everytime or just automatically delete them within the target.
>
> Why cannot you delete it unconditionally? If it doesn't exist, deleting it
> won't do any harm, right?
Except that DEL says "File not found" if the file does not exist. I
have not tried this in a makefile but in DOS you can type:
if exist filename del filename
For a portable makefile it may be better to use rm (from the package
fil316b.zip), this won't complain if the file does not exist:
rm -f filename
Robert, Many projects have a 'clean' target which deletes all the
target files, are you looking for something _similar_ to that?
- Raw text -