summaryrefslogtreecommitdiff
path: root/kernel/driver/Makefile
blob: 88712165881a9085903474603e928fb69895b91f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
MDIR = extra

KDIR ?= $(shell sh find_kernel_headers)

obj-m      += pptp.o
#obj-m      += gre.o

CURRENT = $(shell uname -r)


ifndef MAKING_MODULES
all: kernel_headers
	make -C $(KDIR) SUBDIRS=$(PWD) modules
endif

ifneq (,$(findstring 2.4.,$(CURRENT)))
install:
	@if test ! -d /lib/modules/$(CURRENT)/extra; then \
	    mkdir /lib/modules/$(CURRENT)/extra; \
	fi; \
	cp -v $(TARGET).o /lib/modules/$(CURRENT)/extra/$(TARGET).o && /sbin/depmod -a
else
install:	
	make -C $(KDIR) M=$(PWD) modules_install
endif

kernel_headers:
	@if test -z "$(KDIR)"; then \
	    echo "kernel headers not found"; \
	    exit 1; \
	else \
	    echo "using \"$(KDIR)\" kernel headers"; \
	fi

default: all

clean:
	-rm -f *.o *.ko .*.cmd .*.flags *.mod.c

ifneq (,$(findstring 2.4.,$(CURRENT)))
include $(KDIR)/Rules.make
endif