delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/28/19:47:32

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
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: <u0a49sgcdf6p0en2b6ohipte2m6uh3gdpc@4ax.com>
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
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 <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019