delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/31/08:32:53

Date: Mon, 31 Jul 2000 15:31:59 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Norberto Alfredo Bensa <nbensa AT hotmail DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Makefiles
In-Reply-To: <OE54mdcUTkTmz3tAFxZ00001aad@hotmail.com>
Message-ID: <Pine.SUN.3.91.1000731152752.4529B-100000@is>
MIME-Version: 1.0
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

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.

- Raw text -


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