# General Public License for more details.
#
# Written by Soós Péter <sp@osb.hu>, 2002-2004
+# Modified by Mathieu Bérard <mathieu.berard@crans.org>, 2006-2007
#
-MODULE_NAME = omnibook
+#Module informations
+
+MODULE_NAME = omnibook
+MODULE_VERSION = 2.20070211
+MODULE_BRANCH = trunk
+
+# Out-of-tree configuration
+ifndef CONFIG_OMNIBOOK
+OMNIBOOK_STANDALONE=y
+CONFIG_OMNIBOOK=m
+
+#Uncomment and set to force debug behavior
+#NOTE: Default (commented) behavior is to enable debug in trunk or branch svn
+# snapshot and to disable it for release
+#OMNIBOOK_WANT_DEBUG=n
+
+#comment to disable backlight device support
+OMNIBOOK_WANT_BACKLIGHT=y
+
+#Uncomment to force legacy (pre-ACPI system) features support
+#OMNIBOOK_WANT_LEGACY=y
+
+endif
ifeq ($(KERNELRELEASE),)
+# Support for direct Makefile invocation
DESTDIR =
MODDIR = $(DESTDIR)/lib/modules
KDOCDIR = $(KSRC)/Documentation/omnibook
PWD = $(shell pwd)
TODAY = $(shell date +%Y%m%d)
-KERNEL = $(shell echo $(KVER) | cut -d . -f 1-2)
-
DEPMOD = /sbin/depmod -a
RMMOD = /sbin/modprobe -r
INSMOD = /sbin/modprobe
MKDIR = mkdir -p
RM = rm -f
FIND = find
-endif
-
-DEBUG = -D OMNIBOOK_DEBUG # -g -O0
-
-EXTRA_CFLAGS += -D OMNIBOOK_STANDALONE $(DEBUG)
-EXTRA_LDFLAGS += $(src)/sections.lds
-
-
-OBJS = init.o lib.o ec.o kbc.o pio.o compal.o acpi.o nbsmi.o \
- ac.o battery.o blank.o bluetooth.o cooling.o display.o dock.o \
- dump.o fan.o fan_policy.o hotkeys.o info.o lcd.o muteled.o \
- polling.o temperature.o touchpad.o wireless.o throttling.o
-
-obj-m += $(MODULE_NAME).o
-omnibook-objs := $(OBJS)
all: $(MODULE_NAME).ko
$(FIND) $(VMODDIR) -name "$(MODULE_NAME).ko" -exec $(RM) {} \;
$(DEPMOD)
-uninstall-all: unload
- $(FIND) $(MODDIR) -name "$(MODULE_NAME).ko" -exec $(RM) {} \;
- $(DEPMOD)
-
$(MODULE_NAME).ko:
$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
(cd $(KSRC); patch -p1 < $(PWD)/misc/omnibook-integration.patch)
version:
- sed -i "s|^\(#define OMNIBOOK_MODULE_VERSION.*\)\".*\"|\1\"2.$(TODAY)\"|" omnibook.h
+ sed -i "s|^\(MODULE_VERSION = \).*|\1 2.$(TODAY)|" Makefile
+ sed -i "s|^\(MODULE_BRANCH = \).*|\1 release|" Makefile
sed -i "s|^\(2\.\)X\{8\}|\1$(TODAY)|" doc/ChangeLog
+
release: clean version
mkdir -p ../$(MODULE_NAME)-2.$(TODAY)
rm -f ../$(MODULE_NAME)-2.$(TODAY).tar ../$(MODULE_NAME)-2.$(TODAY).tar.gz
(cd ..; tar cvf $(MODULE_NAME)-2.$(TODAY).tar $(MODULE_NAME)-2.$(TODAY); gzip -9 $(MODULE_NAME)-2.$(TODAY).tar)
+else
+# Support for kernel build system invocation
+
+ifneq ($(MODULE_BRANCH), release)
+EXTRA_CFLAGS += -DOMNIBOOK_MODULE_VERSION='"$(MODULE_VERSION)-$(MODULE_BRANCH)"'
+else
+EXTRA_CFLAGS += -DOMNIBOOK_MODULE_VERSION='"$(MODULE_VERSION)"'
+endif
+
+ifeq ($(OMNIBOOK_STANDALONE),y)
+
+ifeq ($(OMNIBOOK_WANT_BACKLIGHT),y)
+ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
+# we support backlight interface only after 2.6.16
+ifeq ($(shell if [ $(SUBLEVEL) -gt 16 ] ; then echo -n 'y'; fi),y)
+EXTRA_CFLAGS += -DCONFIG_OMNIBOOK_BACKLIGHT
+else
+$(warning "Backlight support in only supported for kernel version newer than 2.6.16")
+$(warning "Disabling backlight sysfs interface")
+endif
+endif
+endif
+
+ifeq ($(OMNIBOOK_WANT_LEGACY),y)
+EXTRA_CFLAGS += -DCONFIG_OMNIBOOK_LEGACY
+endif
+
+ifndef CONFIG_ACPI_EC
+EXTRA_CFLAGS += -DCONFIG_OMNIBOOK_LEGACY
+endif
+
+ifneq ($(MODULE_BRANCH), release)
+ifneq ($(OMNIBOOK_WANT_DEBUG),n)
+EXTRA_CFLAGS += -DCONFIG_OMNIBOOK_DEBUG # -Wa -g0
+endif
+else
+ifeq ($(OMNIBOOK_WANT_DEBUG),y)
+EXTRA_CFLAGS += -DCONFIG_OMNIBOOK_DEBUG # -Wa -g0
+endif
+
+endif
+
+endif
+
+EXTRA_CFLAGS += -DOMNIBOOK_MODULE_NAME='"$(MODULE_NAME)"'
+EXTRA_LDFLAGS += $(src)/sections.lds
+
+obj-$(CONFIG_OMNIBOOK) += $(MODULE_NAME).o
+omnibook-objs := init.o lib.o ec.o kbc.o pio.o compal.o acpi.o nbsmi.o \
+ ac.o battery.o blank.o bluetooth.o cooling.o display.o dock.o \
+ dump.o fan.o fan_policy.o hotkeys.o info.o lcd.o muteled.o \
+ polling.o temperature.o touchpad.o wireless.o throttling.o
+
+endif # End of kernel build system part
+
# End of file
* General Public License for more details.
*
* Written by Soós Péter <sp@osb.hu>, 2002-2004
- * Modified by Mathieu Bérard <mathieu.berard@crans.org>, 2006
+ * Modified by Mathieu Bérard <mathieu.berard@crans.org>, 2006-2007
*/
#include <linux/module.h>
#include <linux/input.h>
#include <linux/version.h>
-/*
- * Module informations
- */
-
-#define OMNIBOOK_MODULE_NAME "omnibook"
-#define OMNIBOOK_MODULE_VERSION "2.20070211-trunk"
-
/*
* EC types
*/
#define dprintk_simple(fmt, args...) do { } while(0)
#endif
-
-
-
-/*
- * Configuration for standalone compilation:
- * -Register as backlight depends on kernel config (requires 2.6.17+ interface)
- * -Legacy features disabled for ACPI enabled system
- */
-
-#ifdef OMNIBOOK_STANDALONE
-#if (defined (CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE)) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16))
-#define CONFIG_OMNIBOOK_BACKLIGHT
-#else
-#undef CONFIG_OMNIBOOK_BACKLIGHT
-#endif /* BACKLIGHT_CLASS_DEVICE */
-#ifdef CONFIG_ACPI_EC
-#undef CONFIG_OMNIBOOK_LEGACY
-#else
-#define CONFIG_OMNIBOOK_LEGACY
-#endif /* CONFIG_ACPI_EC */
-#endif /* OMNIBOOK_STANDALONE */
-
/* End of file */