Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Adding variable to standard makefile
Adding variable to standard makefile [message #108525] Thu, 01 July 2004 16:26 Go to next message
Eclipse UserFriend
Originally posted by: Juan.Abreu.spirentcom.com

Hello All,
I'm using the recent 3.0.0 Eclipse release with CDT 2.0M9. How can I
get/use ${project_name} in a standard Makefile? Is there a way to get the
build configuration into the Makefile (e.g. "Debug" or "Release")? Thanks
in advance.
Cheers,
Juan
Re: Adding variable to standard makefile [message #110339 is a reply to message #108525] Mon, 12 July 2004 08:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Juan.Abreu.spirentcom.com

Hello once again,
Perhaps I need to add more detail ... I am actually building my C++ projects
with scons. I am calling scons from a makefile and could use information
such as project name and configuration to tune my build scripts.

Does anyone know the answer to my question? If it is an incredibly stupid
question and is inappropriate for this groups discussion please let me know
of a more appropriate place to post. Any feedback would be nice.
Juan

"Juan C. Abreu" <Juan.Abreu@spirentcom.com> wrote in message
news:cc1rvt$9if$1@eclipse.org...
> Hello All,
> I'm using the recent 3.0.0 Eclipse release with CDT 2.0M9. How can I
> get/use ${project_name} in a standard Makefile? Is there a way to get the
> build configuration into the Makefile (e.g. "Debug" or "Release")? Thanks
> in advance.
> Cheers,
> Juan
>
>
Re: Adding variable to standard makefile [message #110352 is a reply to message #110339] Mon, 12 July 2004 08:49 Go to previous messageGo to next message
Eclipse UserFriend
Well, as you stated, you write the Makefile yourself.

Why not use the following approach:

TARGET = mytarget.exe

all: # Build release version
@echo "Building the Release"
$(MAKE) "C_DEBUG=" $(TARGET)
@echo "Building the Release"

debug: # Build Debug version
@echo "Building the Release"
$(MAKE) "C_DEBUG=" $(TARGET)
@echo "Building the Release"

$(TARGET): $(TARGET_OBJS)
$(CXX) -o $@ $^ $(LDFLAGS)

%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<

# add file dependencies here or include autogenerated

Juan C. Abreu wrote:
> Hello once again,
> Perhaps I need to add more detail ... I am actually building my C++ projects
> with scons. I am calling scons from a makefile and could use information
> such as project name and configuration to tune my build scripts.
>
> Does anyone know the answer to my question? If it is an incredibly stupid
> question and is inappropriate for this groups discussion please let me know
> of a more appropriate place to post. Any feedback would be nice.
> Juan
>
> "Juan C. Abreu" <Juan.Abreu@spirentcom.com> wrote in message
> news:cc1rvt$9if$1@eclipse.org...
>
>>Hello All,
>>I'm using the recent 3.0.0 Eclipse release with CDT 2.0M9. How can I
>>get/use ${project_name} in a standard Makefile? Is there a way to get the
>>build configuration into the Makefile (e.g. "Debug" or "Release")? Thanks
>>in advance.
>>Cheers,
>>Juan
>>
>>
>
>
>
Re: Adding variable to standard makefile [message #110616 is a reply to message #110352] Wed, 14 July 2004 08:23 Go to previous message
Eclipse UserFriend
Originally posted by: Juan.Abreu.spirentcom.com

Thank you for the feedback. Via CDT in Eclipse you can choose to build
configurations such as "Release" or "Debug". The difference is usually
optimization and debug level. Since I am indeed writing my own makefile and
trying to keep it common for all build configurations, I need to be able to
pick up the current selection from the CDT environment. For example, if I
select my project properties and then select the "Release" configuration,
I'd like to be able to pick this information up in my makefile. Eclipse or
CDT handle building per configuration by having a unique makefile per build
configuration directory. I'd like to have one common makefile and
dynamically choose which configuration to build based on the present build
configuration chosen in CDT.

I hope this makes some sense. Thanks for your help.
Juan
"kesselhaus" <kesselhaus@gmx.net> wrote in message
news:ccu1b3$shq$1@eclipse.org...
> Well, as you stated, you write the Makefile yourself.
>
> Why not use the following approach:
>
> TARGET = mytarget.exe
>
> all: # Build release version
> @echo "Building the Release"
> $(MAKE) "C_DEBUG=" $(TARGET)
> @echo "Building the Release"
>
> debug: # Build Debug version
> @echo "Building the Release"
> $(MAKE) "C_DEBUG=" $(TARGET)
> @echo "Building the Release"
>
> $(TARGET): $(TARGET_OBJS)
> $(CXX) -o $@ $^ $(LDFLAGS)
>
> %.o: %.cpp
> $(CXX) $(CXXFLAGS) -o $@ -c $<
>
> # add file dependencies here or include autogenerated
>
> Juan C. Abreu wrote:
> > Hello once again,
> > Perhaps I need to add more detail ... I am actually building my C++
projects
> > with scons. I am calling scons from a makefile and could use
information
> > such as project name and configuration to tune my build scripts.
> >
> > Does anyone know the answer to my question? If it is an incredibly
stupid
> > question and is inappropriate for this groups discussion please let me
know
> > of a more appropriate place to post. Any feedback would be nice.
> > Juan
> >
> > "Juan C. Abreu" <Juan.Abreu@spirentcom.com> wrote in message
> > news:cc1rvt$9if$1@eclipse.org...
> >
> >>Hello All,
> >>I'm using the recent 3.0.0 Eclipse release with CDT 2.0M9. How can I
> >>get/use ${project_name} in a standard Makefile? Is there a way to get
the
> >>build configuration into the Makefile (e.g. "Debug" or "Release")?
Thanks
> >>in advance.
> >>Cheers,
> >>Juan
> >>
> >>
> >
> >
> >
Previous Topic:Cannot check out C files from CVS in new C-project
Next Topic:How to log debugger output
Goto Forum:
  


Current Time: Fri Apr 25 22:47:50 EDT 2025

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

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

Back to the top