*.patch files with subdirectories under ${CONTRIBDIR}

看板DFBSD_kernel作者時間21年前 (2004/11/21 20:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/5 (看更多)
Hello. There are two files in ${CONTRIBDIR} to be patched: ${CONTRIBDIR}/foo/foo.c ${CONTRIBDIR}/bar/bar.c And I have two patch files named foo,foo.c.patch and bar,bar.c.patch. All you have to do is to add ${.OBJDIR}/foo and ${.OBJDIR}/bar in the ..PATH, and name the patches in SRCS list. <bsd.dep.mk> replaces commas with slashes, so that `make depend' correctly find the files to patch in ${CONTRIBDIR}. Patched files are created in ${.OBJDIR} with directories as ${.OBJDIR}/foo/foo.c and ${.OBJDIR}/bar/bar.c . Also the *.patch files in SRCS list are replaced with foo foo/foo.c and bar/bar.c . (A) The patched *.c files get compiled as ${.OBJDIR}/foo.o and ${.OBJDIR}/bar.o . (are these supposed be ${.OBJDIR}/foo/foo.o and ${.OBJDIR}/bar/bar.o?) (B) However, rules in <bsd.prog.mk> and <bsd.lib.mk> don't take care to replace the commas with slashes, and they add foo,foo.o and bar,bar.o to OBJS, and the build fails. I'm not 100% sure how to fix this. To only cope with (B), the following patch should do the job(though I haven't gone though full buildworld yet). Index: bsd.lib.mk =================================================================== RCS file: /home/source/dragonfly/cvs/src/share/mk/bsd.lib.mk,v retrieving revision 1.7 diff -u -r1.7 bsd.lib.mk --- bsd.lib.mk 26 Jul 2004 14:29:11 -0000 1.7 +++ bsd.lib.mk 21 Nov 2004 03:41:27 -0000 @@ -149,7 +149,7 @@ .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) OBJS+= ${SRCS:N*.h:N*.patch:R:S/$/.o/g} .for _PATCH in ${SRCS:T:N*.no_obj.patch:N*.h.patch:M*.patch} -.for _OBJ in ${_PATCH:R:R:S/$/.o/} +.for _OBJ in ${_PATCH:R:R:C/^.*,(.*)$/\1.o/} OBJS:= ${OBJS:N${_OBJ}} ${_OBJ} .endfor .endfor Index: bsd.prog.mk =================================================================== RCS file: /home/source/dragonfly/cvs/src/share/mk/bsd.prog.mk,v retrieving revision 1.6 diff -u -r1.6 bsd.prog.mk --- bsd.prog.mk 26 Jul 2004 14:29:11 -0000 1.6 +++ bsd.prog.mk 21 Nov 2004 03:41:30 -0000 @@ -31,7 +31,7 @@ OBJS+= ${SRCS:N*.h:N*.patch:R:S/$/.o/g} .for _PATCH in ${SRCS:T:N*.no_obj.patch:N*.h.patch:M*.patch} -.for _OBJ in ${_PATCH:R:R:S/$/.o/} +.for _OBJ in ${_PATCH:R:R:C/^.*,(.*)$/\1.o/} OBJS:= ${OBJS:N${_OBJ}} ${_OBJ} .endfor .endfor
文章代碼(AID): #11e8EZ00 (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #11e8EZ00 (DFBSD_kernel)