blob: 0a13b110c1e66a6c831c99d92ce1ab977eac1b34 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
David Drysdalec9b26b82014-12-12 16:57:36 -08002CFLAGS = -Wall
Alexey Dobriyan4e7301e2019-05-14 15:44:43 -07003CFLAGS += -Wno-nonnull
4CFLAGS += -D_GNU_SOURCE
David Drysdalec9b26b82014-12-12 16:57:36 -08005
Kees Cook0f712412020-08-14 17:30:17 -07006TEST_PROGS := binfmt_script non-regular
bamvor.zhangjian@huawei.com80d443e82016-11-29 19:55:51 +08007TEST_GEN_PROGS := execveat
Kees Cook61016db2020-05-17 21:47:43 -07008TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
bamvor.zhangjian@huawei.com80d443e82016-11-29 19:55:51 +08009# Makefile is a run-time dependency, since it's accessed by the execveat test
10TEST_FILES := Makefile
11
Alexey Dobriyan4e7301e2019-05-14 15:44:43 -070012TEST_GEN_PROGS += recursion-depth
13
Kees Cook0f712412020-08-14 17:30:17 -070014EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \
15 $(OUTPUT)/S_I*.test
bamvor.zhangjian@huawei.com80d443e82016-11-29 19:55:51 +080016
17include ../lib.mk
18
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080019$(OUTPUT)/subdir:
David Drysdalec9b26b82014-12-12 16:57:36 -080020 mkdir -p $@
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080021$(OUTPUT)/script:
David Drysdalec9b26b82014-12-12 16:57:36 -080022 echo '#!/bin/sh' > $@
23 echo 'exit $$*' >> $@
24 chmod +x $@
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080025$(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
26 cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
27$(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
David Drysdalec9b26b82014-12-12 16:57:36 -080028 cp $< $@
29 chmod -x $@
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080030