Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-03-2007, 07:57 AM   #1
LQ Newbie
Registered: May 2006
Posts: 11

Rep: Reputation: 0
Question gnu make recompiles the source files fully even though the files are not modified

GNU Make recompiles the source files completely each time make command is issued, compilation is taking place fully eventhough the files are not modified.
Please help me to sort out this problem so that i can save more time in compilation process.
Old 02-03-2007, 03:49 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
This is from the GNU Make Manual, section 9.4
9.4 Avoiding Recompilation of Some Files
Sometimes you may have changed a source file but you do not want to recompile all the files that depend on it. For example, suppose you add a macro or a declaration to a header file that many other files depend on. Being conservative, make assumes that any change in the header file requires recompilation of all dependent files, but you know that they do not need to be recompiled and you would rather not waste the time waiting for them to compile.
If you anticipate the problem before changing the header file, you can use the `-t' flag. This flag tells make not to run the commands in the rules, but rather to mark the target up to date by changing its last-modification date. You would follow this procedure:
Use the command `make' to recompile the source files that really need recompilation, ensuring that the object files are up-to-date before you begin.
Make the changes in the header files.
Use the command `make -t' to mark all the object files as up to date. The next time you run make, the changes in the header files will not cause any recompilation.
If you have already changed the header file at a time when some files do need recompilation, it is too late to do this. Instead, you can use the `-o file' flag, which marks a specified file as “old” (see Summary of Options). This means that the file itself will not be remade, and nothing else will be remade on its account. Follow this procedure:
Recompile the source files that need compilation for reasons independent of the particular header file, with `make -o headerfile'. If several header files are involved, use a separate `-o' option for each header file.
Touch all the object files with `make -t'.
Old 02-06-2007, 09:42 AM   #3
LQ Newbie
Registered: May 2006
Posts: 11

Original Poster
Rep: Reputation: 0

Thanks for your suggestion. Even i have seen the same reference you mentioned before posting this.

I builded the Make 3.81 as per the steps like
1. configure
2. make
3. make install

I'm having a doubt whether i need to mention anything more during configuration.

This problem i'm facing in AIX 5.3
Old 02-06-2007, 11:02 PM   #4
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
the Makefile has to specify the dependancies to each object
Old 02-07-2007, 07:36 AM   #5
LQ Newbie
Registered: May 2006
Posts: 11

Original Poster
Rep: Reputation: 0

The same makefile is working fine in Solaris and HP.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to list all files modified in last N days sneakyimp Linux - General 3 07-28-2006 01:16 PM
files modified by adduser flying-tuxman Linux - Newbie 1 01-07-2006 08:48 PM
CVS files modified between 2 tags chipix Programming 2 07-20-2004 07:51 AM
Files modified by switchdesk benjaminrtz Linux - General 1 01-25-2003 11:05 AM
How would you check which files had been modified? entm Linux - General 1 05-14-2002 10:11 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration