|Subject:||Re: Problem with $* and $$*|
|Date:||Fri, 09 Jun 2006 16:27:07 -0700|
|User-agent:||Mozilla Thunderbird 1.0.7 (Windows/20050923)|
PATTON, BILLY (SBCSI) wrote:
My mistake indeed.As one who has recently gone through this These are the changes I would suggest $< to $$<
You mean the first $(SHELL) -ec ?get rid of the shell, It already is in a shell
If I supress it (and the enclosing ' and '), I receive the error:
unexpected EOF while looking for matching `''
I know, but since I override this tens of time I just try to avoid allocating plenty of variables...I would suggest breaking it into small pieces for better readability CPP = $(CXX) -MM $(FINAL_$(1)_CPPFLAGS) $(CXXINCLDIRS) $$<
So, I corrected the $< into $$<, but I still get the same error. Actually, I now found the problem, but I do not know how to solve it:
The command typicalyl results in:
/bin/sh -ec 'g++ -MM -DWINDOWS -Ic:/mingw/local/include/gtkmm-2.4 -Ic:/mingw/local/lib/gtkmm-2.4/include -Ic:/mingw/local/include/glibmm-2.4 -Ic:/mingw/local/lib/glibmm-2.4/include -Ic:/mingw/local/include/gdkmm-2.4 -Ic:/mingw/local/lib/gdkmm-2.4/include -Ic:/mingw/local/include/pangomm-1.4 -Ic:/mingw/local/include/atkmm-1.6 -Ic:/mingw/local/include/gtk-2.0 -Ic:/mingw/local/include/sigc++-2.0 -Ic:/mingw/local/lib/sigc++-2.0/include -Ic:/mingw/local/include/glib-2.0 -Ic:/mingw/local/lib/glib-2.0/include -Ic:/mingw/local/lib/gtk-2.0/include -Ic:/mingw/local/include/pango-1.0 -Ic:/mingw/local/include/atk-1.0 -DALTER_MMX -DALTER_SSE2 -D_REENTRANT -D_GNU_SOURCE -mthreads -mms-bitfields -DALTER_MODULE=common -Isrc/ -Isrc/common/ -I/usr/local/include/1394camera -I/usr/local/include/newmat -I/usr/local/include src/common/Spline.cpp | sed '\''s/\(Spline\)\.o[ :]*/objects\/common_\1.o objects/common_Spline.d : /g'\'' > objects/common_Spline.d'
while this red part should be: objects\/common_Spline.d
So, it seems that my command part that reads $(subst /,\/,$$@) has no effect and merely outputs $$@ withotu replacing the slash. Any idea ? Shall I use a sed command here as well?
-----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
|[Prev in Thread]||Current Thread||[Next in Thread]|