1 # $Id: Makefile.common,v 5.10 2008/09/27 16:08:39 lirc Exp $
3 # where the kernel sources are located
4 KERNEL_LOCATION=@kerneldir@
8 # some magic for using linux kernel settings
9 # when compiling module(s)
11 LIRC_EXTRA_CFLAGS = -DIRCTL_DEV_MAJOR=$(lirc_major) -DEXPORT_SYMTAB $(DEFS) \
12 $(DEFAULT_INCLUDES) -I$(LIRC_DEVDIR)/$(srcdir) -I$(LIRC_DEVDIR)/$(builddir) \
13 -I$(LIRC_DEVDIR)/$(top_srcdir) -I$(LIRC_DEVDIR)/$(top_builddir) \
14 -I$(KERNEL_LOCATION)/include/ \
15 -I$(KERNEL_LOCATION)/drivers/media/video/
16 export LIRC_EXTRA_CFLAGS KERNEL_LOCATION module_DATA
18 $(module_DATA): $(automake_dummy_SOURCES) $(top_builddir)/config.h ../lirc.h
19 @if test "$(srcdir)" != "$(builddir)" ; then \
20 for f in $(automake_dummy_SOURCES) ; do \
21 [ -e $$f ] || ln -s $(srcdir)/$$f $$f || exit $$? ; \
24 -cp $(srcdir)/../lirc_dev/Module*.symvers .
25 mv Makefile Makefile.automake
26 cp $(srcdir)/../Makefile.kernel Makefile
27 CPPFLAGS="" CFLAGS="" LDFLAGS="" \
28 $(MAKE) -C $(KERNEL_LOCATION) SUBDIRS=$(LIRC_DEVDIR) modules \
29 KBUILD_VERBOSE=$(KBUILD_VERBOSE)
30 mv Makefile.automake Makefile
32 install-moduleDATA: $(module_DATA)
33 $(mkinstalldirs) $(DESTDIR)$(moduledir)
34 @list='$(module_DATA:.o=.@kernelext@)'; for p in $$list; do \
35 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
36 f="`echo $$p | sed -e 's|^.*/||'`"; \
37 echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(moduledir)/$$f"; \
38 $(INSTALL_DATA) $$d$$p $(DESTDIR)$(moduledir)/$$f; \
42 @list='$(module_DATA:.o=.@kernelext@)'; for p in $$list; do \
43 f="`echo $$p | sed -e 's|^.*/||'`"; \
44 echo " rm -f $(DESTDIR)$(moduledir)/$$f"; \
45 rm -f $(DESTDIR)$(moduledir)/$$f; \
50 install-exec-local: mkdev
51 uninstall-local: rmdev
55 test -e $(DESTDIR)$(devdir)/lirc || ($(mkinstalldirs) $(DESTDIR)$(devdir) && @mknod@ $(DESTDIR)$(devdir)/lirc c @lirc_major@ 0)
58 -test -c $(DESTDIR)$(devdir)/lirc && $(RM) $(DESTDIR)$(devdir)/lirc
62 install-data-local: install-moduleDATA
66 CLEANFILES = $(module_DATA) .$(module_DATA).flags $(module_DATA:.o=.mod.c) $(module_DATA:.o=.@kernelext@) *~