lguest: fix failure to find linux/virtio_types.h
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 11 Feb 2015 04:45:11 +0000 (15:15 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 11 Feb 2015 06:17:37 +0000 (16:47 +1030)
We want to use the local kernel headers, but -I../../include/uapi leads us into
a world of hurt.  Instead we create a dummy include/ dir with symlinks.

If we just use #include "../../include/uapi/linux/virtio_blk.h" we get:

../../include/uapi/linux/virtio_blk.h:31:32: fatal error: linux/virtio_types.h: No such file or directory
 #include <linux/virtio_types.h>

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/lguest/Makefile

index 97bca4871ea34d8b1f4adc3422907b3cecb5c45c..a107b5e4da134121248445db0b48da733821cf34 100644 (file)
@@ -1,7 +1,13 @@
 # This creates the demonstration utility "lguest" which runs a Linux guest.
-CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE
+CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE -Iinclude
 
 all: lguest
 
+include/linux/virtio_types.h: ../../include/uapi/linux/virtio_types.h
+       mkdir -p include/linux 2>&1 || true
+       ln -sf ../../../../include/uapi/linux/virtio_types.h $@
+
+lguest: include/linux/virtio_types.h
+
 clean:
        rm -f lguest