Date: Mon, 31 Jul 2000 15:31:59 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Norberto Alfredo Bensa cc: djgpp AT delorie DOT com Subject: Re: Makefiles In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 31 Jul 2000, Norberto Alfredo Bensa wrote: > I got a problem with it. 'info make' says to use the following: > > %.d: %.c > set -e; $(CC) -M $(CPPFLAGS) $< \ > | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ > [ -s $@ ] || rm -f $@ > > but I get an error: > Generating dependencies for zone.c... > Unknown command "[" The above snippet requires a Unixy shell and rm.exe. Install the port of Bash (v2gnu/bsh203b.zip) and Fileutils (v2gnu/fil316b.zip), put a line which says "SHELL = /bin/sh" somewhere in your Makefile, and it will work. > Now, if I delete '[ -s $@ ] || rm -f $@' it works, but if it fails I end up > with a null file... How do I fix that? Add a command to delete the .d file if it is empty. Finding out if a file is empty is tricky, but you can use a feature of the COPY command: it doesn't copy empty files. > And what is '[ -s $@]' for? What does it means? This is a Unix shell syntax. It tests whether the file $@ has a non-zero size.