Skip to content

Deduplicate build files (Makefile + per-test Makefiles)#176

Merged
ViralBShah merged 1 commit into
mainfrom
cleanup-build-dedup
Jun 6, 2026
Merged

Deduplicate build files (Makefile + per-test Makefiles)#176
ViralBShah merged 1 commit into
mainfrom
cleanup-build-dedup

Conversation

@ViralBShah

Copy link
Copy Markdown
Member

What

Two pieces of pure duplication in the build system:

  1. src/Makefile defined TARGET_LIBRARIES twice, identically — the second copy was dead. Removed it.

  2. Eight test/<name>_test/Makefile files were byte-for-byte identical except for the test name (~100 lines of boilerplate). Replaced with a shared test/test.mk that derives the test name from its directory ($(notdir $(CURDIR))). Each per-test Makefile is now a single line:

    include ../test.mk

Contract preserved

test/common.jl still invokes make -sC test/<name> prefix=... CFLAGS=... LDFLAGS=... and gets $(prefix)/<name>$(EXE) built and run-able. Verified by building the library and compiling/linking a real test binary against it through the new shared rule.

Out of scope (follow-up)

The review also flagged the lack of a pkg-config/CMake config export. That's left for a separate PR: LBT ships per-interface (LP64/ILP64) and per-target headers, so a correct .pc is non-trivial and deserves its own discussion.

Draft for review.

Two pieces of pure duplication in the build system:

- `src/Makefile` defined `TARGET_LIBRARIES` twice, identically. Remove the
  second (dead) copy.

- The eight `test/<name>_test/Makefile` files were byte-for-byte identical
  except for the test name. Replace them with a shared `test/test.mk` that
  derives the test name from its directory (`$(notdir $(CURDIR))`); each
  per-test Makefile is now just `include ../test.mk`.

The test build contract is unchanged: `test/common.jl` still invokes
`make -sC test/<name> prefix=... CFLAGS=... LDFLAGS=...` and gets
`$(prefix)/<name>$(EXE)` built and `run`-able.

Note: the deeper packaging gap from the review (no pkg-config/CMake config
export) is intentionally left for a separate follow-up, since shipping
per-interface/per-target headers makes a correct `.pc` non-trivial.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ViralBShah ViralBShah marked this pull request as ready for review June 6, 2026 16:10
@ViralBShah ViralBShah marked this pull request as draft June 6, 2026 16:13
@ViralBShah ViralBShah marked this pull request as ready for review June 6, 2026 16:17
@ViralBShah ViralBShah merged commit 2789a73 into main Jun 6, 2026
45 checks passed
@ViralBShah ViralBShah deleted the cleanup-build-dedup branch June 6, 2026 16:17
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