Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » how to build a project when Makefile is in subdirectory?
how to build a project when Makefile is in subdirectory? [message #192119] Wed, 30 May 2007 01:07 Go to next message
Eclipse UserFriend
Hello everyone,

I'm kind of new to Eclipse and I am facing a problem with a project that I
imported from my CVS repository as a standard make c++ project (as the
tutorial explained). The project has a Makefile that I created, but it is
not in the root directory but on the src/ subdirectory. Now, when I try to
build the project, nothing happens of course because there is no Makefile
in the root directory. Is there a way to tell Eclipse to run make in a
subdirectory?

Thanks for your help.

a^2
Re: how to build a project when Makefile is in subdirectory? [message #192125 is a reply to message #192119] Wed, 30 May 2007 03:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

Either:

- change the make command in Eclipse to make -C subdirectory
- add a makefile in the project root that invokes make in the subdirectory
--
Derek


Alejandro Aragón wrote:
> Hello everyone,
>
> I'm kind of new to Eclipse and I am facing a problem with a project that
> I imported from my CVS repository as a standard make c++ project (as the
> tutorial explained). The project has a Makefile that I created, but it
> is not in the root directory but on the src/ subdirectory. Now, when I
> try to build the project, nothing happens of course because there is no
> Makefile in the root directory. Is there a way to tell Eclipse to run
> make in a subdirectory?
>
> Thanks for your help.
>
> a^2
>
Re: how to build a project when Makefile is in subdirectory? [message #192195 is a reply to message #192125] Wed, 30 May 2007 13:39 Go to previous messageGo to next message
Eclipse UserFriend
Derek Morris wrote:

> Either:

> - change the make command in Eclipse to make -C subdirectory
> - add a makefile in the project root that invokes make in the subdirectory

I did it the first way and it works fine!
Do you have an example of a Makefile that calls other Makefiles in
subdirectories? I don't really understand how Makefiles work.
Thank you.
Re: how to build a project when Makefile is in subdirectory? [message #192237 is a reply to message #192195] Wed, 30 May 2007 15:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

Here is a really simple example:

DIRS=sub-dir1 sub-dir2 sub-dir3

all::
@for i in ${DIRS}; \
do \
make -C $${i}; \
done

clean::
@for i in ${DIRS}; \
do \
make -C $${i} clean; \
done

HTH
--
Derek


Alejandro Aragón wrote:
> Derek Morris wrote:
>
>> Either:
>
>> - change the make command in Eclipse to make -C subdirectory
>> - add a makefile in the project root that invokes make in the
>> subdirectory
>
> I did it the first way and it works fine!
> Do you have an example of a Makefile that calls other Makefiles in
> subdirectories? I don't really understand how Makefiles work.
> Thank you.
>
Re: how to build a project when Makefile is in subdirectory? [message #192300 is a reply to message #192195] Thu, 31 May 2007 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Alejandro Aragón wrote:
> Do you have an example of a Makefile that calls other Makefiles in
> subdirectories? I don't really understand how Makefiles work.

If make is available on your system the documentation is probably
available too in info pages. Just call "info make" or use another
info browser.

Please note that Makefiles are not only useful for compilation but
also to create other files which have dependencies such as
documentation, ... So you should really learn it.

Jens
Re: how to build a project when Makefile is in subdirectory? [message #192415 is a reply to message #192119] Fri, 01 June 2007 12:09 Go to previous messageGo to next message
Eclipse UserFriend
> in the root directory. Is there a way to tell Eclipse to run make in a
> subdirectory?
You can specify the build directory:
Goto project->properties->C/C++ Make Project->Build Location->Build
directory
Click the button Workspace below the text field. Select the subdirectory
where your Makefile resides.
Re: how to build a project when Makefile is in subdirectory? [message #192446 is a reply to message #192415] Sat, 02 June 2007 18:58 Go to previous messageGo to next message
Eclipse UserFriend
Axel Mueller wrote:

>> in the root directory. Is there a way to tell Eclipse to run make in a
>> subdirectory?
> You can specify the build directory:
> Goto project->properties->C/C++ Make Project->Build Location->Build
> directory
> Click the button Workspace below the text field. Select the subdirectory
> where your Makefile resides.

This is a nice way to do it. The funny thing is that this option (build
directory) was hidden in the window that pops-up after
Project->Preferences. I had to resize that windows for that option to
appear. I'm using Eclipse 3.2.2 on an Ubuntu Linux platform. Is this a bug?

Thanks for helping.

a^2
Re: how to build a project when Makefile is in subdirectory? [message #192710 is a reply to message #192195] Wed, 06 June 2007 15:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: guyen000.gmail.com

simple one, this may work.

all:
./$(YOUSUBDIR)/make all

Make sure there is a tab, not spaces before command
Re: how to build a project when Makefile is in subdirectory? [message #192910 is a reply to message #192446] Fri, 08 June 2007 10:13 Go to previous message
Eclipse UserFriend
Alejandro Aragón wrote:
> This is a nice way to do it. The funny thing is that this option (build
> directory) was hidden in the window that pops-up after
> Project->Preferences. I had to resize that windows for that option to
> appear. I'm using Eclipse 3.2.2 on an Ubuntu Linux platform. Is this a bug?
I never had that problem. I am using Eclipse 3.2.2 on Gentoo with Sun JRE
1.5 (JRE 1.4 and 1.6 also work flawless).

Axel
Previous Topic:CVS Server information
Next Topic:Solaris CC compiled code debug with gdb 5.3
Goto Forum:
  


Current Time: Sat Apr 26 05:23:06 EDT 2025

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

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

Back to the top