packages: move Xorg category to its own feed, move X-related packages as well
[openwrt/svn-archive/archive.git] / net / shfs / patches / 100-kmod_build.patch
1 Index: shfs-0.35/shfs/Linux-2.4/Makefile
2 ===================================================================
3 --- shfs-0.35.orig/shfs/Linux-2.4/Makefile 2007-06-04 13:22:58.143016200 +0200
4 +++ shfs-0.35/shfs/Linux-2.4/Makefile 2007-06-04 13:22:58.209006168 +0200
5 @@ -1,3 +1,13 @@
6 +#
7 +# the original Makefile was trashed and replaced by this one
8 +# The main reason is that loadable modules should be built with
9 +# the same compile flags the kernel was built with, so we'd better
10 +# let the kernel tree build the module for us, like that :
11 +#
12 +# make -C $(KERNEL_DIR) SUBDIRS="$(shell pwd)" modules
13 +# make -C $(KERNEL_DIR) SUBDIRS="$(shell pwd)" modules_install
14 +#
15 +
16 ifndef KERNEL
17 KERNEL=$(shell uname -r)
18 endif
19 @@ -10,67 +20,29 @@
20 KERNEL_SOURCES=${MODULESDIR}/build
21 endif
22
23 -ifeq (${MODVERSIONS},detect)
24 - ifeq ($(shell test -e ${KERNEL_SOURCES}/include/linux/modversions.h; echo $$?),0)
25 - MODVERSIONS=yes
26 - endif
27 -endif
28 -
29 -ifeq (${MODVERSIONS},yes)
30 -MVER=-DMODVERSIONS -DEXPORT_SYMTAB
31 -endif
32 -
33 -LINVER=linux-${KERNEL}
34 -
35 -ALL_TARGETS := shfs.o
36 -
37 -SEARCHDIRS := -I- -I. -I${KERNEL_SOURCES}/include #-I/usr/src/linux/include/
38 +all: all-y
39
40 -CC := gcc
41 -CFLAGS = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -Wall ${SEARCHDIRS} -DMODULE ${MVER} -D__KERNEL__ -DLINUX
42 -LINKER := ld
43 -LDFLAGS = -r
44 -LOADLIBES :=
45 +O_TARGET := shfs.o
46
47 -all: ${ALL_TARGETS}
48 +shfs-objs := dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o
49
50 -%.o: %.c $(wildcard *.h)
51 - ${CC} ${CFLAGS} -c $< -o $@
52 +obj-y := $(shfs-objs)
53 +obj-m := $(O_TARGET)
54
55 -shfs.o: dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o
56 - ${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES}
57 -
58 -tidy:
59 - ${RM} core dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o
60 -
61 -clean: tidy patch-clean
62 - ${RM} shfs.o
63 +-include $(TOPDIR)/Rules.make
64
65 +all-y:
66 + make -C ${KERNEL_SOURCES} TOPDIR="${KERNEL_SOURCES}" SUBDIRS="$(shell pwd)" modules
67 +
68 install: shfs.o
69 rm -f ${MODULESDIR}/kernel/fs/shfs/shfs.o
70 install -m644 -b -D shfs.o ${MODULESDIR}/kernel/fs/shfs/shfs.o
71 - if [ -x /sbin/depmod -a "${ROOT}" = "/" ]; then /sbin/depmod -aq; fi
72
73 uninstall:
74 rm -rf ${MODULESDIR}/kernel/fs/shfs
75 - if [ -x /sbin/depmod -a "${ROOT}" = "/" ]; then /sbin/depmod -aq; fi
76
77 -patch:
78 - rm -rf ${LINVER} ${LINVER}.orig; mkdir ${LINVER};
79 - for i in Documentation fs/shfs include/linux; do \
80 - mkdir -p ${LINVER}/$$i; \
81 - done
82 - cp ${KERNEL_SOURCES}/Documentation/Configure.help ${LINVER}/Documentation
83 - cp ${KERNEL_SOURCES}/fs/{Makefile,Config.in} ${LINVER}/fs
84 - cp -r ${LINVER} ${LINVER}.orig
85 - cp ../../Changelog *.c shfs_debug.h proc.h ${LINVER}/fs/shfs/
86 - cp shfs.h shfs_fs* ${LINVER}/include/linux/
87 - (cd ${LINVER}; patch -p1 <../kernel-config.diff)
88 - find . -type f -name "*.orig" -print | xargs rm -f
89 - diff -urN ${LINVER}.orig ${LINVER} >${LINVER}.diff; true
90 -
91 -patch-clean:
92 - rm -rf ${LINVER} ${LINVER}.orig;
93 - rm -f ${LINVER}.diff
94 -
95 -.PHONY : all tidy clean install uninstall patch patch-clean
96 +clean:
97 + rm -f core *.o *.a *.s
98 +
99 +shfs.o: $(shfs-objs)
100 +