[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Probems building a project after moving header files

From: Angel Tsankov
Subject: Probems building a project after moving header files
Date: Sun, 14 Aug 2005 11:19:16 +0300

I've written a makefile that I use to clean, build and rebuild (i.e. clean & build) a CPP project. I have implemented the following hierarchy:

-the build target depends on output files
-an output file depends on the respective object file
-an object file depends on the respective dependency file (.d file)
-a dependency file depends on the respective .cpp file and the .h files that the .cpp files includes (this rule is generated automatically and is located in the dependency file)

Of course, the main makefile includes all the dependency (make)files. This is done at the end of the main makefile.

BTW, I might not have followed the common or recommended practice. If this is the case, please, tell me where I have done so.

Here comes a problem: I recently had to move a header file from a project to a location where it is available to other projects as well. Then I ran "make" (same as "make build") to check if everything is OK. Unfortunately, it was not - make said it does not know how to build the header file I'd just moved (this header file was a prerequisite of a dependency file). Since I could not come up with a solution how to build the project in this case, I decided that if I move a file I most probably need to REBUILD the project rather than just BUILD it. This is how I decided to delete the dependency files on clean in addition to the output and object files. This led to another problem: cleaning a project more than once in succession causes the dependency files to be regenerated on each cleaning after the first one (which I do not find very appropriate). Besides, rebuilding a project does not regenerate the dependency files after they have been cleaned (?!).

I see that there are even more problematic cases, such as moving a header file from a common location to a "local" location (the reverse to what I have done before). Since this is a very rare situation, I'd rather not bother about it right now unless someone knows how to handle even this.

This is the result of executing 'make -version':
GNU Make 3.81beta3
Copyright (C) 2003  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

This program built for Windows32

How am I supposed to manage these situations?

Angel Tsankov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]