#### Archived

This topic is now archived and is closed to further replies.

# Estimated time remaining in Makefiles

This topic is 5269 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''m busy compiling KDE, and I thought of a really good idea. I don''t know enough about Makefiles to try it myself, but I was thinking that it would be really convenient to have Makefiles with a percentage completed and estimated time remaining. Perhaps there could be something like "make timecalc" which make''s the whole thing and times each command then divides by the total time to get the percentage. It would be really useful for compiling programs like KDE which take hours to compile (and I''d imagine days on really slow systems). We could have the autotools generate this all automatically. Would this be feasible? Zorx (a Puzzle Bobble clone) Discontinuity (an animation system for POV-Ray)

##### Share on other sites
Yes, why not? But maybe a little hard to do in Make. But a few lines of code in a other language can sure do it.

##### Share on other sites
quote:
Original post by clum
We could have the autotools generate this all automatically.

This is actually a great idea. If you know M4 (the language that autotools are based on) then perhaps you could modify it yourself and give the changes to the GNU developers. I think this is completely feasible.

I don’t know of any utilities that let you do this right now, but I know time does keep track of the command execution time and reports it.

##### Share on other sites
If you''re using gentoo (as most people compiling kde are, and other source based distros might have similar tools)

# emerge genlop
# genlop -c

It doesn''t do exactly what you want, but it''s close. It''ll tell you how long the current emerge has been going on for, and if you''ve compiled that package previously it will give you an estimate of how long it''ll take based on the average of previous emerges (unfortunately it doesn''t take into account that different versions of the same thing can take much more/less time than others, and if you''ve ever installed a precompiled version of a package that makes it really inaccurate)

##### Share on other sites
Last time I checked gentoo is the only source-based distro, but I do LFS, which isn''t a distro at all per se. Fine, maybe KDE is not a good example, but even in Slackware most large programs have to be installed from source because binary packages don''t exist for them. For example, last night I was compiling Rosegarden, a music system, which takes a really long time to compile, and I seriously doubt there''s a slackware package for that (though I''m totally guessing - I could be wrong).

Zorx (a Puzzle Bobble clone)
Discontinuity (an animation system for POV-Ray)

##### Share on other sites
Sorcerer/Source Mage/Lunar Linux are all source based distros (though they did originally all start out as Sorcerer), and there might be others too - gentoo much more popular than any other source based distro (and iirc the first?) but not the only one

##### Share on other sites
Speaking of source-based distros... you are not limited to Gentoo for emerge-style portage. If you look at the HOWTO forum, there is a thread that explains how to install Gentoo Portage onto a different Linux distribution.

On topic now: You could change $(CC) to be two commands instead of one. The first command doing some sort of "tick" function that tells the user how many times it''s been executed (out of all possible) and the second actually calling whatever the original$(CC) is.

##### Share on other sites
I''m working on it. But I don''t have too much time right now, and I''m not too good with Makefiles, but maybe I''ll come up with something. Actually, instead of making CC something weird, I was thinking of just changing the actual rules themselves to include something complicated with time{}. Even default rules (like the one to change a C/C++ file into an object file, which is the most common one) can be overrided. The problem I''m grappling with is that though times can be determined for individual targets, I don''t know how to determine which targets will be run (i.e. it could be that some targets don''t need updating) to find the total time. Maybe, at least for the moment until a better solution can be found, I''ll hard code the total time for a make all if all targets need updating and tough luck on the user (for now) if he has already compiled part. Does anyone have suggestions for changes in the method or how to implement this properly?

Zorx (a Puzzle Bobble clone)
Discontinuity (an animation system for POV-Ray)

##### Share on other sites
You can use the command "make -n" to print the rules that would be executed but not actually execute the commands. This should tell you which rules will run.

##### Share on other sites
Wow! That''s really useful - thanks. Now I just have to figure out how to use it.

Zorx (a Puzzle Bobble clone)
Discontinuity (an animation system for POV-Ray)

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633313
• Total Posts
3011321
• ### Who's Online (See full list)

There are no registered users currently online

×