-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix compile-database target #59980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+40
−36
Merged
Fix compile-database target #59980
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
01ddd66
Fix compile-database target
fingolfin 515cd82
rename targets creating compile_commands.json and make them phony again
fingolfin ce1d4ad
Try harder to avoid races in compile_commands.json creation
fingolfin 5619b7d
rename
fingolfin 42276dd
Remove debug output
fingolfin a5e6e5b
Nice messages
fingolfin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -259,7 +259,7 @@ endif | |
| default: $(JULIA_BUILD_MODE) # contains either "debug" or "release" | ||
| all: debug release | ||
|
|
||
| release debug: %: libjulia-internal-% libjulia-codegen-% $(BUILDDIR)/compile_commands.json | ||
| release debug: %: libjulia-internal-% libjulia-codegen-% regenerate-compile_commands | ||
|
|
||
| $(BUILDDIR): | ||
| mkdir -p $(BUILDDIR) | ||
|
|
@@ -558,6 +558,7 @@ clean: | |
| -rm -f $(BUILDDIR)/*.dbg.obj $(BUILDDIR)/*.o $(BUILDDIR)/*.dwo $(BUILDDIR)/*.$(SHLIB_EXT) $(BUILDDIR)/*.a $(BUILDDIR)/*.h.gen | ||
| -rm -f $(BUILDDIR)/julia.expmap | ||
| -rm -f $(BUILDDIR)/julia_version.h | ||
| -rm -f $(BUILDDIR)/compile_commands.json | ||
|
|
||
| clean-flisp: | ||
| -$(MAKE) -C $(SRCDIR)/flisp clean BUILDDIR='$(abspath $(BUILDDIR)/flisp)' | ||
|
|
@@ -654,8 +655,10 @@ clean-analyzegc: | |
| rm -f $(build_shlibdir)/libImplicitAtomicsPlugin.$(SHLIB_EXT) | ||
|
|
||
| # Compilation database generation using existing clang infrastructure | ||
| $(BUILDDIR)/compile_commands.json: | ||
| @{ \ | ||
| .PHONY: regenerate-compile_commands | ||
| regenerate-compile_commands: | ||
| TMPFILE=$$(mktemp -p $(BUILDDIR) compile_commands.json.XXXXXX); \ | ||
| { \ | ||
| CLANG_TOOLING_C_FLAGS="$$($(JULIAHOME)/contrib/escape_json.sh clang $(CLANG_TOOLING_C_FLAGS))"; \ | ||
| CLANG_TOOLING_CXX_FLAGS="$$($(JULIAHOME)/contrib/escape_json.sh clang $(CLANG_TOOLING_CXX_FLAGS))"; \ | ||
| echo "["; \ | ||
|
|
@@ -711,18 +714,17 @@ $(BUILDDIR)/compile_commands.json: | |
| printf '{\n "directory": "%s",\n "file": "%s",\n "arguments": [%s]\n}' "$(abspath $(SRCDIR))" "$$included_file" "$$cmd"; \ | ||
| done; \ | ||
| echo "]"; \ | ||
| } > [email protected] | ||
| @# This ensures we replace the file atomically, and avoid spurious rewrites | ||
| @if ! cmp -s [email protected] $@; then \ | ||
| mv [email protected] $@; \ | ||
| } > $$TMPFILE; \ | ||
| if ! cmp -s $$TMPFILE $(BUILDDIR)/compile_commands.json; then \ | ||
| mv $$TMPFILE $(BUILDDIR)/compile_commands.json; \ | ||
| else \ | ||
| rm -f $@.tmp; \ | ||
| rm -f $$TMPFILE; \ | ||
| fi | ||
|
|
||
| compile-database: $(BUILDDIR)/compile_commands.json | ||
| compile-database: regenerate-compile_commands | ||
| $(MAKE) -C $(SRCDIR)/flisp compile-database BUILDDIR='$(abspath $(BUILDDIR)/flisp)' | ||
| $(MAKE) -C $(SRCDIR)/support compile-database BUILDDIR='$(abspath $(BUILDDIR)/support)' | ||
| @echo "Compilation database created: $<" | ||
| @echo "Compilation database created for src" | ||
|
|
||
| .FORCE: | ||
| .PHONY: default all debug release clean cleanall clean-* libccalltest libllvmcalltest julia_flisp.boot.inc.phony analyzegc analyzesrc compile-database $(BUILDDIR)/compile_commands.json .FORCE | ||
| .PHONY: default all debug release clean cleanall clean-* libccalltest libllvmcalltest julia_flisp.boot.inc.phony analyzegc analyzesrc compile-database .FORCE | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,8 +53,8 @@ $(BUILDDIR)/host/Makefile: | |
| @printf "%s\n" 'BUILDING_HOST_TOOLS=1' >> $@ | ||
| @printf "%s\n" 'include $(SRCDIR)/Makefile' >> $@ | ||
|
|
||
| release: $(BUILDDIR)/libsupport.a $(BUILDDIR)/compile_commands.json | ||
| debug: $(BUILDDIR)/libsupport-debug.a $(BUILDDIR)/compile_commands.json | ||
| release: $(BUILDDIR)/libsupport.a regenerate-compile_commands | ||
| debug: $(BUILDDIR)/libsupport-debug.a regenerate-compile_commands | ||
|
|
||
| $(BUILDDIR)/libsupport.a: $(OBJS) | $(BUILDIR) | ||
| rm -rf $@ | ||
|
|
@@ -78,8 +78,10 @@ CLANG_TOOLING_C_FLAGS = $(CLANGSA_FLAGS) $(DEBUGFLAGS_CLANG) $(JCPPFLAGS_CLANG) | |
| INCLUDED_SUPPORT_FILES := hashing.c:MurmurHash3.c | ||
|
|
||
| # Compilation database generation | ||
| $(BUILDDIR)/compile_commands.json: | ||
| @{ \ | ||
| .PHONY: regenerate-compile_commands | ||
| regenerate-compile_commands: | ||
| TMPFILE=$$(mktemp -p $(BUILDDIR) compile_commands.json.XXXXXX); \ | ||
| { \ | ||
| CLANG_TOOLING_S_FLAGS="$$($(JULIAHOME)/contrib/escape_json.sh clang $(JCPPFLAGS) $(DEBUGFLAGS))"; \ | ||
| CLANG_TOOLING_C_FLAGS="$$($(JULIAHOME)/contrib/escape_json.sh clang $(JCPPFLAGS) $(JCFLAGS) $(DEBUGFLAGS))"; \ | ||
| echo "["; \ | ||
|
|
@@ -103,16 +105,15 @@ $(BUILDDIR)/compile_commands.json: | |
| printf '{\n "directory": "%s",\n "file": "%s",\n "arguments": [%s]\n}' "$(abspath $(SRCDIR))" "$$included_file" "$$cmd"; \ | ||
| done; \ | ||
| echo "]"; \ | ||
| } > [email protected] | ||
| @# This ensures we replace the file atomically, and avoid spurious rewrites | ||
| @if ! cmp -s [email protected] $@; then \ | ||
| mv [email protected] $@; \ | ||
| } > $$TMPFILE; \ | ||
| if ! cmp -s $$TMPFILE $(BUILDDIR)/compile_commands.json; then \ | ||
| mv $$TMPFILE $(BUILDDIR)/compile_commands.json; \ | ||
| else \ | ||
| rm -f $@.tmp; \ | ||
| rm -f $$TMPFILE; \ | ||
| fi | ||
|
|
||
| compile-database: $(BUILDDIR)/compile_commands.json | ||
| @echo "Compilation database created in support: $<" | ||
| compile-database: regenerate-compile_commands | ||
| @echo "Compilation database created for src/support" | ||
|
|
||
| clean: | ||
| rm -f $(BUILDDIR)/*.o | ||
|
|
@@ -125,4 +126,4 @@ clean: | |
| rm -f $(BUILDDIR)/compile_commands.json | ||
| rm -f $(BUILDDIR)/host/* | ||
|
|
||
| .PHONY: compile-database $(BUILDDIR)/compile_commands.json | ||
| .PHONY: compile-database | ||
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.
Uh oh!
There was an error while loading. Please reload this page.