[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lex implicit rule chain is broken

From: Mohamed Akram
Subject: Re: lex implicit rule chain is broken
Date: Sun, 19 May 2019 07:30:44 +0000

Thanks for the tip. I'm not sure why it doesn't just fail immediately then, instead of taking a few steps and stumbling on itself. Just out of curiosity, I tested the same thing with FreeBSD make (`LDFLAGS=-ll make`) and it compiled `lang` as expected with this output:

lex -t  lang.l > lang.c
cc -O2 -pipe -ll lang.c  -o lang

From: Philip Guenther <address@hidden>
Sent: Sunday, May 19, 2019 11:11 AM
To: Mohamed Akram
Cc: address@hidden
Subject: Re: lex implicit rule chain is broken
On Sat, May 18, 2019 at 9:07 PM Mohamed Akram <address@hidden> wrote:
echo "lang: lang.l" > Makefile

This Makefile is incorrect, as it tells make that 'lang.l' is a *direct* dependency of lang.  That's not true: lang.l has to be run through lex to get a .c file that can compiled to get lang.  

It tries to link the .l file.

make doesn't need any special instructions to tell it how to generate an executable from a .l file, but it'll do the Wrong Thing if you tell it the wrong thing.  To achieve your apparent goal you can simply run it with *no* Makefile and give it the name of the matching executable (ala "make lang" in this case) or use a Makefile sets the default target ala
   echo ".DEFAULT_GOAL = lang" >Makefile
and it'll deduce the rest from its default pattern rules.

Philip Guenther

reply via email to

[Prev in Thread] Current Thread [Next in Thread]