Enable parallel compilation by splitting targets per architecture - #2097
Merged
Conversation
builds by splitting targets by architecture - Add NPROCS/MAKEFLAGS for automatic parallelization - Split linux target into linux-amd64 and linux-arm64 - Split darwin target into darwin-amd64 and darwin-arm64 - Add build dependencies to package-prepare-* targets - Exclude build-profile* from check_secrets Build time improvement: ~12x faster (74s -> 6s for linux)
okankoAMZ
added a commit
that referenced
this pull request
Apr 22, 2026
jefchien
pushed a commit
that referenced
this pull request
Apr 22, 2026
okankoAMZ
marked this pull request as ready for review
April 23, 2026 15:30
jefchien
reviewed
Apr 23, 2026
jefchien
reviewed
Apr 23, 2026
jefchien
reviewed
Apr 23, 2026
jefchien
approved these changes
Apr 23, 2026
JayPolanco
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Makefile builds all architectures sequentially within each platform target. On a multi-core machine,
make amazon-cloudwatch-agent-linuxtook ~75s because amd64 and arm64 binaries were compiled one after the other.Changes
Split build targets by architecture and enable automatic parallel builds:
MAKEFLAGS += -j4for automatic parallelization (4 parallel jobs)amazon-cloudwatch-agent-linuxintoamazon-cloudwatch-agent-linux-amd64+amazon-cloudwatch-agent-linux-arm64sub-targetsamazon-cloudwatch-agent-darwinintoamazon-cloudwatch-agent-darwin-amd64+amazon-cloudwatch-agent-darwin-arm64sub-targetspackage-prepare-*targets to prevent race conditionsBefore
After
Tests
Local benchmarks (32-core machine)
amazon-cloudwatch-agent-linuxmake build(all platforms)CI benchmarks (non-cached, vs run #1679)
Backwards compatibility
All existing top-level targets (
make build,make release,make amazon-cloudwatch-agent-linux, etc.) are preserved — fully backwards compatible.