Fossil SCM
Rework the elimination of the trailing comma in compile_commands.json to be more platform-portable.
Commit
49c53e0bb8ca7db1e1411e412e9541adb0619142f7e2bf5f062c6b6cab320e8c
Parent
e330509cd4b02a9…
2 files changed
+2
-2
+2
-2
+2
-2
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -2153,12 +2153,12 @@ | ||
| 2153 | 2153 | # |
| 2154 | 2154 | # This obscure sed bit ensures that the resulting JSON array does not |
| 2155 | 2155 | # have a trailing comma. |
| 2156 | 2156 | $(compile_commands.json): $(OBJ) |
| 2157 | 2157 | @-rm -f $@ |
| 2158 | - sed -e '1s/^/[''\n''/' -e '$$s/,$$/''\n'']/' $(compile-commands-dir)/*.o.json > $@+ | |
| 2159 | - @if test -s $@+; then mv $@+ $@; else rm -f $@+; fi | |
| 2158 | + @{ echo '['; cat $(compile-commands-dir)/*.o.json | tr '\n' ' ' | sed -e 's/, $$//'; echo ']'; } > $@ | |
| 2159 | + @echo "Generated $@" | |
| 2160 | 2160 | compile-commands.no: |
| 2161 | 2161 | compile-commands.yes: $(compile_commands.json) |
| 2162 | 2162 | all: compile-commands.$(MAKE_COMPILATION_DB) |
| 2163 | 2163 | clean: compile-commands-clean |
| 2164 | 2164 | compile-commands-clean: |
| 2165 | 2165 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -2153,12 +2153,12 @@ | |
| 2153 | # |
| 2154 | # This obscure sed bit ensures that the resulting JSON array does not |
| 2155 | # have a trailing comma. |
| 2156 | $(compile_commands.json): $(OBJ) |
| 2157 | @-rm -f $@ |
| 2158 | sed -e '1s/^/[''\n''/' -e '$$s/,$$/''\n'']/' $(compile-commands-dir)/*.o.json > $@+ |
| 2159 | @if test -s $@+; then mv $@+ $@; else rm -f $@+; fi |
| 2160 | compile-commands.no: |
| 2161 | compile-commands.yes: $(compile_commands.json) |
| 2162 | all: compile-commands.$(MAKE_COMPILATION_DB) |
| 2163 | clean: compile-commands-clean |
| 2164 | compile-commands-clean: |
| 2165 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -2153,12 +2153,12 @@ | |
| 2153 | # |
| 2154 | # This obscure sed bit ensures that the resulting JSON array does not |
| 2155 | # have a trailing comma. |
| 2156 | $(compile_commands.json): $(OBJ) |
| 2157 | @-rm -f $@ |
| 2158 | @{ echo '['; cat $(compile-commands-dir)/*.o.json | tr '\n' ' ' | sed -e 's/, $$//'; echo ']'; } > $@ |
| 2159 | @echo "Generated $@" |
| 2160 | compile-commands.no: |
| 2161 | compile-commands.yes: $(compile_commands.json) |
| 2162 | all: compile-commands.$(MAKE_COMPILATION_DB) |
| 2163 | clean: compile-commands-clean |
| 2164 | compile-commands-clean: |
| 2165 |
+2
-2
| --- tools/makemake.tcl | ||
| +++ tools/makemake.tcl | ||
| @@ -603,12 +603,12 @@ | ||
| 603 | 603 | # |
| 604 | 604 | # This obscure sed bit ensures that the resulting JSON array does not |
| 605 | 605 | # have a trailing comma. |
| 606 | 606 | $(compile_commands.json): $(OBJ) |
| 607 | 607 | @-rm -f $@ |
| 608 | - sed -e '1s/^/[''\n''/' -e '$$s/,$$/''\n'']/' $(compile-commands-dir)/*.o.json > $@+ | |
| 609 | - @if test -s $@+; then mv $@+ $@; else rm -f $@+; fi | |
| 608 | + @{ echo '['; cat $(compile-commands-dir)/*.o.json | tr '\n' ' ' | sed -e 's/, $$//'; echo ']'; } > $@ | |
| 609 | + @echo "Generated $@" | |
| 610 | 610 | compile-commands.no: |
| 611 | 611 | compile-commands.yes: $(compile_commands.json) |
| 612 | 612 | all: compile-commands.$(MAKE_COMPILATION_DB) |
| 613 | 613 | clean: compile-commands-clean |
| 614 | 614 | compile-commands-clean: |
| 615 | 615 |
| --- tools/makemake.tcl | |
| +++ tools/makemake.tcl | |
| @@ -603,12 +603,12 @@ | |
| 603 | # |
| 604 | # This obscure sed bit ensures that the resulting JSON array does not |
| 605 | # have a trailing comma. |
| 606 | $(compile_commands.json): $(OBJ) |
| 607 | @-rm -f $@ |
| 608 | sed -e '1s/^/[''\n''/' -e '$$s/,$$/''\n'']/' $(compile-commands-dir)/*.o.json > $@+ |
| 609 | @if test -s $@+; then mv $@+ $@; else rm -f $@+; fi |
| 610 | compile-commands.no: |
| 611 | compile-commands.yes: $(compile_commands.json) |
| 612 | all: compile-commands.$(MAKE_COMPILATION_DB) |
| 613 | clean: compile-commands-clean |
| 614 | compile-commands-clean: |
| 615 |
| --- tools/makemake.tcl | |
| +++ tools/makemake.tcl | |
| @@ -603,12 +603,12 @@ | |
| 603 | # |
| 604 | # This obscure sed bit ensures that the resulting JSON array does not |
| 605 | # have a trailing comma. |
| 606 | $(compile_commands.json): $(OBJ) |
| 607 | @-rm -f $@ |
| 608 | @{ echo '['; cat $(compile-commands-dir)/*.o.json | tr '\n' ' ' | sed -e 's/, $$//'; echo ']'; } > $@ |
| 609 | @echo "Generated $@" |
| 610 | compile-commands.no: |
| 611 | compile-commands.yes: $(compile_commands.json) |
| 612 | all: compile-commands.$(MAKE_COMPILATION_DB) |
| 613 | clean: compile-commands-clean |
| 614 | compile-commands-clean: |
| 615 |