help-make
[Top][All Lists]
Advanced

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

Problem with $* and $$*


From: Xavier Marichal
Subject: Problem with $* and $$*
Date: Fri, 09 Jun 2006 10:11:38 -0700
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Hi!

I'm working on a relatively big projects which I'm currently simplifying by using templates (with define, call and eval) in order to have more generic makefiles for the whole project instead of modules specific Makefiles.

So far, I was using the following rules to generate the dependencies (which I store with a particular prefix, hence the sed commands):

$(OBJECT_DIR)%$(DBG_SUFFIX)$(DEP_EXT) : $(FILES_PATH)%$(SRC_EXT)
$(VERBOSE_ECHO) $(SHELL) -ec '$(CXX) -MM $(FINAL_CPPFLAGS) $(CXXINCLDIRS) $< | sed '\''s/\($*\)\.o[ :]*/$(shell echo $(OBJECT_DIR) | sed 's/\//\\\//g')\1$(DBG_SUFFIX).o $(subst /,\/,$@) : /g'\'' > $@'


Now, I'm instantiating this for every one of my modules through a template function. I provide the function with argument 1 about my module name and argument 2 about the location of the sources.
The function then becomes

$(OBJ_DIR)$(1)_%$(DBG_SUFFIX)$(DEP_EXT) : $(2)/%$(SRC_EXT)
$(VERBOSE_ECHO) $(SHELL) -ec '$(CXX) -MM $(FINAL_$(1)_CPPFLAGS) $(CXXINCLDIRS) $< | sed '\''s/\($$*\)\.o[ :]*/$(shell echo $(OBJ_DIR)$(1)_ | sed 's/\//\\\//g')\1$(DBG_SUFFIX).o $(subst /,\/,$$@) : /g'\'' > $$@'

However, I receive a plenty of messages such as:
sed: -e expression #2, char 70: Unknown option to 's'
g++.exe: no input files
g++.exe: no input files
sed: -e expression #2, char 69: Unknown option to 's'
g++.exe: no input files
sed: -e expression #2, char 64: Unknown option to 's'
g++.exe: no input files
sed: -e expression #2, char 74: Unknown option to 's'
g++.exe: no input files
...

The error comes from the stem which is apparently empty instead of providing sed with the file name. I read in the Makefile that it is indeed the problem with $* and $$* when there are two passes as in eval. However, I cannot figure out what I shall use instead.
Anyone can help me?
Many thanks,
Xavier




reply via email to

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