makefile:71: *** Recursive variable `LIBS' references itself (eventually). Stop

2003-10-27 Thread Dominique DEUFF

Hello,

I have to rebuild a project with the makefile I join at the end.
I obtain this error :
makefile:71: *** Recursive variable `LIBS' references itself
(eventually).  Stop

Does anyone know a solution to this ? 
Thank you very much,

Dominique





# Module Macro #
NAME= wintag
SRCS= $(NAME).c dib.c file.c paint.c init.c frame.c child.c
clipbrd.c about.c blowup.c addtags.c codeer.c message.c taglist.c focus.c
register.c odc.c mouse.c
OBJS=

# C7/Display Compatibility Test #
C7  =  1
DCT =  0

# Library Macro #
!if $(C7) \
LIBS= libw mlibcew commdlg oldnames icflib
!else \
LIBS= libw mlibcew commdlg
!endif \
MOD = -AM

# Include Macro #
INCLS   = $(NAME).h dib.h file.h paint.h init.h frame.h child.h
clipbrd.h about.h  blowup.h addtags.h codeer.h message.h taglist.h focus.h
register.h odc.h mouse.h

# Resource Macro #
RCFILES =  addtags.dlg taglist.dlg bugs.dlg select.cur

# DEBUG Defined #
DEBUG   = 0

# Build Option Macros #
!if $(DEBUG) \
DDEF= -DDEBUG
CLOPT   = -Zid -Od
MOPT= -Zi
LOPT= /CO /LI /MAP
!else \
DDEF=
CLOPT   = -Os
LOPT= \
!endif \

# General Macros #
DEF =

# Tool Macros #
ASM = masm -Mx $(MOPT) $(DDEF) $(DEF)
CC  = cl -nologo -c $(MOD) -G2sw -Zp -W3 $(CLOPT) $(DDEF) $(DEF)
LINK= link /NOD /NOE $(LOPT)
RC  = rc $(DDEF) $(DEF)
HC  = hc

# DCT #
!if $(DCT) \
CC  = $(CC) -DDCT
LIBS= $(LIBS) hctlib \
!endif \

# Inference Rules #
.c.obj:
$(CC) -NT _$* $*.c
   

.asm.obj:
$(ASM) $*.asm;

.rc.res:
$(RC) -r $*.rc

# Main (default) Target #
goal: $(NAME).exe

# Dependents For Goal and Command Line #
$(NAME).exe: $(SRCS:.c=.obj) $(NAME).def $(NAME).res
$(LINK) @<<
$(SRCS:.c=.obj) $(OBJS),
$(NAME).exe,
$(NAME).map,
$(LIBS),
$(NAME).def
<<
$(RC) -T $(NAME).res \
!if $(DEBUG) \
!if !$(C7) \
cvpack -p $(NAME).exe \
!endif \

mapsym $(NAME).map \
!endif \

# Dependents #
$(SRCS:.c=.obj): $(INCLS)
$(NAME).res: $(RCFILES) $(INCLS)

# Clean Directory #
clean:
-del *.obj
-del *.res
-del *.exe
-del *.map
-del *.sym



<>___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


Re: makefile:71: *** Recursive variable `LIBS' references itself (eventually). Stop

2003-10-27 Thread Sam Ravnborg
On Tue, Oct 28, 2003 at 12:21:49PM +0900, Dominique DEUFF wrote:
> 
>   Hello,
> 
>   I have to rebuild a project with the makefile I join at the end.
>   I obtain this error :
>   makefile:71: *** Recursive variable `LIBS' references itself
> (eventually).  Stop
> 
>   Does anyone know a solution to this ? 

There are two types of assignments.

LIBS= file.a

Result in late evaluation. What is to the right of '=' is evaluated only
when LIBS is referenced. With late evaluation a variable cannot
reference itself - that the problem you see.
Late evaluation is required when for example using the following:
VAR = $@
What to realise is that the value of $@ differ with the context where the
variable is used - therefore late evaluation is required.
But most often this is not the case, so I generally prefer the second type
of assignment in my makefiles.


LIBS:= file.a

Result in early evaluation. Here LIBS is immediately assigned the value of
file.a. Use this type of assignment and your problem is solved.

Sam


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make