xref: /linux/tools/testing/selftests/exec/Makefile (revision 0f71241a8e32baf9ac290cf915bc9b3ff265f7d3)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
2c9b26b81SDavid DrysdaleCFLAGS = -Wall
34e7301e6SAlexey DobriyanCFLAGS += -Wno-nonnull
44e7301e6SAlexey DobriyanCFLAGS += -D_GNU_SOURCE
5c9b26b81SDavid Drysdale
6*0f71241aSKees CookTEST_PROGS := binfmt_script non-regular
780d443e8Sbamvor.zhangjian@huawei.comTEST_GEN_PROGS := execveat
861016db1SKees CookTEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
980d443e8Sbamvor.zhangjian@huawei.com# Makefile is a run-time dependency, since it's accessed by the execveat test
1080d443e8Sbamvor.zhangjian@huawei.comTEST_FILES := Makefile
1180d443e8Sbamvor.zhangjian@huawei.com
124e7301e6SAlexey DobriyanTEST_GEN_PROGS += recursion-depth
134e7301e6SAlexey Dobriyan
14*0f71241aSKees CookEXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx*	\
15*0f71241aSKees Cook	       $(OUTPUT)/S_I*.test
1680d443e8Sbamvor.zhangjian@huawei.com
1780d443e8Sbamvor.zhangjian@huawei.cominclude ../lib.mk
1880d443e8Sbamvor.zhangjian@huawei.com
19a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/subdir:
20c9b26b81SDavid Drysdale	mkdir -p $@
21a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/script:
22c9b26b81SDavid Drysdale	echo '#!/bin/sh' > $@
23c9b26b81SDavid Drysdale	echo 'exit $$*' >> $@
24c9b26b81SDavid Drysdale	chmod +x $@
25a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
26a8ba798bSbamvor.zhangjian@huawei.com	cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
27a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
28c9b26b81SDavid Drysdale	cp $< $@
29c9b26b81SDavid Drysdale	chmod -x $@
30a8ba798bSbamvor.zhangjian@huawei.com
31