🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #944

Re: make-3.62, Error with `+=' variable concatenation

#944
From: Goeran Uddeborg
Date: Fri, 25 Sep 1992 07:31
30 lines
1393 bytes
In article <199209241452.AA07992@mail.Germany.EU.net> muewi@oz.INformatik.uni-bremen.DE (Wilhelm Mueller) writes:
>The following Makefile
>
>-- 8< ------------------------------------------------------------ >8 --
>dummy = abc
>
>dummy += def
>
>all:
>	@echo $(dummy)
>-- 8< ------------------------------------------------------------ >8 --
>
>will echo just `abc', while Sun's make produces `abc def'.

Quoting from the node "Variables" in the documentation of GNU make:

    A variable name may be any sequence characters not containing `:',
    `#', `=', or leading or trailing whitespace.

So your makefile assigns the value "abc" to the variable "dummy", and
the value "def" to the variable "dummy +".

You can achieve what you intend by

    dummy = abc

    dummy := $(dummy) def

    all:
	    @echo $(dummy)
Technical Details
Message-ID: <1992Sep25.073110.7581@sics.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sisu.SE!uddeborg
References: <199209241452.AA07992@mail.Germany.EU.net>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sisu.SE!uddeborg
From: uddeborg@sisu.SE (Goeran Uddeborg)
Subject: Re: make-3.62, Error with `+=' variable concatenation
Message-ID: <1992Sep25.073110.7581@sics.se>
Sender: gnulists@ai.mit.edu
Organization: Swedish Institute of Systems Development
References: <199209241452.AA07992@mail.Germany.EU.net>
Distribution: gnu
Date: Fri, 25 Sep 1992 07:31:10 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 31