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