From 37b15e188e5ad05c479e02c706de2bdc5b4dd2b6 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 6 Feb 2006 03:21:17 +0000 Subject: [PATCH] --enable-kbuild option of configure script works now. --- comedi/Kbuild | 5 ++-- comedi/Makefile.am | 25 ++++++++++++++++++++ comedi/drivers/Kbuild | 34 ++++++++++------------------ comedi/drivers/Makefile.am | 4 ++++ comedi/drivers/addi-data/Makefile.am | 4 ++++ comedi/kcomedilib/Makefile.am | 4 ++++ configure.ac | 1 + 7 files changed, 53 insertions(+), 24 deletions(-) diff --git a/comedi/Kbuild b/comedi/Kbuild index 2a673d3d..b744d040 100644 --- a/comedi/Kbuild +++ b/comedi/Kbuild @@ -1,8 +1,9 @@ +include comedi_kbuild.inc + obj-m += comedi.o comedi-y := comedi_fops.o proc.o range.o drivers.o comedi_ksyms.o -#FIXME: these should be added for rt-enabled kernels -#comedi-y += rt_pend_tq.o rt.o +comedi-$(CONFIG_COMEDI_RT) += rt_pend_tq.o rt.o obj-y += kcomedilib/ obj-y += drivers/ diff --git a/comedi/Makefile.am b/comedi/Makefile.am index 3b146e9f..58ffed1c 100644 --- a/comedi/Makefile.am +++ b/comedi/Makefile.am @@ -1,7 +1,20 @@ SUBDIRS = . kcomedilib drivers +if CONFIG_KBUILD +module_PROGRAMS = +all-local: comedi_kbuild.inc + make -I@abs_builddir@ -C $(LINUX_DIR) M=@abs_builddir@ CC="$(LINUX_CC) -I@abs_top_srcdir@/ -I @abs_top_srcdir@/include" V=1 modules +install-data-local: comedi_kbuild.inc + make -I@abs_builddir@ -C $(LINUX_DIR) M=@abs_builddir@ CC="$(LINUX_CC) -I@abs_top_srcdir@/ -I @abs_top_srcdir@/include" V=1 modules_install +clean-local: comedi_kbuild.inc + make -I@abs_builddir@ -C $(LINUX_DIR) M=@abs_builddir@ CC="$(LINUX_CC) -I@abs_top_srcdir@/ -I @abs_top_srcdir@/include" V=1 clean +else module_PROGRAMS = comedi.ko +all-local: +install-data-local: +clean-local: +endif EXTRA_DIST = \ rt_pend_tq.h @@ -30,3 +43,15 @@ clean-modulePROGRAMS: -test -z "$(module_PROGRAMS)" || rm -f $(module_PROGRAMS) -rm -rf .mods +comedi_kbuild.inc: Makefile + echo > $@ +if CONFIG_COMEDI_RT + echo CONFIG_COMEDI_RT=y >> $@ + echo CONFIG_COMEDI_RT_MODULES=m >> $@ +endif +if CONFIG_PCMCIA + echo CONFIG_COMEDI_PCMCIA_MODULES=m >> $@ +endif +if CONFIG_USB + echo CONFIG_COMEDI_USB_MODULES=m >> $@ +endif diff --git a/comedi/drivers/Kbuild b/comedi/drivers/Kbuild index 2eea3ce3..2cff37b3 100644 --- a/comedi/drivers/Kbuild +++ b/comedi/drivers/Kbuild @@ -1,30 +1,20 @@ -obj-y += addi-data/ +include comedi_kbuild.inc -#FIXME: deal with conditionally compiled rt/pcmcia/usb modules +obj-y += addi-data/ -#if CONFIG_COMEDI_RT -#rt_modules = comedi_rt_timer.ko -#endif +obj-$(CONFIG_COMEDI_RT_MODULES) += comedi_rt_timer.o -#if CONFIG_PCMCIA -#pcmcia_modules= \ -# cb_das16_cs.ko \ -# das08_cs.ko \ -# ni_daq_dio24.ko \ -# ni_mio_cs.ko \ -# ni_labpc_cs.ko \ -# quatech_daqp_cs.ko -#endif +obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += cb_das16_cs.o +obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += das08_cs.o +obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += ni_daq_dio24.o +obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += ni_mio_cs.o +obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += ni_labpc_cs.o +obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += quatech_daqp_cs.o -#if CONFIG_USB -#usb_modules= \ -# usbdux.ko \ -# usbduxfast.ko \ -# dt9812.ko -#else -#usb_modules= -#endif +obj-$(CONFIG_COMEDI_USB_MODULES) += usbdux.o +obj-$(CONFIG_COMEDI_USB_MODULES) += usbduxfast.o +obj-$(CONFIG_COMEDI_USB_MODULES) += dt9812.o obj-m += 8255.o obj-m += amcc_s5933.o diff --git a/comedi/drivers/Makefile.am b/comedi/drivers/Makefile.am index c32cd8d7..66bd1ab0 100644 --- a/comedi/drivers/Makefile.am +++ b/comedi/drivers/Makefile.am @@ -81,6 +81,9 @@ else usb_modules= endif +if CONFIG_KBUILD +module_PROGRAMS = +else !CONFIG_KBUILD module_PROGRAMS = \ 8255.ko \ amcc_s5933.ko \ @@ -163,6 +166,7 @@ module_PROGRAMS = \ $(pcmcia_modules) \ $(usb_modules) \ $(rt_modules) +endif !CONFIG_KBUILD 8255_ko_SOURCES = 8255.c acl7225b_ko_SOURCES = acl7225b.c diff --git a/comedi/drivers/addi-data/Makefile.am b/comedi/drivers/addi-data/Makefile.am index e12b7fbd..1105db4e 100644 --- a/comedi/drivers/addi-data/Makefile.am +++ b/comedi/drivers/addi-data/Makefile.am @@ -2,7 +2,11 @@ AM_CFLAGS = $(COMEDI_CFLAGS) $(LINUX_CFLAGS) $(RTAI_CFLAGS) $(RTLINUX_CFLAGS) LINK = $(top_builddir)/modtool --link -o $@ +if CONFIG_KBUILD +module_PROGRAMS = +else module_PROGRAMS = addi_common.ko +endif addi_common_ko_SOURCES = addi_common.c diff --git a/comedi/kcomedilib/Makefile.am b/comedi/kcomedilib/Makefile.am index aceb2359..8ad6a639 100644 --- a/comedi/kcomedilib/Makefile.am +++ b/comedi/kcomedilib/Makefile.am @@ -1,5 +1,9 @@ +if CONFIG_KBUILD +module_PROGRAMS = +else module_PROGRAMS = kcomedilib.ko +endif kcomedilib_ko_SOURCES = data.c ksyms.c dio.c kcomedilib_main.c get.c kcomedilib_ko_CFLAGS = $(COMEDI_CFLAGS) $(LINUX_CFLAGS) $(RTAI_CFLAGS) $(RTLINUX_CFLAGS) diff --git a/configure.ac b/configure.ac index dd4870ce..04335996 100644 --- a/configure.ac +++ b/configure.ac @@ -69,6 +69,7 @@ else fi AC_ARG_ENABLE([kbuild], [ --enable-kbuild Build modules using kernel's kbuild system (needs recent 2.6 kernel)], [ENABLE_KBUILD=$enableval], [ENABLE_KBUILD="no"]) +AM_CONDITIONAL([CONFIG_KBUILD], [test ${ENABLE_KBUILD} = "yes"]) AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_ISA) AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_PCI) AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_USB) -- 2.26.2