DragonFly BSD
DragonFly kernel List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

*.patch files with subdirectories under ${CONTRIBDIR}


From: YONETANI Tomokazu <qhwt+dfly@xxxxxxxxxx>
Date: Sun, 21 Nov 2004 12:56:59 +0900

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



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]