From owner-freebsd-stable@FreeBSD.ORG Tue Apr 4 22:20:57 2006 Return-Path: X-Original-To: freebsd-stable@FreeBSD.org Delivered-To: freebsd-stable@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4018B16A400; Tue, 4 Apr 2006 22:20:57 +0000 (UTC) (envelope-from eighner@io.com) Received: from smtp.prismnet.com (smtp.prismnet.com [209.198.128.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id 94B7243D49; Tue, 4 Apr 2006 22:20:56 +0000 (GMT) (envelope-from eighner@io.com) Received: from io.com (206-224-83-40-dialup.io.com [206.224.83.40]) by smtp.prismnet.com (8.13.4/8.13.4) with SMTP id k34MKajw026377; Tue, 4 Apr 2006 17:20:43 -0500 (CDT) (envelope-from eighner@io.com) Received: by io.com (nbSMTP-1.00) for uid 1001 eighner@io.com; Tue, 4 Apr 2006 17:19:50 -0500 (CDT) Date: Tue, 4 Apr 2006 17:19:33 -0500 (CDT) From: Lars Eighner To: Jung-uk Kim In-Reply-To: <200604041752.15909.jkim@FreeBSD.org> Message-ID: <20060404170708.D76810@goodwill.io.com> References: <20060404160100.U76190@goodwill.io.com> <200604041726.17120.jkim@FreeBSD.org> <20060404163058.J76542@goodwill.io.com> <200604041752.15909.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on smtp.prismnet.com X-Virus-Status: Clean X-Spam-Status: No, score=1.2 required=8.0 tests=RCVD_IN_SORBS_WEB autolearn=no version=3.1.0 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on smtp.prismnet.com Cc: freebsd-stable@FreeBSD.org Subject: Re: Is Makefile.inc1 in 6 wrong? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2006 22:20:57 -0000 On Tue, 4 Apr 2006, Jung-uk Kim wrote: > On Tuesday 04 April 2006 05:32 pm, Lars Eighner wrote: >> On Tue, 4 Apr 2006, Jung-uk Kim wrote: >>> On Tuesday 04 April 2006 05:14 pm, Lars Eighner wrote: >>>> It appears to me that either I have a wrong version of awk or >>>> this Makefile.inc1 is wrong: >>>> >>>> # >>>> # $FreeBSD: src/Makefile.inc1,v 1.499.2.11 2006/04/04 14:24:03 >>>> glebius Exp $ # >>>> >>>> >>>> >>>> MAKEOBJDIRPREFIX?= /usr/obj >>>> .if !defined(OSRELDATE) >>>> .if exists(/usr/include/osreldate.h) >>>> OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { >>>> print $$3 }' \ /usr/include/osreldate.h >>>> .else >>>> OSRELDATE= 0 >>>> >>>> >>>> In particular with the double dollar sign in the awk statement, >>>> I get no return, therefore OSRELDATE gets set to 0. The awk >>>> statement also fails from the command line. But if I use only >>>> one $, the awk statement succeeds. >>>> >>>> Is there a reason for the double dollar sign? >>> >>> Yes. See make(1): >>> >>> $ A single dollar sign `$', i.e. `$$' expands to a single >>> dollar sign. I think this is wrong for a SINGLE QUOTED argument to be passed to awk. The Makefile is wrong. I am right. >> >> Then why does it get the wrong answer? > > Because you ran it from command line. ;-) You can copy and paste the > same lines to *Makefile* like this: > > ------------ > .if !defined(OSRELDATE) > .if exists(/usr/include/osreldate.h) > OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ > /usr/include/osreldate.h > .else > OSRELDATE= 0 > .endif > .endif > > all: > @echo "reldate = ${OSRELDATE}" > ------------ > > and run make. You will see something like this (depending on your > header file): > > %make > reldate = 600034 But it doesn't Tue Apr 04 17:11:38 bash3.1:ttyp0:eighner goodwill~$make -V OSRELDATE -f /usr/src/Makefile.inc1 0 Tue Apr 04 17:12:25 bash3.1:ttyp0:eighner goodwill~$exit exit where /usr/include/osreldate.h = /*- * Copyright (c) 1992-2006 The FreeBSD Project. * All rights reserved. * SUCH DAMAGE. * */ #ifdef _KERNEL #error " cannot be used in the kernel, use " #else #undef __FreeBSD_version #define __FreeBSD_version 504105 #endif > >> Also is there a difference when the accent mark is used in front >> instead of a real single quote? > > Where do you see it? Where you wrote: >>> $ A single dollar sign `$', i.e. `$$' expands to a single >>> dollar sign. And also in man make. The ` is an accent key, not a quote key. Yes, they are aka backticks and do mean something when they are paired, but `something' is nonsense so far as I can tell. Why would make tamper with anything in single quotes that is passed to a command? How do you write an argument for a command so that make won't tamper with it? What would double quoting the argument be for? -- Lars Eighner eighner@io.com lars@larseighner.com http://www.larseighner.com/index.html 8800 N IH35 APT 1191 AUSTIN TX 78753-5266