Bug 406485 - Makefile generator problem
Summary: Makefile generator problem
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-24 15:40 EDT by Piotr Nycz CLA
Modified: 2020-09-04 15:21 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Nycz CLA 2013-04-24 15:40:35 EDT
Makefile generation.

For CDT ( C++ projects ) if there is many projects created in one workspace, there is possibility to import *.cpp files from one project to another ( just adding *.cpp files to build ). Such import can be done by physically copying files or just setting links to files from one project to another in the same workspace. The makefile generated automatically for project where files were imported from another projects as links (not copied from one project directory to another) contains the compilation commands similar to belows:

g++ -I../../proj_directory/src -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/file_name.d" -MT"src/file_name.d" -o "src/file_name.o" "../src/file_name.cpp"   

where proj_directory is directory where the files are imported from, file_name is file name.

Problem is with section CPP_SRCS in file subdir.mk in ../destination_project/Debug/src, of projects where files were imported to. All imported files have always set the absolute path. Namely NOT as above ../../proj_directory/... but /root_dir/some_directory/eclipse_workspace/proj_directory/src/file_name.cpp etc.

Such project located in workspace copied to another machine must either be located in identical directory structure or eclipse must be run which fixes makefile in during first build ( eclipse adjusts the absolute file paths of CPP_SRCS section to new directory structure ). After this "auto fix" done by eclipse the builds can be done by make all without running eclipse. But first time is neccesary.

If CPP_SRCS would contain relative paths ../../proj_directory/src_file_name.cpp then the workspace could be copied ( or imported from archive ) to another machine and project could be compiled by "make all" wihout eclipse.

-- Configuration Details --
Product: Eclipse 1.5.1.20120828-0743 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.platform 4.2.1.v20120814-120134-9JF7BHVGFyMveli1uX6aTH0q-eAap6PAgOP5mO