^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) CFLAGS = -Wall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) CFLAGS += -Wno-nonnull
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) CFLAGS += -D_GNU_SOURCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) TEST_PROGS := binfmt_script
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # Makefile is a run-time dependency, since it's accessed by the execveat test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) TEST_FILES := Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) TEST_GEN_PROGS += recursion-depth
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) $(OUTPUT)/S_I*.test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) include ../lib.mk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) $(OUTPUT)/subdir:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) mkdir -p $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) $(OUTPUT)/script:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) echo '#!/bin/sh' > $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) echo 'exit $$*' >> $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) chmod +x $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) $(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) $(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) cp $< $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) chmod -x $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) $(OUTPUT)/load_address_4096: load_address.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) $(OUTPUT)/load_address_2097152: load_address.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) $(OUTPUT)/load_address_16777216: load_address.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@