1# SPDX-License-Identifier: GPL-2.0
2CFLAGS = -Wall
3CFLAGS += -Wno-nonnull
4CFLAGS += -D_GNU_SOURCE
5
6TEST_PROGS := binfmt_script
7TEST_GEN_PROGS := execveat
8TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
9# Makefile is a run-time dependency, since it's accessed by the execveat test
10TEST_FILES := Makefile
11
12TEST_GEN_PROGS += recursion-depth
13
14EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx*
15
16include ../lib.mk
17
18$(OUTPUT)/subdir:
19	mkdir -p $@
20$(OUTPUT)/script:
21	echo '#!/bin/sh' > $@
22	echo 'exit $$*' >> $@
23	chmod +x $@
24$(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
25	cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
26$(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
27	cp $< $@
28	chmod -x $@
29
30