# $Id: Makefile.common,v 5.4 2007/01/17 08:50:31 lirc Exp $ # where the kernel sources are located KERNEL_LOCATION=@kerneldir@ LIRC_DEVDIR = $(shell pwd) # some magic for using linux kernel settings # when compiling module(s) KBUILD_VERBOSE = 1 LIRC_EXTRA_CFLAGS = -DIRCTL_DEV_MAJOR=$(lirc_major) -DEXPORT_SYMTAB $(DEFS) \ $(DEFAULT_INCLUDES) -I$(LIRC_DEVDIR)/../.. \ -I$(KERNEL_LOCATION)/include/ \ -I$(KERNEL_LOCATION)/drivers/media/video/ export LIRC_EXTRA_CFLAGS KERNEL_LOCATION module_DATA $(module_DATA): $(automake_dummy_SOURCES) $(top_srcdir)/config.h ../lirc.h mv Makefile Makefile.automake cp ../Makefile.kernel Makefile $(MAKE) -C $(KERNEL_LOCATION) SUBDIRS=$(LIRC_DEVDIR) modules \ KBUILD_VERBOSE=$(KBUILD_VERBOSE) mv Makefile.automake Makefile install-moduleDATA: $(module_DATA) $(mkinstalldirs) $(DESTDIR)$(moduledir) @list='$(module_DATA:.o=.@kernelext@)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(moduledir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(moduledir)/$$f; \ done uninstall-moduleDATA: @list='$(module_DATA:.o=.@kernelext@)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(moduledir)/$$f"; \ rm -f $(DESTDIR)$(moduledir)/$$f; \ done if SANDBOXED else install-exec-local: mkdev uninstall-local: rmdev endif mkdev: test -e $(DESTDIR)$(devdir)/lirc || ($(mkinstalldirs) $(DESTDIR)$(devdir) && @mknod@ $(DESTDIR)$(devdir)/lirc c @lirc_major@ 0) rmdev: -test -c $(DESTDIR)$(devdir)/lirc && $(RM) $(DESTDIR)$(devdir)/lirc if SANDBOXED else install-data-local: install-moduleDATA -@depmod@ -a endif CLEANFILES = $(module_DATA) .$(module_DATA).flags $(module_DATA:.o=.mod.c) $(module_DATA:.o=.@kernelext@) *~