Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have recorded that it took 50 minutes for an initial compilation of the OpenWrt firmware image, assuming all the necessary packages have been installed via sudo apt-get install. My BuildRoot Root Dir is openwrt.

Subsequently, I found that if I rename the directory above the openwrt folder, with a minor change in a file say wifi.lua the next make (in openwrt folder) takes 21 minutes to compile successfully.

However, if I don't rename the directory above the openwrt folder, with a similar minor change in the same file, the next make V=99 takes only 3 minutes to compile successfully.

When I now rename the directory above and do the same as above again, the make takes 21 minutes to compile successfully. With make V=99, I can see that there were many more compilation steps taken compared to the case where I did not rename the top directory.

I can see that the Makefile compilation is much faster if I do not rename the top directory.

This brings me to the related question: In Linux, will renaming or moving a directory change the times of the files in subdirectories?

I know that the Makefile does not build a target again if the modification time of the target is more recent than all its dependencies.

I was also reading about some issues with the GNU Makefile: http://www.conifersystems.com/whitepapers/gnu-make/

Does the OpenWrt Makefile, supposed to be much more advanced than the original Linux Makefile, address some or all of these issues?

(To get the Makefile to compile faster, I also have the openwrt/dl as a symbolic link to a folder in my home directory, so that the user-space package tarballs don't need to be downloaded again.)

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

No, it doesn't change the timestamps of contained files and directories, only on the directory itself. However, if the Makefile contains targets or dependencies that use absolute paths or even just $(src_dir) it will remake them, b/c it's a different/new target. See the GNU make documentation for conventions and advice on "standard" targets and variables.

However, Makefiles don't compile and there is no such thing as the original Linux Makefile. Creating/maintaining an environment like BuildRoot is very complex and the maintainers probably focus on getting it to build correctly before efficiently. If a simple patch, like adding a symlink helps to speed up the process, maybe you should send it as a suggestion for improvement upstream.

share|improve this answer
add comment

You could run make with the jobs option, from man make:

-j [jobs], --jobs[=jobs]
Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.