From nobody@FreeBSD.org Mon Jun 21 00:44:26 2010 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63F0D1065672 for ; Mon, 21 Jun 2010 00:44:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 1C71C8FC1C for ; Mon, 21 Jun 2010 00:44:26 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L0iPOW000858 for ; Mon, 21 Jun 2010 00:44:25 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o5L0iPXK000857; Mon, 21 Jun 2010 00:44:25 GMT (envelope-from nobody) Message-Id: <201006210044.o5L0iPXK000857@www.freebsd.org> Date: Mon, 21 Jun 2010 00:44:25 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org Subject: Some built-in AT&T/POSIX compat make variables are broken X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 148024 >Category: bin >Synopsis: Some built-in AT&T/POSIX compat make variables are broken >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 21 00:50:01 UTC 2010 >Closed-Date: Mon Jun 28 10:59:46 UTC 2010 >Last-Modified: Mon Jun 28 10:59:46 UTC 2010 >Originator: Garrett Cooper >Release: 9-CURRENT >Organization: Cisco Systems, Inc. >Environment: FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r206173M: Mon Apr 26 22:45:06 PDT 2010 root@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA.ata amd64 >Description: I'm trying to convert some GNU makefiles over to a POSIX compliant form, and it appears that our copy of make is broken in that respect. Example: $ cat ~/Makefile.prereq bar: foo: bar @echo target: $@ prereq: $< $ make -f ~/Makefile.prereq foo target: foo prereq: The above invocation should have printed out: target: foo prereq: bar Furthermore, even though FreeBSD's version of pmake claims to drop this support as per the manpage for backwards compatibility with AT&T... .ALLSRC The list of all sources for this target; also known as `>'. .ARCHIVE The name of the archive file; also known as `!'. .IMPSRC The name/path of the source from which the target is to be transformed (the ``implied'' source); also known as `<'. .MEMBER The name of the archive member; also known as `%'. .OODATE The list of sources for this target that were deemed out-of- date; also known as `?'. .PREFIX The file prefix of the file, containing only the file portion, no suffix or preceding directory components; also known as `*'. .TARGET The name of the target; also known as `@'. and POSIX specifies that these variables should exist, they don't function in our version of make: The five internal macros are: $@ The $@ shall evaluate to the full target name of the current target, or the archive filename part of a library archive target. It shall be evaluated for both target and inference rules. For example, in the .c.a inference rule, $@ represents the out-of-date .a file to be built. Similarly, in a makefile target rule to build lib.a from file.c, $@ represents the out-of-date lib.a. $% The $% macro shall be evaluated only when the current target is an archive library member of the form libname( member .o). In these cases, $@ shall evaluate to libname and $% shall evaluate to member .o. The $% macro shall be evaluated for both target and inference rules. For example, in a makefile target rule to build lib.a( file.o), $% represents file.o, as opposed to $@, which represents lib.a. $? The $? macro shall evaluate to the list of prerequisites that are newer than the current target. It shall be evaluated for both target and inference rules. For example, in a makefile target rule to build prog from file1.o, file2.o, and file3.o, and where prog is not out-of-date with respect to file1.o, but is out-of-date with respect to file2.o and file3.o, $? represents file2.o and file3.o. $< In an inference rule, the $< macro shall evaluate to the filename whose existence allowed the inference rule to be chosen for the target. In the .DEFAULT rule, the $< macro shall evaluate to the current target name. The meaning of the $< macro shall be otherwise unspecified. For example, in the .c.a inference rule, $< represents the prerequisite .c file. $* The $* macro shall evaluate to the current target name with its suffix deleted. It shall be evaluated at least for inference rules. For example, in the .c.a inference rule, $*.o represents the out-of-date .o file that corresponds to the prerequisite .c file See http://www.opengroup.org/onlinepubs/009695399/utilities/make.html for more details. >How-To-Repeat: See above testcase. >Fix: Looking at fixing this. >Release-Note: >Audit-Trail: From: Garrett Cooper To: bug-followup@FreeBSD.org, gcooper@FreeBSD.org Cc: Subject: Re: bin/148024: Some built-in AT&T/POSIX compat make variables are broken Date: Sun, 20 Jun 2010 17:58:45 -0700 To provide another datapoint, bmake seems to be broken in this regard as well: $ bmake -f ~/Makefile.prereq foo target: foo prereq: -Garrett From: Garrett Wollman To: gcooper@freebsd.org Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/148024: Some built-in AT&T/POSIX compat make variables are broken Date: Sun, 20 Jun 2010 22:46:33 -0400 (EDT) In article , gcooper@freebsd.org writes: >foo: bar > @echo target: $@ prereq: $< >$ make -f ~/Makefile.prereq foo >target: foo prereq: > >The above invocation should have printed out: > >target: foo prereq: bar No. $< is only defined for pattern rules. >$< > In an inference rule, the $< macro shall evaluate to the filename >whose existence allowed the inference rule to be chosen for the target. >In the .DEFAULT rule, the $< macro shall evaluate to the current target >name. The meaning of the $< macro shall be otherwise unspecified. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -GAWollman From: Garrett Cooper To: Garrett Wollman Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/148024: Some built-in AT&T/POSIX compat make variables are broken Date: Sun, 20 Jun 2010 20:56:23 -0700 On Sun, Jun 20, 2010 at 7:46 PM, Garrett Wollman wrote: > In article > , > gcooper@freebsd.org writes: > >>foo: bar >> =A0 =A0 =A0 @echo target: $@ prereq: $< >>$ make -f ~/Makefile.prereq foo >>target: foo prereq: >> >>The above invocation should have printed out: >> >>target: foo prereq: bar > > No. =A0$< is only defined for pattern rules. > >>$< >> =A0 =A0In an inference rule, the $< macro shall evaluate to the filename >>whose existence allowed the inference rule to be chosen for the target. >>In the .DEFAULT rule, the $< macro shall evaluate to the current target >>name. The meaning of the $< macro shall be otherwise unspecified. > =A0 =A0 =A0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Ok.. this appears to be a GNU make `extension': $ gmake -f ~/Makefile.prereq yadda.a target: yadda.a prereq: bazinga.b target: yadda.a prereq: target: prereq: $ make -f ~/Makefile.prereq yadda.a target: yadda.a prereq: target: yadda.a prereq: bazinga.b target: yadda.a prereq: bazinga.b $ bmake -f ~/Makefile.prereq yadda.a target: yadda.a prereq: target: yadda.a prereq: bazinga.b target: yadda.a prereq: bazinga.b $ cat ~/Makefile.prereq .b.a: echo target: $@ prereq: $< bazinga.b: yadda.a: bazinga.b @echo target: $@ prereq: $< @echo target: $@ prereq: $> @echo target: ${.TARGET} prereq: ${.ALLSRC} Is an inference rule the .b.a rule? POSIX doesn't properly define what it is and assumes you know what's going on (lousy documentation) :(... Thanks, -Garrett From: Garrett Cooper To: Garrett Cooper Cc: Garrett Wollman , bug-followup Subject: Re: bin/148024: Some built-in AT&T/POSIX compat make variables are broken Date: Mon, 21 Jun 2010 08:20:53 -0700 On Sun, Jun 20, 2010 at 8:56 PM, Garrett Cooper wrote= : > On Sun, Jun 20, 2010 at 7:46 PM, Garrett Wollman > wrote: >> In article >> , >> gcooper@freebsd.org writes: >> >>>foo: bar >>> =A0 =A0 =A0 @echo target: $@ prereq: $< >>>$ make -f ~/Makefile.prereq foo >>>target: foo prereq: >>> >>>The above invocation should have printed out: >>> >>>target: foo prereq: bar >> >> No. =A0$< is only defined for pattern rules. >> >>>$< >>> =A0 =A0In an inference rule, the $< macro shall evaluate to the filenam= e >>>whose existence allowed the inference rule to be chosen for the target. >>>In the .DEFAULT rule, the $< macro shall evaluate to the current target >>>name. The meaning of the $< macro shall be otherwise unspecified. >> =A0 =A0 =A0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > =A0 =A0Ok.. this appears to be a GNU make `extension': > > $ gmake -f ~/Makefile.prereq yadda.a > target: yadda.a prereq: bazinga.b > target: yadda.a prereq: > target: prereq: > $ make -f ~/Makefile.prereq yadda.a > target: yadda.a prereq: > target: yadda.a prereq: bazinga.b > target: yadda.a prereq: bazinga.b > $ bmake -f ~/Makefile.prereq yadda.a > target: yadda.a prereq: > target: yadda.a prereq: bazinga.b > target: yadda.a prereq: bazinga.b > $ cat ~/Makefile.prereq > .b.a: > =A0 =A0 =A0 =A0echo target: $@ prereq: $< > > bazinga.b: > > yadda.a: bazinga.b > =A0 =A0 =A0 =A0@echo target: $@ prereq: $< > =A0 =A0 =A0 =A0@echo target: $@ prereq: $> > =A0 =A0 =A0 =A0@echo target: ${.TARGET} prereq: ${.ALLSRC} > > =A0 =A0Is an inference rule the .b.a rule? POSIX doesn't properly define > what it is and assumes you know what's going on (lousy documentation) > :(... It appears that the ultimate problem here is that POSIX does a lousy job at defining Makefiles and general purpose make terms (which was ultimately causing confusion at my end). I'll go prod the opengroup folks to improve their definitions and nomenclature. Thanks, -Garrett From: Garrett Cooper To: Garrett Cooper Cc: Garrett Wollman , bug-followup Subject: Re: bin/148024: Some built-in AT&T/POSIX compat make variables are broken Date: Mon, 21 Jun 2010 08:21:18 -0700 On Mon, Jun 21, 2010 at 8:20 AM, Garrett Cooper wrote= : > On Sun, Jun 20, 2010 at 8:56 PM, Garrett Cooper wro= te: >> On Sun, Jun 20, 2010 at 7:46 PM, Garrett Wollman >> wrote: >>> In article >>> = , >>> gcooper@freebsd.org writes: >>> >>>>foo: bar >>>> =A0 =A0 =A0 @echo target: $@ prereq: $< >>>>$ make -f ~/Makefile.prereq foo >>>>target: foo prereq: >>>> >>>>The above invocation should have printed out: >>>> >>>>target: foo prereq: bar >>> >>> No. =A0$< is only defined for pattern rules. >>> >>>>$< >>>> =A0 =A0In an inference rule, the $< macro shall evaluate to the filena= me >>>>whose existence allowed the inference rule to be chosen for the target. >>>>In the .DEFAULT rule, the $< macro shall evaluate to the current target >>>>name. The meaning of the $< macro shall be otherwise unspecified. >>> =A0 =A0 =A0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> >> =A0 =A0Ok.. this appears to be a GNU make `extension': >> >> $ gmake -f ~/Makefile.prereq yadda.a >> target: yadda.a prereq: bazinga.b >> target: yadda.a prereq: >> target: prereq: >> $ make -f ~/Makefile.prereq yadda.a >> target: yadda.a prereq: >> target: yadda.a prereq: bazinga.b >> target: yadda.a prereq: bazinga.b >> $ bmake -f ~/Makefile.prereq yadda.a >> target: yadda.a prereq: >> target: yadda.a prereq: bazinga.b >> target: yadda.a prereq: bazinga.b >> $ cat ~/Makefile.prereq >> .b.a: >> =A0 =A0 =A0 =A0echo target: $@ prereq: $< >> >> bazinga.b: >> >> yadda.a: bazinga.b >> =A0 =A0 =A0 =A0@echo target: $@ prereq: $< >> =A0 =A0 =A0 =A0@echo target: $@ prereq: $> >> =A0 =A0 =A0 =A0@echo target: ${.TARGET} prereq: ${.ALLSRC} >> >> =A0 =A0Is an inference rule the .b.a rule? POSIX doesn't properly define >> what it is and assumes you know what's going on (lousy documentation) >> :(... > > =A0 =A0It appears that the ultimate problem here is that POSIX does a > lousy job at defining Makefiles and general purpose make terms (which > was ultimately causing confusion at my end). I'll go prod the > opengroup folks to improve their definitions and nomenclature. (so basically I was asking for the bug to be closed) State-Changed-From-To: open->closed State-Changed-By: jh State-Changed-When: Mon Jun 28 10:59:45 UTC 2010 State-Changed-Why: Closed at submitter's request. http://www.freebsd.org/cgi/query-pr.cgi?pr=148024 >Unformatted: