1 |
cebix |
1.3 |
# Linux makefile for sheep_net driver |
2 |
gbeauche |
1.9 |
KERNEL_DIR = /lib/modules/$(shell uname -r) |
3 |
|
|
KERNEL_SOURCE = $(KERNEL_DIR)/build |
4 |
|
|
LV := $(shell test -f $(KERNEL_SOURCE)/Rules.make && echo 24 || echo 26) |
5 |
|
|
MP := $(shell test -f $(KERNEL_SOURCE)/Rules.make && echo "o" || echo "ko") |
6 |
|
|
|
7 |
|
|
ifeq ($(LV),26) |
8 |
|
|
# Kernel 2.6 |
9 |
|
|
|
10 |
asvitkine |
1.10 |
KERNEL_DRIVER = $(KERNEL_DIR)/kernel/drivers |
11 |
gbeauche |
1.9 |
obj-m = sheep_net.o |
12 |
|
|
|
13 |
|
|
sheep_net.ko: sheep_net.c |
14 |
|
|
$(MAKE) -C $(KERNEL_SOURCE) M=$$PWD modules |
15 |
|
|
|
16 |
|
|
clean: |
17 |
|
|
$(MAKE) -C $(KERNEL_SOURCE) M=$$PWD clean |
18 |
|
|
|
19 |
|
|
else |
20 |
|
|
# Kernel 2.4 |
21 |
cebix |
1.1 |
|
22 |
|
|
## System specific configuration |
23 |
gbeauche |
1.9 |
CPPFLAGS = -I. -I$(KERNEL_SOURCE)/include |
24 |
cebix |
1.7 |
CFLAGS = -O2 -Wall -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES |
25 |
cebix |
1.1 |
ASFLAGS = |
26 |
|
|
LDFLAGS = |
27 |
|
|
LIBS = |
28 |
|
|
|
29 |
|
|
## Files |
30 |
asvitkine |
1.10 |
KERNEL_DRIVER = $(KERNEL_DIR) |
31 |
cebix |
1.1 |
OBJS = sheep_net.o |
32 |
|
|
|
33 |
|
|
## Rules |
34 |
|
|
sheep_net.o: sheep_net.c |
35 |
|
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) sheep_net.c |
36 |
cebix |
1.2 |
|
37 |
cebix |
1.1 |
clean: |
38 |
|
|
-rm $(OBJS) |
39 |
|
|
|
40 |
|
|
dep depend: |
41 |
|
|
makedepend $(CPPFLAGS) -Y *.c |
42 |
|
|
|
43 |
gbeauche |
1.9 |
endif |
44 |
|
|
|
45 |
|
|
dev: |
46 |
|
|
mknod /dev/sheep_net c 10 198 |
47 |
|
|
|
48 |
|
|
install: sheep_net.$(MP) |
49 |
asvitkine |
1.10 |
install -d $(KERNEL_DRIVER)/misc |
50 |
|
|
install -m 644 sheep_net.$(MP) $(KERNEL_DRIVER)/misc |
51 |
gbeauche |
1.9 |
depmod -a |
52 |
|
|
|
53 |
cebix |
1.1 |
# DO NOT DELETE |