^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ifdef building_out_of_srctree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) quiet_cmd_symlink = SYMLINK $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) extra-y += $(symlinks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) $(addprefix $(obj)/, $(symlinks)): FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) $(call if_changed,symlink)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) quiet_cmd_gen_constants_py = GEN $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) cmd_gen_constants_py = \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) $(CPP) -E -x c -P $(c_flags) $< > $@ ;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) sed -i '1,/<!-- end-c-headers -->/d;' $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) extra-y += constants.py
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) $(obj)/constants.py: $(src)/constants.py.in FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) $(call if_changed_dep,gen_constants_py)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) clean-files := *.pyc *.pyo