help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: make not expanding variables


From: Rakesh Sharma
Subject: RE: make not expanding variables
Date: Fri, 8 Aug 2014 22:28:45 -0700

Your makefile serves as a perfect example of the need to set the SHELL env from 
within the makefile, to prevent such shell-dependent vagaries affect make's 
execution.

What is happening is that the default SHELL in Ubuntu is /bin/sh , which would 
not be having the brace expansion {...}  built into it. This is OS-dependent 
though, as this makefile works just fine under cygwin, as there the /bin/sh is 
a symlink to bash.

There are a few changes in your makefile that I recommend based on make best 
practices:

  SHELL  :=    /bin/bash  mcc-y  :=   mcc_linux.o mcc_shm_linux.o 
mcc_sema4_linux.o mcc_common.oUse the simply-expanded variable construct := in 
place of the recursive.
  Use $(CURDIR) in place of PWD := $(shell pwd) as make provides the current 
working directory for free. So you can safely replace $(PWD) everywhere in your 
makefile with it.
cp -f {mcc_linux.h,mcc_common.h,mcc_config.h} $(DESTDIR)/usr/include/linux/ can 
be shortened even further making use of the brace expansion, like as,/bin/cp -f 
    mcc_{linux,common,config}.h      $(DESTDIR)/usr/include/linux/

-Rakesh


Date: Fri, 8 Aug 2014 10:43:32 -0400
Subject: make not expanding variables
From: address@hidden
To: address@hidden

Hello,
I'm using Ubuntu 12.04 64bit with make version 3.81-8.1ubuntu1.1 and was
failing to build bitbake recipes. I narrowed it down to an odd problem with
make not expanding variables. I've attached a sample make file (makefile)
with the "problem."
 
When I use this makefile, I get a directory "{hi,hi2}" within TestMake but
instead there should be two directories within TestMake created: "hi" and
"hi2", correct?
 
As an example from the actual project, I have attached Makefile_real. This
is a copy of a make file within the project. The problem is the line:
 
cp -f {mcc_linux.h,mcc_common.h,mcc_config.h} $(DESTDIR)/usr/include/linux/
 
which I have commented out in the file and replaced it with three calls to
copy the files individually. The make file runs fine with the individual
copying. Other files though that use {} are failing as well...and the
content within the {} are much more complexthan this simple manual copying.
 
Thus, any ideas?
 
Thanks,
Vance Turnewitsch

_______________________________________________
Help-make mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make                                
          

reply via email to

[Prev in Thread] Current Thread [Next in Thread]