Update documentation for 0.11.2
[acer_acpi.git] / Makefile
blobe0137647d14a1c3efb2b005266d690e91f0a75c5
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 awk -F\" '/REL/ {print $$2}' $(shell grep -s -l REL $(KERNELSRC)/include/linux/version.h $(KERNELSRC)/include/linux/utsrelease.h))
8 KERNELMAJOR=$(shell echo $(KERNELVERSION)|head -c3)
9 KBUILD_BASENAME=
11 # next line is for kernel 2.6, if you integrate the driver in the kernel tree
12 # /usr/src/linux/drivers/acer_acpi - or something similar
13 # don't forget to add the following line to the parent dir's Makefile:
14 # (/usr/src/linux/drivers/Makefile)
15 # obj-m += acer_acpi/
16 obj-m += wmi-acer.o acer_acpi.o
17 #acer_acpi-objs := wmi-acer.o acer_acpi.o
19 CC=gcc
20 EXTRA_CFLAGS+=-c -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe
21 INCLUDE=-I$(KERNELSRC)/include
23 ifneq ($(KERNELMAJOR), 2.6)
24 exit:
25 endif
27 TARGET := wmi-acer.ko acer_acpi.ko
28 SOURCE := wmi-acer.c acer_acpi.c
30 all: $(TARGET)
32 exit:
33 @echo "No support for 2.4 series kernels"
35 help:
36 @echo Possible targets:
37 @echo -e all\\t- default target, builds kernel module
38 @echo -e install\\t- copies module binary to /lib/modules/$(KERNELVERSION)/extra/
39 @echo -e clean\\t- removes all binaries and temporary files
41 wmi-acer.ko: $(SOURCE)
42 $(MAKE) -C $(KERNELSRC) SUBDIRS=$(PWD) modules
44 wmi-acer.o: $(SOURCE)
45 $(CC) $(INCLUDE) $(CFLAGS) -DMODVERSIONS -DMODULE -D__KERNEL__ -o $(TARGET) $(SOURCE)
47 acer_acpi.ko: $(SOURCE)
48 $(MAKE) -C $(KERNELSRC) SUBDIRS=$(PWD) modules
50 acer_acpi.o: $(SOURCE)
51 $(CC) $(INCLUDE) $(CFLAGS) -DMODVERSIONS -DMODULE -D__KERNEL__ -o $(TARGET) $(SOURCE)
53 clean:
54 rm -f *~ *.o *.s *.ko *.mod.c .*.cmd Module.symvers
55 rm -rf .tmp_versions
57 load: $(TARGET)
58 insmod $(TARGET)
60 unload:
61 rmmod acer_acpi
63 install: $(TARGET)
64 mkdir -p ${DESTDIR}/lib/modules/$(KERNELVERSION)/extra
65 cp -v $(TARGET) ${DESTDIR}/lib/modules/$(KERNELVERSION)/extra/
66 depmod $(KERNELVERSION) -a