tech-pkg archive

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

PROGS for bootstrap-mk-files



It seems that the bsd.prog.mk in bootstrap-mk-files does not support
PROGS (only PROG). This is causing multimedia/bsdav to fail, because
it sets USE_BSD_MAKEFILE and has a makefile that depends on PROGS.

This is not easily worked around, so it seems maybe it would be better
to add the feature to bootstrap-mk-files. Meanwhile, while we should
probably update all of bootstrap-mk-files from base NetBSD, because
there are other divergences (e.g. in WARNS handling) and some of them
are known to cause problems, that is a large undertaking.

So here's a patch that just provides PROGS support.

Comments?

Index: files/bsd.prog.mk
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/bootstrap-mk-files/files/bsd.prog.mk,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bsd.prog.mk
--- files/bsd.prog.mk   14 Jul 2006 23:13:01 -0000      1.1.1.1
+++ files/bsd.prog.mk   8 Dec 2013 02:02:45 -0000
@@ -52,48 +52,66 @@
 
 
 .if defined(PROG)
-SRCS?=         ${PROG}.c
+PROGS?=                ${PROG}
+.if defined(PROGNAME)
+PROGNAME.${PROG}?=${PROGNAME}
+.endif
+.if defined(SRCS)
+SRCS.${PROG}?= ${SRCS}
+.endif
+.if defined(DPSRCS)
+DPSRCS.${PROG}?=${DPSRCS}
+.endif
+.endif
 
-DPSRCS+=       ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
-CLEANFILES+=   ${DPSRCS}
+.if defined(PROGS)
+.for P in $(PROGS)
+SRCS.${P}?=    ${P}.c
+
+DPSRCS.${P}+=  ${SRCS.${P}:M*.l:.l=.c} ${SRCS.${P}:M*.y:.y=.c}
+CLEANFILES+=   ${DPSRCS.${P}}
 .if defined(YHEADER)
-CLEANFILES+=   ${SRCS:M*.y:.y=.h}
+CLEANFILES+=   ${SRCS.${P}:M*.y:.y=.h}
 .endif
 
-.if !empty(SRCS:N*.h:N*.sh:N*.fth)
-OBJS+=         ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
-LOBJS+=                ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
+.if !empty(SRCS.${P}:N*.h:N*.sh:N*.fth)
+OBJS.${P}+=    ${SRCS.${P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
+LOBJS.${P}+=   ${LSRCS.${P}:.c=.ln} ${SRCS.${P}:M*.c:.c=.ln}
 .endif
 
-.if defined(OBJS) && !empty(OBJS)
-.NOPATH: ${OBJS}
+.if defined(OBJS.${P}) && !empty(OBJS.${P})
+.NOPATH: ${OBJS.${P}}
 .if defined(DESTDIR)
 
-${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} 
${DPADD}
-.if !commands(${PROG})
-       ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib 
-Wl,-rpath-link,${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} 
-L${DESTDIR}/usr/lib -lgcc -lc -lgcc ${LIBCRTEND}
+${P}: ${LIBCRT0} ${DPSRCS.${P}} ${OBJS.${P}} ${LIBC} ${LIBCRTBEGIN} 
${LIBCRTEND} ${DPADD} ${DPADD.${P}}
+.if !commands(${PROG.${P}})
+       ${CC} ${LDFLAGS} ${LDFLAGS.${P}} ${LDSTATIC} ${LDSTATIC.${P}} -o 
${.TARGET} -nostdlib -Wl,-rpath-link,${DESTDIR}/usr/lib ${LIBCRT0} 
${LIBCRTBEGIN} ${OBJS.${P}} ${LDADD.${P}} ${LDADD} -L${DESTDIR}/usr/lib -lgcc 
-lc -lgcc ${LIBCRTEND}
 .endif
 
 .else
 
-${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} 
${DPADD}
+${P}: ${LIBCRT0} ${DPSRCS.${P}} ${OBJS.${P}} ${LIBC} ${LIBCRTBEGIN} 
${LIBCRTEND} ${DPADD} ${DPADD.${P}}
 .if !commands(${PROG})
-       ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
+       ${CC} ${LDFLAGS} ${LDFLAGS.${P}} ${LDSTATIC} ${LDSTATIC.${P}} -o 
${.TARGET} ${OBJS.${P}} ${LDADD.${P}} ${LDADD}
 .endif
 
 .endif # defined(DESTDIR)
 .endif # defined(OBJS) && !empty(OBJS)
 
+.endfor        # P in PROGS
+
 .if !defined(MAN)
-MAN=   ${PROG}.1
+.for P in ${PROGS}
+MAN+=  ${P}.1
+.endfor
 .endif # !defined(MAN)
-.endif # defined(PROG)
+.endif # defined(PROGS)
 
-realall: ${PROG} ${SCRIPTS}
+realall: ${PROGS} ${SCRIPTS}
 
 cleanprog:
        rm -f a.out [Ee]rrs mklog core *.core \
-           ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
+           ${PROGS} ${OBJS} ${LOBJS} ${CLEANFILES}
 
 .if defined(SRCS) && !target(afterdepend)
 afterdepend: .depend
@@ -103,23 +121,26 @@
            mv $$TMP .depend)
 .endif
 
-.if defined(PROG) && !target(proginstall)
-PROGNAME?=${PROG}
-
-proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
-.PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
-.if !defined(UPDATE)
-.PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
-.endif
+.if defined(PROGS) && !target(proginstall)
 
 __proginstall: .USE
        ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${STRIPFLAG} ${INSTPRIV} \
            -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} ${.ALLSRC} ${.TARGET}
 
-.if !defined(BUILD) && !make(all) && !make(${PROG})
-${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
+.for P in ${PROGS}
+PROGNAME.${P}?=${P}
+
+proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME.${P}}
+.PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME.${P}}
+.if !defined(UPDATE)
+.PHONY: ${DESTDIR}${BINDIR}/${PROGNAME.${P}}
+.endif
+
+.if !defined(BUILD) && !make(all) && !make(${P})
+${DESTDIR}${BINDIR}/${PROGNAME.${P}}: .MADE
 .endif
-${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
+${DESTDIR}${BINDIR}/${PROGNAME.${P}}: ${P} __proginstall
+.endfor
 .endif
 
 .if !target(proginstall)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index