/alps/bar_resolve

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/bar_resolve
1 by Suren A. Chilingaryan
Test application for resolving user-space BAR addresses
1
obj-m := test.o
2
test-objs := mod.o dev.o sysfs.o
3
4
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
2 by Suren A. Chilingaryan
Finalyze the sample
5
INSTALLDIR ?= /lib/modules/$(shell uname -r)/extra
1 by Suren A. Chilingaryan
Test application for resolving user-space BAR addresses
6
PWD := $(shell pwd)
7
2 by Suren A. Chilingaryan
Finalyze the sample
8
KBUILD_EXTRA_SYMBOLS := ${INSTALLDIR}/pciDriver.symvers
1 by Suren A. Chilingaryan
Test application for resolving user-space BAR addresses
9
EXTRA_CFLAGS += -I$(M)/..
10
11
default: app
12
	@KERNEL_GCC_VERSION=`cat /proc/version | head -n1 | cut -d " " -f 7` ;\
13
	GCC_VERSION=`$(CC) --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9]" | tail -n 1` ;\
14
	if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION ]; then \
15
	    echo "Kernel is compiled with gcc $$KERNEL_GCC_VERSION, but you are now using $$GCC_VERSION" ;\
16
	    GCC_MAJOR=`echo $$KERNEL_GCC_VERSION | cut -d "." -f 1-2` ;\
17
	    newCC=gcc-$$GCC_MAJOR ;\
18
	    CC=`which $$newCC 2>/dev/null` ;\
19
	    if [ $$? -ne 0 ]; then \
20
		echo "No compiler of $$GCC_MAJOR series is installed" ;\
21
		exit 1 ;\
22
	    fi ;\
23
	    GCC_VERSION=`$$CC --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9]" | tail -n 1` ;\
24
	    if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION -a -z "$$RELAXED_GCC_CHECK" ]; then \
25
		echo "The $$GCC_VERSION of $$GCC_MAJOR series is installed" ;\
26
		exit 1 ;\
27
	    fi ;\
28
	    echo "Setting CC to $$newCC" ;\
29
	else \
30
	    CC=$(CC) ;\
31
	fi ;\
32
	$(MAKE) $(CFLAGS) -C $(KERNELDIR) M=$(PWD) CC=$$CC modules
33
34
app: app.c
35
	gcc app.c -o app -lpcilib
36
37
38
clean:
39
	rm -rf *.o *.ko *.mod.c .*.o.cmd .*.o.tmp .*.ko.cmd  .*.o *.symvers modules.order .tmp_versions