Mercurial > vloopback
annotate Makefile @ 9:00bb25bff577
Improve Makefile
author | AngelCarpintero |
---|---|
date | Sun, 31 Aug 2008 17:28:08 +0000 |
parents | 80590d10a596 |
children | bce647a9dd4b |
rev | line source |
---|---|
5
fa5d2b9d8831
Add make dist to create tarball without .svn contest
AngelCarpintero
parents:
2
diff
changeset
|
1 VERSION=trunk |
8
80590d10a596
Added num of buffers as a module param, indent code using spaces instead of tabs
AngelCarpintero
parents:
6
diff
changeset
|
2 MODULENAME=vloopback |
5
fa5d2b9d8831
Add make dist to create tarball without .svn contest
AngelCarpintero
parents:
2
diff
changeset
|
3 |
0 | 4 ifneq ($(KERNELRELEASE),) |
5 | |
8
80590d10a596
Added num of buffers as a module param, indent code using spaces instead of tabs
AngelCarpintero
parents:
6
diff
changeset
|
6 obj-m := $(MODULENAME).o |
0 | 7 |
8 else | |
9 | |
10 KVER := $(shell uname -r) | |
11 KLINK := $(shell test -e /lib/modules/${KVER}/source/ && echo source || echo "build") | |
12 KSRC := /lib/modules/$(KVER)/$(KLINK) | |
13 PWD := $(shell pwd) | |
14 DEST := /lib/modules/$(KVER)/kernel/drivers/misc | |
15 | |
16 # Fix some problem with suse < 9.2 and suse >= 9.2 | |
17 is_suse := $(shell test -e /etc/SuSE-release && echo 1 || echo 0) | |
18 ifeq ($(is_suse),1) | |
19 suse_version := $(shell grep VERSION /etc/SuSE-release | cut -f 3 -d " "| tr -d .) | |
20 is_suse_92_or_greater := $(shell test $(suse_version) -ge 92 && echo 1) | |
21 ifeq ($(is_suse_92_or_greater),1) | |
22 KSRC := /lib/modules/$(KVER)/build | |
23 endif | |
24 endif | |
25 | |
26 | |
9 | 27 default: all examples |
0 | 28 |
9 | 29 all: |
0 | 30 $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules |
31 | |
32 install: | |
33 install -d $(DEST) | |
8
80590d10a596
Added num of buffers as a module param, indent code using spaces instead of tabs
AngelCarpintero
parents:
6
diff
changeset
|
34 install -m 644 -c $(MODULENAME).ko $(DEST) |
0 | 35 -/sbin/depmod -a |
36 | |
9 | 37 examples: |
38 $(MAKE) -C example | |
39 | |
0 | 40 uninstall: |
8
80590d10a596
Added num of buffers as a module param, indent code using spaces instead of tabs
AngelCarpintero
parents:
6
diff
changeset
|
41 rm -f $(DEST)/$(MODULENAME).ko |
0 | 42 -/sbin/depmod -a |
43 clean: | |
6 | 44 rm -f .*.cmd *.o *.mod.c *.ko .v* *~ core Modules.symvers Module.symvers |
0 | 45 rm -rf .tmp_versions/ |
2 | 46 rm -f example/dummy example/feed example/resize example/invert |
5
fa5d2b9d8831
Add make dist to create tarball without .svn contest
AngelCarpintero
parents:
2
diff
changeset
|
47 |
fa5d2b9d8831
Add make dist to create tarball without .svn contest
AngelCarpintero
parents:
2
diff
changeset
|
48 dist: clean |
9 | 49 cd .. ; tar cfvz $(MODULENAME)-$(VERSION).tar.gz --exclude='.svn' $(VERSION)/ |
0 | 50 endif |