diff options
| author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-02-19 04:33:06 -0500 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-02-27 07:41:04 -0500 |
| commit | b513adf45c9bca9222a0533e0c412b66350a8ab5 (patch) | |
| tree | 5aab4a0958fede3ef26f161e1b1013d7227ea4f6 /scripts | |
| parent | 8d2e52003adf45035bc6e94056c68dacf517236b (diff) | |
scripts/gdb: refactor rules for symlink creation
gdb-scripts is not a real object, but (ab)used like a phony target.
Rewrite the code in a more Kbuild-ish way. Add symlinks to extra-y
and use if_changed.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/gdb/linux/Makefile | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile index 754580609360..3df395a9c2ce 100644 --- a/scripts/gdb/linux/Makefile +++ b/scripts/gdb/linux/Makefile | |||
| @@ -1,13 +1,17 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | always := gdb-scripts | ||
| 3 | 2 | ||
| 4 | SRCTREE := $(abspath $(srctree)) | ||
| 5 | |||
| 6 | $(obj)/gdb-scripts: | ||
| 7 | ifneq ($(KBUILD_SRC),) | 3 | ifneq ($(KBUILD_SRC),) |
| 8 | $(Q)ln -fsn $(SRCTREE)/$(obj)/*.py $(objtree)/$(obj) | 4 | |
| 5 | symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) | ||
| 6 | |||
| 7 | quiet_cmd_symlink = SYMLINK $@ | ||
| 8 | cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@ | ||
| 9 | |||
| 10 | extra-y += $(symlinks) | ||
| 11 | $(addprefix $(obj)/, $(symlinks)): FORCE | ||
| 12 | $(call if_changed,symlink) | ||
| 13 | |||
| 9 | endif | 14 | endif |
| 10 | @: | ||
| 11 | 15 | ||
| 12 | quiet_cmd_gen_constants_py = GEN $@ | 16 | quiet_cmd_gen_constants_py = GEN $@ |
| 13 | cmd_gen_constants_py = \ | 17 | cmd_gen_constants_py = \ |
| @@ -18,4 +22,4 @@ extra-y += constants.py | |||
| 18 | $(obj)/constants.py: $(src)/constants.py.in FORCE | 22 | $(obj)/constants.py: $(src)/constants.py.in FORCE |
| 19 | $(call if_changed_dep,gen_constants_py) | 23 | $(call if_changed_dep,gen_constants_py) |
| 20 | 24 | ||
| 21 | clean-files := *.pyc *.pyo $(if $(KBUILD_SRC),*.py) | 25 | clean-files := *.pyc *.pyo |
