title: makefile for a libusb program
body: <p>I have made a C program using libusb and I am using following command to compile it:</p>
  
  <pre><code>gcc -o usbtest.o usbtest.c -lusb-1.0
  </code></pre>
  
  <p>The program is working fine. Next, I added the code of "usbtest.c" to kernel module (usbmod.c) and I am stuck with the make file. I am not sure what command I should pass in the "all" section. Here is what I have made:</p>
  
  <pre><code>obj-m := usbmod.o
  
  KERNEL_DIR = /lib/modules/$(shell uname -r)/build
  PWD = $(shell pwd)
  
  all:
      $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
  
  clean:
      rm -rf *.o *.ko *.mod.* *.symvers *.order *-
  </code></pre>
  
  <p>After running make, I am getting the following error:</p>
  
  <pre><code>anubhav@anubhav-Inspiron-3421:~/Desktop/usb$ make
  make -C /lib/modules/3.13.0-46-generic/build     SUBDIRS=/home/anubhav/Desktop/usb modules
  make[1]: Entering directory `/usr/src/linux-headers-3.13.0-46-generic'
  CC [M]  /home/anubhav/Desktop/usb/usbmod.o
  /home/anubhav/Desktop/usb/usbmod.c:3:19: fatal error: stdio.h: No such  file or directory
  #include &lt;stdio.h&gt;
                 ^
  compilation terminated.
  make[2]: *** [/home/anubhav/Desktop/usb/usbmod.o] Error 1
  make[1]: *** [_module_/home/anubhav/Desktop/usb] Error 2
  make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-46-generic'
  make: *** [all] Error 2
  </code></pre>
  
  <p>Not sure if need to bring any header file to my working directory or what. Kindly provide suggestions.</p>