Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Controlling the makefile for Managed Projects
Controlling the makefile for Managed Projects [message #136756] Fri, 28 January 2005 03:49 Go to next message
Eclipse UserFriend
Originally posted by: sramam.gmail.com

Hi,
I have just installed eclipse and CDT.
When attempting to create a managed project,
I kept getting errors would break the compile
with -
g++.exe: no input files
Build error

Finally, I narrowed it down to the following
in the subdir.mk project make file -
%.o: $(ROOT)/%.cpp
@echo 'Building file: $<'
@echo g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $<
@g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $< && \
echo -n $(@:%.o=%.d) '' > $(@:%.o=%.d) && \
g++ -MM -MG -P -w $(addprefix -include,$(AH_SRCS)) \
-O0 -g3 -Wall -c -fmessage-length=0 $< >> $(@:%.o=%.d)
@echo 'Finished building: $<'
@echo ' '

The .d file creation is causing trouble.

I'd apprecitate help with figuring what these are meant for
and how I can control the make file. Changing this rule to

%.o: $(ROOT)/%.cpp
@echo 'Building file: $<'
@echo g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $<
@g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $<
g++ -MM -MG -P -w $(addprefix -include,$(AH_SRCS)) \
-O0 -g3 -Wall -c -fmessage-length=0 $<
@echo 'Finished building: $<'
@echo ' '

seems to solve the problem, but this was tested via the command
line. Every time I build within Eclipse, the file is regenerated
and is causing me grief.

Any help is much appreciated.

thanks,
-shishir
Re: Controlling the makefile for Managed Projects [message #136768 is a reply to message #136756] Fri, 28 January 2005 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Shishir,
The 10000-foot view is that the '.d' files contain additional
source-level dependencies so that make will know to rebuild a file if
one of the headers it includes has changed. For example, simply saying
that foo.o depends on foo.cpp is incorrect if foo.cpp includes foo.h; in
that case you want a dependency line that looks like

foo.o: foo.cpp foo.h

The Gnu makefile generator takes advantage of the GCC preprocessor to
figure out these additional dependencies using the -M<X> flags. The real
problem is that these dependencies have to be specified in the correct
way or subsequent rebuilds will fail. In point of fact, the line above
should look like

foo.d foo.o: foo.cpp foo.h
foo.h:

so the dep file will get regenerated too, and the header file is not
going to cause the build to fail if it is missing (because you deleted
it or moved it).

Post-3.0 versions of the GCC tools have a richer set of flags to
generate these dependencies, but in order to support 2.X versions, the
makefile generator uses 'echo' to prepopulate the file with the right
dependency line, and a post-processing step to make sure the file is
formatted correctly (correct for garbage left behind by echo and add
dummy targets for the header files).

I would be interested to know what environment you are using. I have had
very little success using Mingw without the Msys utilities, since it
relies on Win32 echo (and that doesn't behave the way POSIX echo does).
For that matter, there are variations between some POSIX echo
implementations, but that's another issue.

Let me know what your development environment is and maybe we can narrow
the problem down a bit further.

Sean

Shishir wrote:
> Hi,
> I have just installed eclipse and CDT. When attempting to create a
> managed project, I kept getting errors would break the compile
> with -
> g++.exe: no input files
> Build error
>
> Finally, I narrowed it down to the following in the subdir.mk project
> make file - %.o: $(ROOT)/%.cpp
> @echo 'Building file: $<'
> @echo g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $<
> @g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $< && \
> echo -n $(@:%.o=%.d) '' > $(@:%.o=%.d) && \
> g++ -MM -MG -P -w $(addprefix -include,$(AH_SRCS)) \
> -O0 -g3 -Wall -c -fmessage-length=0 $< >> $(@:%.o=%.d)
> @echo 'Finished building: $<'
> @echo ' '
>
> The .d file creation is causing trouble.
>
> I'd apprecitate help with figuring what these are meant for and how I
> can control the make file. Changing this rule to
> %.o: $(ROOT)/%.cpp
> @echo 'Building file: $<'
> @echo g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $<
> @g++ -O0 -g3 -Wall -c -fmessage-length=0 -o $@ $<
> g++ -MM -MG -P -w $(addprefix -include,$(AH_SRCS)) \
> -O0 -g3 -Wall -c -fmessage-length=0 $< @echo 'Finished
> building: $<'
> @echo ' '
>
> seems to solve the problem, but this was tested via the command line.
> Every time I build within Eclipse, the file is regenerated
> and is causing me grief.
>
> Any help is much appreciated.
> thanks,
> -shishir
>
Re: Controlling the makefile for Managed Projects [message #136804 is a reply to message #136768] Fri, 28 January 2005 10:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sramam.gmail.com

Sean,
Thanks for the response.

> Post-3.0 versions of the GCC tools have a richer set of flags to
> generate these dependencies, but in order to support 2.X versions, the
> makefile generator uses 'echo' to prepopulate the file with the right
> dependency line, and a post-processing step to make sure the file is
> formatted correctly (correct for garbage left behind by echo and add
> dummy targets for the header files).

> I would be interested to know what environment you are using. I have had
> very little success using Mingw without the Msys utilities, since it
> relies on Win32 echo (and that doesn't behave the way POSIX echo does).
> For that matter, there are variations between some POSIX echo
> implementations, but that's another issue.

> Let me know what your development environment is and maybe we can narrow
> the problem down a bit further.

Your supicions are right-on!
WinXP, Eclipse3.0, CDT (actually ACDT - CDT with AspectC++ support built
in)
and the Mingw toolset, without the Msys (the mingw installation is also
very recent - so all 3.x gcc tools)

Is there some way that CDT can control how the dependency information is
generated?

Currently, I am using a batchfile to setup the environment to keep
eclipse/aspectc happy. But this is not going to be enough for built-in
commands like echo.

Thanks for the help.
-shishir
Re: Controlling the makefile for Managed Projects [message #136867 is a reply to message #136804] Fri, 28 January 2005 15:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sramam.gmail.com

Sean,
I took your advice, and started eclipse from an msys shell after setting
up the AspectC path and variables as needed. Looks like I still have the
problem.

Would it be possible to get more information on how the makefile is
generated? Perhaps I can hack it to use the gcc flags for the dependency
generation.

-shishir



In article <ctdlei$u3f$1@www.eclipse.org>, sramam@gmail.com says...
> Sean,
> Thanks for the response.
>
> > Post-3.0 versions of the GCC tools have a richer set of flags to
> > generate these dependencies, but in order to support 2.X versions, the
> > makefile generator uses 'echo' to prepopulate the file with the right
> > dependency line, and a post-processing step to make sure the file is
> > formatted correctly (correct for garbage left behind by echo and add
> > dummy targets for the header files).
>
> > I would be interested to know what environment you are using. I have had
> > very little success using Mingw without the Msys utilities, since it
> > relies on Win32 echo (and that doesn't behave the way POSIX echo does).
> > For that matter, there are variations between some POSIX echo
> > implementations, but that's another issue.
>
> > Let me know what your development environment is and maybe we can narrow
> > the problem down a bit further.
>
> Your supicions are right-on!
> WinXP, Eclipse3.0, CDT (actually ACDT - CDT with AspectC++ support built
> in)
> and the Mingw toolset, without the Msys (the mingw installation is also
> very recent - so all 3.x gcc tools)
>
> Is there some way that CDT can control how the dependency information is
> generated?
>
> Currently, I am using a batchfile to setup the environment to keep
> eclipse/aspectc happy. But this is not going to be enough for built-in
> commands like echo.
>
> Thanks for the help.
> -shishir
>
>
>
Re: Controlling the makefile for Managed Projects [message #136996 is a reply to message #136867] Mon, 31 January 2005 11:17 Go to previous message
Eclipse UserFriend
Shishir,
Sorry it has taken me so long to reply (we're trying to wrap up the
2.1.1 bugs). This is one of those "slippery slope" questions that can
really take a while to answer properly. The short answer is that yes, if
you're willing to dig a bit, you can swap out the default Gnu make
buildfile generator/dependency calculator and replace it with one of
your own design. In fact, since all you want to do is swap out the part
that is causing you trouble, it is probably harder to actually describe
the process than do it.

The document on extending the MBS has a discussion about the buildfile
generation components. You can find it at http://www.eclipse.org/cdt by
following the "Reference Documentation" link. Take a look at that for an
overview and I'll do my best to answer specific questions. All the best,

Sean

sramam wrote:
> Sean,
> I took your advice, and started eclipse from an msys shell after setting
> up the AspectC path and variables as needed. Looks like I still have the
> problem.
>
> Would it be possible to get more information on how the makefile is
> generated? Perhaps I can hack it to use the gcc flags for the dependency
> generation.
>
> -shishir
>
>
>
> In article <ctdlei$u3f$1@www.eclipse.org>, sramam@gmail.com says...
>
>>Sean,
>>Thanks for the response.
>>
>>
>>>Post-3.0 versions of the GCC tools have a richer set of flags to
>>>generate these dependencies, but in order to support 2.X versions, the
>>>makefile generator uses 'echo' to prepopulate the file with the right
>>>dependency line, and a post-processing step to make sure the file is
>>>formatted correctly (correct for garbage left behind by echo and add
>>>dummy targets for the header files).
>>
>>>I would be interested to know what environment you are using. I have had
>>>very little success using Mingw without the Msys utilities, since it
>>>relies on Win32 echo (and that doesn't behave the way POSIX echo does).
>>>For that matter, there are variations between some POSIX echo
>>>implementations, but that's another issue.
>>
>>>Let me know what your development environment is and maybe we can narrow
>>>the problem down a bit further.
>>
>>Your supicions are right-on!
>>WinXP, Eclipse3.0, CDT (actually ACDT - CDT with AspectC++ support built
>>in)
>>and the Mingw toolset, without the Msys (the mingw installation is also
>>very recent - so all 3.x gcc tools)
>>
>>Is there some way that CDT can control how the dependency information is
>>generated?
>>
>>Currently, I am using a batchfile to setup the environment to keep
>>eclipse/aspectc happy. But this is not going to be enough for built-in
>>commands like echo.
>>
>>Thanks for the help.
>>-shishir
>>
>>
>>
Previous Topic:Error within debug ui
Next Topic:AllTypesCache and TypeSearchScope?
Goto Forum:
  


Current Time: Mon Jul 14 16:20:13 EDT 2025

Powered by FUDForum. Page generated in 0.05031 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top