xref: /linux/tools/testing/selftests/exec/Makefile (revision c9b26b81af9c3296685b5dbcbcd415400ab400dc)
1*c9b26b81SDavid DrysdaleCC = $(CROSS_COMPILE)gcc
2*c9b26b81SDavid DrysdaleCFLAGS = -Wall
3*c9b26b81SDavid DrysdaleBINARIES = execveat
4*c9b26b81SDavid DrysdaleDEPS = execveat.symlink execveat.denatured script subdir
5*c9b26b81SDavid Drysdaleall: $(BINARIES) $(DEPS)
6*c9b26b81SDavid Drysdale
7*c9b26b81SDavid Drysdalesubdir:
8*c9b26b81SDavid Drysdale	mkdir -p $@
9*c9b26b81SDavid Drysdalescript:
10*c9b26b81SDavid Drysdale	echo '#!/bin/sh' > $@
11*c9b26b81SDavid Drysdale	echo 'exit $$*' >> $@
12*c9b26b81SDavid Drysdale	chmod +x $@
13*c9b26b81SDavid Drysdaleexecveat.symlink: execveat
14*c9b26b81SDavid Drysdale	ln -s -f $< $@
15*c9b26b81SDavid Drysdaleexecveat.denatured: execveat
16*c9b26b81SDavid Drysdale	cp $< $@
17*c9b26b81SDavid Drysdale	chmod -x $@
18*c9b26b81SDavid Drysdale%: %.c
19*c9b26b81SDavid Drysdale	$(CC) $(CFLAGS) -o $@ $^
20*c9b26b81SDavid Drysdale
21*c9b26b81SDavid Drysdalerun_tests: all
22*c9b26b81SDavid Drysdale	./execveat
23*c9b26b81SDavid Drysdale
24*c9b26b81SDavid Drysdaleclean:
25*c9b26b81SDavid Drysdale	rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved xxxxx*
26