Long time, and "make"

Aug 06, 2010 13:48

It's been over a month since I've logged a journal entry here. Life is changing a lot, and I am having difficulties keeping up with it. Compound that with multiple major computer hardware failures in the last two weeks and a visit from my parents and you'll see why I've been too frazzled to write.

So I've got a simple topic today: Gnu "make." More accurately, I modified my main project's Makefile to do most of its work in a "build" subdirectory, and only write the final library and executable in the main directory (with all the code). But after this change, when I run "make" it somewhat arbitrarily decides which component object files need to be remade---and it doesn't depend on time stamps.

Check this. "make -d -n" [corrected] writes the dependency tree for your Makefile---a great way to learn why "make" is doing what it does. Here's what I get:

[dozen pages of blah]
Prerequisite `build/Bem.o' is older than target `libOmegaFlow.a'.
Prerequisite `build/Shedding.o' is newer than target `libOmegaFlow.a'.
[more blah]
Prerequisite `Makefile' is older than target `libOmegaFlow.a'.
Must remake target `libOmegaFlow.a'.
ar rcs libOmegaFlow.a build/*.o slatec/*.o naca/*.o
Successfully remade target file `libOmegaFlow.a'.
Pruning file `Makefile'.
Finished prerequisites of target file `RunMe'.
Prerequisite `Main.F90' is older than target `RunMe'.
Prerequisite `libOmegaFlow.a' is newer than target `RunMe'.
Prerequisite `Makefile' is older than target `RunMe'.
Must remake target `RunMe'.
This is pretty clear: I need to remake RunMe, and to do that I need to remake libOmegaFlow.a. But, that's not all. See what "ls -l --full-time" (which displays the full nanosecond file timestamp) shows:

$ ls -l --full-time RunMe Makefile libOmegaFlow.a Main.F90 build/Bem.o build/Shedding.o
-rw-rw-r--. 1 mstock mstock 268944 2010-08-06 13:11:06.710974157 -0400 build/Bem.o
-rw-rw-r--. 1 mstock mstock 31392 2010-08-06 13:26:18.171224887 -0400 build/Shedding.o
-rw-rw-r--. 1 mstock mstock 20240348 2010-08-06 13:26:22.128939501 -0400 libOmegaFlow.a
-rw-rw-r--. 1 mstock mstock 22827 2010-08-06 12:40:24.792855805 -0400 Main.F90
-rw-rw-r--. 1 mstock mstock 25966 2010-08-06 13:10:58.152974325 -0400 Makefile
-rwxrwxr-x. 1 mstock mstock 16499157 2010-08-06 13:26:22.363890985 -0400 RunMe
Yeah. So I might have found a bug in Gnu make. F'ing Gnu make.

And this, a day after I retweet something about how "make" is much easier than "ant."
Previous post Next post
Up