www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/22/07:08:25

Message-ID: <371F038A.223E3C84@cfwb.be>
Date: Thu, 22 Apr 1999 13:10:02 +0200
From: dominique DOT cretel AT cfwb DOT be (CRETEL Dominique)
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: fr,fr-BE,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Help for Makefile
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990422121413 DOT 15748h-100000 AT is>
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:

> This is because you defined a wrong command in the rule:
>
> %.o: %.c
>         $(CC) -c $@ $(CPPFLAGS) $(CFLAGS) $<
>
> $@ is the target, so it needs to be after the -o switch:
>
>         $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
>

Ok, thanks for your help Eli, but the rule used is not this one!
You're right, I defined a wrong rule.
The wrong rule I used to make library was:

(%.o): %.c
        $(CC) -c $% $(CPPFLAGS) $(CFLAGS) $<
        $(AR) cr $@ $%
        $(RM) $%

and the correct one should be (without the $%):

(%.o): %.c
        $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
        $(AR) cr $@ $%
        $(RM) $%

Ok, now when I execute the makefile, all the objects files are generated.
But, at the end, I get an error message:

------------------------------------
gcc -c  -s -O2 -Wall -pedantic sflxmll.c
sflxmll.c: In function `get_next_element_token':
sflxmll.c:424: warning: suggest explicit braces to avoid ambiguous `else'
ar cr libsfl.a sflxmll.o
del sflxmll.o
libsfl.a
make.exe: *** [libsfl.a] Error -1

D:\Sfl>
------------------------------------

> See how simple this is?  Had you posted the error with the original
> message, you could have the answer 4 days ago ;-).

Can you help me?

Dominique.

- Raw text -


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