The responses above have analyzed and solved the problem but not explained it completely. Let me clarify the basic fact, which is that Ubuntu (and only Ubuntu) has chosen to make their /bin/sh be a copy of (or symlink to) /bin/dash. Dash is a recent entrant which is intended to be simple, minimal, and uncomplicated. The problem is, all those words sound nice but they translate to "not having all the features of traditional shells". Since make operates with SHELL=/bin/sh, you are by default using dash on Ubuntu but bash on other Linux.
I'm not a big fan of Ubuntu's decision. I've found dash to be buggy as well as minimal and it's been responsible for many weird make behaviors in my day job. There is an "official" command you can run to switch /bin/sh back to /bin/bash globally (no memory, google for it), or you can hack the link unofficially though that's not recommended. Alternatively, as Rakesh suggested, you can embed SHELL=/bin/bash in the makefile. -David Boyce On Sat, Aug 9, 2014 at 1:28 AM, Rakesh Sharma <[email protected]> wrote: > 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: [email protected] > To: [email protected] > > 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 > [email protected] > https://lists.gnu.org/mailman/listinfo/help-make > _______________________________________________ > Help-make mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-make _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
