Mail Archives: djgpp/2000/07/31/08:32:53
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 -