Me := $(lastword ${MAKEFILE_LIST}) include var.mk Patches = 'http://marc.info/?l=linux-fsdevel&m=127884119303014&q=raw' \ 'http://marc.info/?l=linux-fsdevel&m=127884119203011&q=raw' \ 'http://marc.info/?l=linux-fsdevel&m=127884119303017&q=raw' Sq40ParaDir = sq40para all: @echo \- Get linux-2.6.${KVer} and extract it under a dir named ${Linux26} @echo \- Build linux-2.6.${KVer} by \"cd ${Linux26} '&& make &&' make headers_install\" @echo \- Get squashfs4.0 parallel decompression patch by \"make -f ${Me} download\" @echo \- Apply the patches to linux-2.6.${KVer} and build the module by \"make -f ${Me} build\" @echo -e \\t+ The build process uses AUFS by default. If you don\'t install AUFS, then define NoBuildByAUFS by \"make -f ${Me} NoBuildByAUFS=1 build\" clean: ${RM} -r ${Sq40ParaDir} realclean: clean ${RM} -r sq40para.*.patch sq40para-download download build: %: sq40para-% ######################################## sq40para-download: n=0; \ for i in ${Patches}; \ do \ wget --no-verbose $${i} -O sq40para.$${n}.patch; \ n=$$(($${n} + 1)); \ done touch $@ define ApplySq40para for i in sq40para.*.patch; \ do patch -s -d ${1} -p3 < $${i}; \ done endef sq40para-build: dir = ${Linux26}/fs/squashfs sq40para-build: sq40para-download mkdir -p ${Sq40ParaDir} ifdef NoBuildByAUFS lndir -silent ${dir} ${Sq40ParaDir} ${RM} ${Sq40ParaDir}/*.o ${Sq40ParaDir}/*.ko $(call ApplySq40para, ${Sq40ParaDir}) ${MAKE} -C ${Linux26} M=${CURDIR}/${Sq40ParaDir} modules else sudo mount -t aufs -o br=${Sq40ParaDir}:${dir} none ${dir} $(call ApplySq40para, ${dir}) ${MAKE} -C ${Linux26} modules sudo umount ${dir} endif