1uname_M := $(shell uname -m 2>/dev/null || echo not) 2ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) 3ifeq ($(ARCH),i386) 4 ARCH := x86 5endif 6ifeq ($(ARCH),x86_64) 7 ARCH := x86 8endif 9 10CFLAGS += -D_FILE_OFFSET_BITS=64 11CFLAGS += -I../../../../arch/x86/include/generated/uapi/ 12CFLAGS += -I../../../../arch/x86/include/uapi/ 13CFLAGS += -I../../../../include/uapi/ 14CFLAGS += -I../../../../include/ 15 16all: 17ifeq ($(ARCH),x86) 18 gcc $(CFLAGS) memfd_test.c -o memfd_test 19else 20 echo "Not an x86 target, can't build memfd selftest" 21endif 22 23run_tests: all 24ifeq ($(ARCH),x86) 25 gcc $(CFLAGS) memfd_test.c -o memfd_test 26endif 27 @./memfd_test || echo "memfd_test: [FAIL]" 28 29build_fuse: 30ifeq ($(ARCH),x86) 31 gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt 32 gcc $(CFLAGS) fuse_test.c -o fuse_test 33else 34 echo "Not an x86 target, can't build memfd selftest" 35endif 36 37run_fuse: build_fuse 38 @./run_fuse_test.sh || echo "fuse_test: [FAIL]" 39 40clean: 41 $(RM) memfd_test fuse_test 42