Updated documentation for 0.7 release
[acer_acpi.git] / Makefile
blob1bc38a8feff47bc2608a6e555b621cf4a7b8108d
1 # change KERNELSRC to the location of your kernel build tree only if
2 # autodetection does not work
3 #KERNELSRC=/usr/src/linux
4 #KERNELSRC=/usr/src/kernel-source-2.4.21-acpi-i2c-lmsensors
5 KERNELSRC?=/lib/modules/`uname -r`/build
6 KERNELVERSION=$(shell for f in $(KERNELSRC)/include/linux/{utsrelease.h,version.h}; do \
7 test -f $$f && awk -F\" '/RELEASE/ {print $$2}' $$f && break; \
8 done)
10 KERNELMAJOR=$(shell echo $(KERNELVERSION)|head -c3)
11 KBUILD_BASENAME=
13 # next line is for kernel 2.6, if you integrate the driver in the kernel tree
14 # /usr/src/linux/drivers/acer_acpi - or something similar
15 # don't forget to add the following line to the parent dir's Makefile:
16 # (/usr/src/linux/drivers/Makefile)
17 # obj-m += acer_acpi/
18 obj-m += acer_acpi.o
20 CC=gcc
21 CFLAGS+=-c -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe
22 INCLUDE=-I$(KERNELSRC)/include
24 ifneq ($(KERNELMAJOR), 2.6)
25 exit:
26 endif
28 TARGET := acer_acpi.ko
29 SOURCE := acer_acpi.c
31 all: $(TARGET)
33 exit:
34 @echo "No support for 2.4 series kernels"
36 help:
37 @echo Possible targets:
38 @echo -e all\\t- default target, builds kernel module
39 @echo -e install\\t- copies module binary to /lib/modules/$(KERNELVERSION)/extra/
40 @echo -e clean\\t- removes all binaries and temporary files
42 acer_acpi.ko: $(SOURCE)
43 $(MAKE) -C $(KERNELSRC) SUBDIRS=$(PWD) modules
45 acer_acpi.o: $(SOURCE)
46 $(CC) $(INCLUDE) $(CFLAGS) -DMODVERSIONS -DMODULE -D__KERNEL__ -o $(TARGET) $(SOURCE)
48 clean:
49 rm -f *~ *.o *.s *.ko *.mod.c .*.cmd Module.symvers
50 rm -rf .tmp_versions
52 load: $(TARGET)
53 insmod $(TARGET)
55 unload:
56 rmmod acer_acpi
58 install: $(TARGET)
59 mkdir -p ${DESTDIR}/lib/modules/$(KERNELVERSION)/extra
60 cp -v $(TARGET) ${DESTDIR}/lib/modules/$(KERNELVERSION)/extra/
61 depmod -a