/alps/bar_resolve

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/bar_resolve

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 05:45:24 UTC
  • Revision ID: csa@suren.me-20160302054524-aqefho92o0ljk3eh
Test application for resolving user-space BAR addresses

Show diffs side-by-side

added added

removed removed

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