Files
laptops-kernel/tools/testing/selftests/exec/Makefile
T

35 lines
1.2 KiB
Makefile
Raw Normal View History

# SPDX-License-Identifier: GPL-2.0
2014-12-12 16:57:36 -08:00
CFLAGS = -Wall
2019-05-14 15:44:43 -07:00
CFLAGS += -Wno-nonnull
CFLAGS += -D_GNU_SOURCE
2014-12-12 16:57:36 -08:00
2020-08-14 17:30:17 -07:00
TEST_PROGS := binfmt_script non-regular
TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
2016-11-29 19:55:51 +08:00
# Makefile is a run-time dependency, since it's accessed by the execveat test
TEST_FILES := Makefile
2019-05-14 15:44:43 -07:00
TEST_GEN_PROGS += recursion-depth
2020-08-14 17:30:17 -07:00
EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \
$(OUTPUT)/S_I*.test
2016-11-29 19:55:51 +08:00
include ../lib.mk
2016-11-29 19:55:52 +08:00
$(OUTPUT)/subdir:
2014-12-12 16:57:36 -08:00
mkdir -p $@
2016-11-29 19:55:52 +08:00
$(OUTPUT)/script:
2014-12-12 16:57:36 -08:00
echo '#!/bin/sh' > $@
echo 'exit $$*' >> $@
chmod +x $@
2016-11-29 19:55:52 +08:00
$(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
$(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
2014-12-12 16:57:36 -08:00
cp $< $@
chmod -x $@
$(OUTPUT)/load_address_4096: load_address.c
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@
$(OUTPUT)/load_address_2097152: load_address.c
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@
$(OUTPUT)/load_address_16777216: load_address.c
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@