blob: 12475508751082064b823da637853a9d10797647 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001# SPDX-License-Identifier: GPL-2.0
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002
David Brazdil0f672f62019-12-10 10:32:29 +00003ifdef building_out_of_srctree
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004
David Brazdil0f672f62019-12-10 10:32:29 +00005symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
6
7quiet_cmd_symlink = SYMLINK $@
8 cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@
9
10extra-y += $(symlinks)
11$(addprefix $(obj)/, $(symlinks)): FORCE
12 $(call if_changed,symlink)
13
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000014endif
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000015
16quiet_cmd_gen_constants_py = GEN $@
17 cmd_gen_constants_py = \
18 $(CPP) -E -x c -P $(c_flags) $< > $@ ;\
19 sed -i '1,/<!-- end-c-headers -->/d;' $@
20
David Brazdil0f672f62019-12-10 10:32:29 +000021extra-y += constants.py
22$(obj)/constants.py: $(src)/constants.py.in FORCE
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000023 $(call if_changed_dep,gen_constants_py)
24
David Brazdil0f672f62019-12-10 10:32:29 +000025clean-files := *.pyc *.pyo