Date: Thu, 8 Mar 2001 16:04:54 GMT From: jhs@freebsd.org To: FreeBSD-gnats-submit@freebsd.org Subject: bin/25627: Cannot append hash after .elif in Makefile, (but can after .if) Message-ID: <200103081604.f28G4s419991@jhs.muc.de>
next in thread | raw e-mail | index | archive | help
>Number: 25627 >Category: bin >Synopsis: Cannot append hash after .elif in Makefile, (but can after .if) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 09 01:30:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Julian Stacey jhs@jhs.muc.de >Release: FreeBSD 4.2-RELEASE i386 >Organization: FreeBSD >Environment: `man make` says: Comments begin with a hash (`#') character, anywhere but in a shell com- mand line, and continue to the end of the line. To understand a complex Makefile like /usr/src/release/Makefile with nested .if .endif conditionals, it is useful to hang "#{" & "#}" at end of lines & use the "%" key in vi to bounce between matching braces. This fails on .elif >Description: The expansion of .elif uses everything up to '\n' & allows no '#' comment delimeter as available to simpler .if & .else & .endif commands. >How-To-Repeat: mkdir ~/tmp ; cd ~/tmp ; cat > Makefile << EOF break: .if defined(AA) #{AA @echo 11 .elif defined(BB) #}{!AA{BB @echo 22 .else #}{!BB @echo 33 .endif #}} ok: .if defined(AA) #{AA @echo 11 .else #}{!AA .if defined(BB) #{BB @echo 22 .else #}{!BB @echo 33 .endif #} .endif #} EOF make "Makefile", line 4: Malformed conditional (defined(BB) #}{!AA{BB) make: fatal errors encountered -- cannot continue >Fix: Document it - until a make guru fixes it sometime, maybe. *** 4.2-RELEASE/src/usr.bin/make/make.1 Thu Oct 19 06:23:49 2000 --- new/src/usr.bin/make/make.1 Thu Mar 8 16:53:43 2001 *************** *** 1238,1243 **** --- 1238,1273 ---- \&.endfor .Ed won't work, and should be rewritten the other way around. + .Pp + The expansion of .elif uses everything up to end of line, & allows no + # comment delimeter as available to simpler .if & .else & .endif commands. + .br + This thus fails; + .in +2 + .nf + .if defined(AA) #{AA + @echo 11 + .elif defined(BB) #}{!AA{BB + @echo 22 + .else #}{!BB + @echo 33 + .endif #}} + .fi + .in -2 + Whereas this works + .in +2 + .nf + .if defined(AA) #{AA + @echo 11 + .else #}{!AA + .if defined(BB) #{BB + @echo 22 + .else #}{!BB + @echo 33 + .endif #} + .endif #} + .fi + .in -2 .Sh SEE ALSO .Xr mkdep 1 .Rs >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103081604.f28G4s419991>