selftest/x86: build both bitnesses
[deliverable/linux.git] / tools / testing / selftests / x86 / Makefile
CommitLineData
3f705dfd
AL
1.PHONY: all all_32 all_64 check_build32 clean run_tests
2
0a15584d 3TARGETS_C_BOTHBITS := sigreturn single_step_syscall
3f705dfd
AL
4
5BINARIES_32 := $(TARGETS_C_BOTHBITS:%=%_32)
6BINARIES_64 := $(TARGETS_C_BOTHBITS:%=%_64)
7
8CFLAGS := -O2 -g -std=gnu99 -pthread -Wall
9
f9ea4a33 10UNAME_M := $(shell uname -m)
3f705dfd
AL
11
12# Always build 32-bit tests
13all: all_32
14
15# If we're on a 64-bit host, build 64-bit tests as well
f9ea4a33 16ifeq ($(UNAME_M),x86_64)
3f705dfd
AL
17all: all_64
18endif
19
20all_32: check_build32 $(BINARIES_32)
21
22all_64: $(BINARIES_64)
23
24clean:
25 $(RM) $(BINARIES_32) $(BINARIES_64)
26
27run_tests:
28 ./run_x86_tests.sh
29
30$(TARGETS_C_BOTHBITS:%=%_32): %_32: %.c
31 $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
32
33$(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c
34 $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
35
36check_build32:
37 @if ! $(CC) -m32 -o /dev/null trivial_32bit_program.c; then \
38 echo "Warning: you seem to have a broken 32-bit build" 2>&1; \
39 echo "environment. If you are using a Debian-like"; \
40 echo " distribution, try:"; \
41 echo ""; \
42 echo " apt-get install gcc-multilib libc6-i386 libc6-dev-i386"; \
43 echo ""; \
44 echo "If you are using a Fedora-like distribution, try:"; \
45 echo ""; \
46 echo " yum install glibc-devel.*i686"; \
47 exit 1; \
48 fi
This page took 0.033772 seconds and 5 git commands to generate.