Merge tag 'linux-kselftest-next-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kerne...
[sfrench/cifs-2.6.git] / tools / testing / selftests / exec / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 CFLAGS = -Wall
3 CFLAGS += -Wno-nonnull
4 CFLAGS += -D_GNU_SOURCE
5
6 TEST_PROGS := binfmt_script.py
7 TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
8 TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
9 # Makefile is a run-time dependency, since it's accessed by the execveat test
10 TEST_FILES := Makefile
11
12 TEST_GEN_PROGS += recursion-depth
13 TEST_GEN_PROGS += null-argv
14
15 EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \
16                $(OUTPUT)/S_I*.test
17
18 include ../lib.mk
19
20 $(OUTPUT)/subdir:
21         mkdir -p $@
22 $(OUTPUT)/script:
23         echo '#!/bin/sh' > $@
24         echo 'exit $$*' >> $@
25         chmod +x $@
26 $(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
27         cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
28 $(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
29         cp $< $@
30         chmod -x $@
31 $(OUTPUT)/load_address_4096: load_address.c
32         $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@
33 $(OUTPUT)/load_address_2097152: load_address.c
34         $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@
35 $(OUTPUT)/load_address_16777216: load_address.c
36         $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@