[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problem with $* and $$*
From: |
PATTON, BILLY \(SBCSI\) |
Subject: |
RE: Problem with $* and $$* |
Date: |
Fri, 9 Jun 2006 12:40:21 -0500 |
As one who has recently gone through this These are the changes I would
suggest
$< to $$<
get rid of the shell, It already is in a shell
I would suggest breaking it into small pieces for better readability
CPP = $(CXX) -MM $(FINAL_$(1)_CPPFLAGS) $(CXXINCLDIRS) $$<
$(OBJ_DIR)$(1)_%$(DBG_SUFFIX)$(DEP_EXT) : $(2)/%$(SRC_EXT)
$(VERBOSE_ECHO) $(SHELL) -ec '$(CPP) | sed '\''s/\($$*\)\.o[
:]*/$(shell echo $(OBJ_DIR)$(1)_ | sed 's/\//\\\//g')\1$(DBG_SUFFIX).o
$(subst /,\/,$$@) : /g'\'' > $$@'
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf
> Of Xavier Marichal
> Sent: Friday, June 09, 2006 12:12 PM
> To: address@hidden
> Subject: Problem with $* and $$*
>
>
> 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
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>