From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: make Date: Fri, 28 Jan 2000 23:39:06 +0000 Organization: Customer of Planet Online Lines: 31 Message-ID: References: <38907B45 DOT AA9727DD AT gw DOT rmtaero DOT bfg DOT com> <3890A195 DOT E2E39FD4 AT is DOT elta DOT co DOT il> NNTP-Posting-Host: modem-51.fermium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg3.svr.pol.co.uk 949103139 19455 62.136.69.179 (28 Jan 2000 23:45:39 GMT) NNTP-Posting-Date: 28 Jan 2000 23:45:39 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii 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?