Makefile and '$(addprefix)'

Parv parv at pair.com
Mon May 22 15:44:54 PDT 2006


in message <1148335671.2572.10.camel at LatitudeFC5.network>,
wrote Andrew thusly...
>
> I'm trying to use $(addprefix) build lists of source files and
> object files containing the relative paths for each. The problem
> is that $(addprefix) never seems to be evaluated. When I run 'make
> -p', $OBJECT_LIST looks exactly like in does in my Makefile, which
> is listed below.
...
> #### Begin Makefile ####
> 
> ## compiler settings
> CC = gcc
> OPTIONS = -Wall -g
> 
> ## directory layout
> BASEDIR = ../alice
> SOURCEDIR = $(BASEDIR)/sources
> OBJECTDIR = $(BASEDIR)/objects
> DOCSDIR = $(BASEDIR)/documentation
...
> SOURCES_LIST = $(addprefix, $(SOURCEDIR), $(SOURCE))
> OBJECTS_LIST = $(addprefix, $(OBJECTDIR), $(OBJECTS))
> 
> ## targets
> alice: $(OBJECT_LIST)
>         $(CC) $(OPTIONS) -o $@ $(OBJECT_LIST)
...

Looks like you are using gnu make syntax.

Read make(1) man page.  Replace $(VAR) with ${VAR} & see what
happens (i am unsure as i am a light user of BSD make).


  - Parv

-- 



More information about the freebsd-questions mailing list