Skip to content

src/Makefile: build lib before the other directories so make -jN works - #65

Open
smyrgl wants to merge 1 commit into
PrideLab:masterfrom
smyrgl:make-parallel-lib-first
Open

smyrgl wants to merge 1 commit into
PrideLab:masterfrom
smyrgl:make-parallel-lib-first

Conversation

@smyrgl

@smyrgl smyrgl commented Sep 16, 2026

Copy link
Copy Markdown

Problem: Running make -jN in src/ starts the sub-directories concurrently. Every directory except lib links ../lib/libcom.a, but the top-level Makefile declares no dependency between the sub-directory targets, so with make -j8 six of them fail before lib has finished:

make[1]: *** No rule to make target `../lib/libcom.a', needed by `sp3orb'.  Stop.
make[1]: *** No rule to make target `get_ctrl', needed by `all'.  Stop.
make: *** [orbit] Error 2
make: *** [utils] Error 2
make: *** [redig] Error 2
make: *** [arsig] Error 2
make: *** [tedit] Error 2
make: *** [lsq] Error 2

install.sh runs a serial make, so the documented install path is not affected; this only bites people building by hand or in CI.

Fix: One dependency line: every other directory depends on lib. The per-directory make -j4 stays parallel.

Verified: Clean make -j8 followed by make install on Ubuntu 24.04 (gfortran 13.3, about 5 s wall) and on macOS (Homebrew gfortran 16): all 11 executables build. A serial make behaves as before.

Every directory except lib links ../lib/libcom.a, but the top-level
Makefile declared no dependency between the sub-directory targets, so a
parallel top-level build (make -j8) started them all at once and utils,
orbit, tedit, lsq, redig and arsig failed with "No rule to make target
../lib/libcom.a". install.sh runs a serial make and was not affected.

Declaring that every other directory depends on lib restores the ordering
while keeping the per-directory builds parallel. Verified with a clean
make -j8 on Ubuntu 24.04 (gfortran 13) and on macOS (Darwin 27, Homebrew
gfortran 16): all 11 executables build.
@smyrgl
smyrgl marked this pull request as ready for review September 16, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant