1 |
< |
# Linux makefile for SheepShaver |
1 |
> |
# Linux makefile for sheep_net driver |
2 |
> |
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 |
> |
KERNEL_DRIVER = $(KERNEL_DIR)/kernel/drivers |
11 |
> |
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 |
|
|
22 |
|
## System specific configuration |
23 |
< |
CC = cc |
24 |
< |
CPPFLAGS = -I. -I/usr/src/linux/include |
6 |
< |
CFLAGS = -O2 -Wall -D__KERNEL__ -DMODULE |
23 |
> |
CPPFLAGS = -I. -I$(KERNEL_SOURCE)/include |
24 |
> |
CFLAGS = -O2 -Wall -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES |
25 |
|
ASFLAGS = |
26 |
|
LDFLAGS = |
27 |
|
LIBS = |
28 |
|
|
29 |
|
## Files |
30 |
+ |
KERNEL_DRIVER = $(KERNEL_DIR) |
31 |
|
OBJS = sheep_net.o |
32 |
|
|
33 |
|
## Rules |
40 |
|
dep depend: |
41 |
|
makedepend $(CPPFLAGS) -Y *.c |
42 |
|
|
43 |
+ |
endif |
44 |
+ |
|
45 |
+ |
dev: |
46 |
+ |
mknod /dev/sheep_net c 10 198 |
47 |
+ |
|
48 |
+ |
install: sheep_net.$(MP) |
49 |
+ |
install -d $(KERNEL_DRIVER)/misc |
50 |
+ |
install -m 644 sheep_net.$(MP) $(KERNEL_DRIVER)/misc |
51 |
+ |
depmod -a |
52 |
+ |
|
53 |
|
# DO NOT DELETE |