fd624ef0c4113e2039babffbbdbceb4818c10c7b
[simavr] / examples / vhci / Makefile
1 #
2 # This makefile attempts to compile the vhci core module and the
3 # libusb-vhci library by downloading known tarballs, hacking them
4 # a little and compiling them
5
6 # This has been tested on debian, but coild possibly work in other
7 # distro. the only "real" dependency is to have the linux kernel
8 # header symlinked at /lib/modules/<your host kernel version/build
9 #
10
11 HCD_V           = 1.14
12 VHCI_V          = 0.6
13 BASE_URL        = http://downloads.sourceforge.net/project/usb-vhci
14 PWD                     = ${shell pwd}
15
16 all: library
17
18 module: vhci-hcd-$(HCD_V)/usb-vhci-hcd.ko
19
20 vhci-hcd-$(HCD_V)/usb-vhci-hcd.ko: vhci-hcd-$(HCD_V)
21         make -C vhci-hcd-$(HCD_V) \
22                 KDIR=/lib/modules/${shell uname -r}/build \
23                 CORE_INCLUDE_DIR=$(PWD)/vhci-hcd-$(HCD_V)/linux/2.6.32/drivers/usb/core
24
25 vhci-hcd-$(HCD_V).tar.bz2: 
26         wget $(BASE_URL)/linux%20kernel%20module/$@
27
28 vhci-hcd-$(HCD_V): vhci-hcd-$(HCD_V).tar.bz2
29         tar jxf $@.tar.bz2 && \
30                 cd $@ && \
31                 cat ../patches/hcd-*.patch | patch --merge -p1 
32         sed -i -e 's|#define DEBUG|#undef DEBUG|' vhci-hcd-$(HCD_V)/usb-vhci-hcd.c
33
34 library: lib/libusb_vhci.a
35
36 lib/libusb_vhci.a: module libusb_vhci-$(VHCI_V)
37         ln -snf vhci-hcd-$(HCD_V) linux && \
38                 cd libusb_vhci-$(VHCI_V) && \
39                 ./configure --prefix=$(PWD) CPPFLAGS="-I$(PWD)" --enable-static --disable-shared && \
40                         make -j && make install
41
42 libusb_vhci-$(VHCI_V).tar.bz2:
43         wget $(BASE_URL)/native%20libraries/libusb_vhci-$(VHCI_V).tar.bz2
44
45 libusb_vhci-$(VHCI_V): libusb_vhci-$(VHCI_V).tar.bz2
46         tar jxf $@.tar.bz2 && \
47                 cd $@ && \
48                 cat ../patches/vhci-*.patch | patch --merge -p1 
49
50 clean:
51         rm -rf libusb_vhci-$(VHCI_V) vhci-hcd-$(HCD_V) lib include linux
52
53 distclean: clean
54         rm -rf *.tar.bz2