Lines 44-54
Link Here
|
44 |
#RELEASE := $(shell awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $$2 }' $(LINUX_DIR)/include/linux/version.h|tail -n 1) |
44 |
#RELEASE := $(shell awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $$2 }' $(LINUX_DIR)/include/linux/version.h|tail -n 1) |
45 |
# This seem to work better |
45 |
# This seem to work better |
46 |
#LINUX_DIR := /usr/src/linux |
46 |
#LINUX_DIR := /usr/src/linux |
47 |
RELEASE := $(shell if test -r $(LINUX_DIR)/include/linux/version.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/version.h; then \ |
47 |
RELEASE := $(shell awk -F \" '/[ ]*\#[ ]*define[ ]*UTS_RELEASE[ ]*/ { print $$2 }' $(OUTPUT_DIR)/include/linux/version.h|tail -n 1) |
48 |
((echo "\#include <linux/version.h>" ; echo "kernsrcver=UTS_RELEASE") | cpp -I $(LINUX_DIR)/include | grep "^kernsrcver=" | cut -d \" -f 2); \ |
|
|
49 |
elif test -r $(LINUX_DIR)/include/linux/utsrelease.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/utsrelease.h; then \ |
50 |
((echo "\#include <linux/utsrelease.h>"; echo "kernsrcver=UTS_RELEASE") | cpp -I $(LINUX_DIR)/include | grep "^kernsrcver=" | cut -d \" -f 2); \ |
51 |
fi) |
52 |
MODULE_DIR := /lib/modules/$(RELEASE) |
48 |
MODULE_DIR := /lib/modules/$(RELEASE) |
53 |
endif |
49 |
endif |
54 |
endif |
50 |
endif |
Lines 58-63
Link Here
|
58 |
LINUX_DIR := $(MODULE_DIR)/build |
54 |
LINUX_DIR := $(MODULE_DIR)/build |
59 |
endif |
55 |
endif |
60 |
|
56 |
|
|
|
57 |
ifndef OUTPUT_DIR |
58 |
OUTPUT_DIR := $(LINUX_DIR) |
59 |
endif |
60 |
|
61 |
HAVE_UTSRELEASE_H := $(shell if test -r $(LINUX_DIR)/include/linux/version.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/version.h; then \ |
61 |
HAVE_UTSRELEASE_H := $(shell if test -r $(LINUX_DIR)/include/linux/version.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/version.h; then \ |
62 |
echo 0; \ |
62 |
echo 0; \ |
63 |
elif test -r $(LINUX_DIR)/include/linux/utsrelease.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/utsrelease.h; then \ |
63 |
elif test -r $(LINUX_DIR)/include/linux/utsrelease.h && fgrep -q UTS_RELEASE $(LINUX_DIR)/include/linux/utsrelease.h; then \ |
Lines 75-81
Link Here
|
75 |
DEPMOD := $(shell which depmod || which /sbin/depmod || echo "true You should now run depmod") |
75 |
DEPMOD := $(shell which depmod || which /sbin/depmod || echo "true You should now run depmod") |
76 |
|
76 |
|
77 |
# Get VERSION_CODE (from version.h in kernel source directory) |
77 |
# Get VERSION_CODE (from version.h in kernel source directory) |
78 |
VERSION_CODE := $(shell awk '/[ ]*\#[ ]*define[ ]*LINUX_VERSION_CODE[ ]*/ { print $$3 }' $(LINUX_DIR)/include/linux/version.h|tail -n 1) |
78 |
VERSION_CODE := $(shell awk '/[ ]*\#[ ]*define[ ]*LINUX_VERSION_CODE[ ]*/ { print $$3 }' $(OUTPUT_DIR)/include/linux/version.h|tail -n 1) |
79 |
|
79 |
|
80 |
ifeq ($(shell if [ $(VERSION_CODE) -ge 132608 ]; then echo y; fi),y) |
80 |
ifeq ($(shell if [ $(VERSION_CODE) -ge 132608 ]; then echo y; fi),y) |
81 |
MODULE_NAME := quickcam.ko # for 2.6.x |
81 |
MODULE_NAME := quickcam.ko # for 2.6.x |
Lines 91-96
Link Here
|
91 |
@echo "make all - Compile driver and utilities against current running kernel" |
91 |
@echo "make all - Compile driver and utilities against current running kernel" |
92 |
@echo "make all USER_OPT=-DDEBUG - Compile with debugging code and messages" |
92 |
@echo "make all USER_OPT=-DDEBUG - Compile with debugging code and messages" |
93 |
@echo "make all LINUX_DIR=/usr/src/linux - Compile against specified kernel source" |
93 |
@echo "make all LINUX_DIR=/usr/src/linux - Compile against specified kernel source" |
|
|
94 |
@echo "make all OUTPUT_DIR=/var/tmp/kernel-output/2.6.19 - Specify binary output dir" |
94 |
@echo "make install - Copy driver and utilities into standard locations (needs root)" |
95 |
@echo "make install - Copy driver and utilities into standard locations (needs root)" |
95 |
@echo "make install PREFIX=/usr - Copy utilities to /usr/bin instead of /usr/local/bin" |
96 |
@echo "make install PREFIX=/usr - Copy utilities to /usr/bin instead of /usr/local/bin" |
96 |
@echo "make install MODULE_DIR=/lib/modules/2.4.0 - Copy module to /lib/modules/2.4.0/misc" |
97 |
@echo "make install MODULE_DIR=/lib/modules/2.4.0 - Copy module to /lib/modules/2.4.0/misc" |
Lines 130-136
Link Here
|
130 |
else |
131 |
else |
131 |
# No, 2.4.x or older |
132 |
# No, 2.4.x or older |
132 |
|
133 |
|
133 |
MODULE_INC := -I$(LINUX_DIR)/include -nostdinc -iwithprefix include |
134 |
MODULE_INC := -I$(LINUX_DIR)/include -I$(OUTPUT_DIR)/include -nostdinc -iwithprefix include |
134 |
MODULE_DEF := -DMODULE -D__KERNEL__ -DNOKERNEL |
135 |
MODULE_DEF := -DMODULE -D__KERNEL__ -DNOKERNEL |
135 |
MODULE_OPT := -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common |
136 |
MODULE_OPT := -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common |
136 |
MODULE_WARN := -Wall -Wstrict-prototypes -Wno-trigraphs |
137 |
MODULE_WARN := -Wall -Wstrict-prototypes -Wno-trigraphs |