Skip to content

[NFC] Makefile.defs: Improve omptest search path building#2233

Merged
mhalk merged 2 commits into
ROCm:aomp-devfrom
mhalk:amd/dev/mhalkenh/fix/omptest-makefile-path-improvement
May 29, 2026
Merged

[NFC] Makefile.defs: Improve omptest search path building#2233
mhalk merged 2 commits into
ROCm:aomp-devfrom
mhalk:amd/dev/mhalkenh/fix/omptest-makefile-path-improvement

Conversation

@mhalk
Copy link
Copy Markdown
Contributor

@mhalk mhalk commented May 27, 2026

Use clang -print-resource-dir instead of manual path building

  • supported since at least version 18 of clang

Motivation

Direct improvement.
Found out about the -print-resource-dir flag and current path building is somewhat error prone.

Technical Details

This change should behave roughly as before with the difference of being maintained by upstream.

Test Plan

Few manual runs with omptest-based smoke tests.

Test Result

Headers were discovered as before.

Submission Checklist

Use `clang -print-resource-dir` instead of manual path building
 - supported since at least version 18 of clang
Comment thread test/Makefile.defs
# ompTest: Set header include path + linker flag for corresponding OMPT tests
CLANG_VERSION := $(lastword $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(AOMP)/lib/clang/*/))))))
OMPTEST = -I$(AOMP)/lib/clang/$(CLANG_VERSION)/include/omptest -lomptest
CLANG_RESOURCE_DIR := $(shell $(AOMP)/bin/clang -print-resource-dir)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check if clang exists here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!
AFAICT that check is done here: Makefile.defs#L44-L69
And we e.g. rely on the presence of clang here: Makefile.defs#L71

Copy link
Copy Markdown
Contributor

@Kewen12 Kewen12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mhalk mhalk merged commit a97ce01 into ROCm:aomp-dev May 29, 2026
1 check passed
@mhalk mhalk deleted the amd/dev/mhalkenh/fix/omptest-makefile-path-improvement branch May 29, 2026 18:25
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.

2 participants