Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to change make location in Eclipse

📅 2014-Jan-15 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ eclipse, make, makefile ⬩ 📚 Archive

One of the easiest ways to use existing C++ code in Eclipse is to use the Makefile project. This enables you to use the existing source files right from where they are. However, Eclipse assumes that the Makefile location is at the root of the directory you used to create the project.

Configuring Eclipse to use a Makefile that is located somewhere else in the project directory is easy:

  1. Go to Project > Properties > C/C++ Build

  2. In the Builder Settings > Build location > Build directory entry, you will find ${workspace_loc:/foobar} by default. Here foobar is an example project name. By default, when you build this project, Eclipse will run make from this directory.

  3. To configure Eclipse to use the Makefile that is a different location inside the project directory, change this entry. For example, if my Makefile is located in a build subdirectory, then I can change this to ${workspace_loc:/foobar}/build

That is it! You should be able to build your Makefile project no matter where the file is located now 😊

Tried with: Eclipse 3.7.2 and Ubuntu 12.04 LTS