Subject: module install need
To: None <tech-toolchain@netbsd.org>
From: Tyler Retzlaff <rtr@netbsd.org>
List: tech-toolchain
Date: 12/16/2003 01:54:15
I've encountered the need to install an object file.
Currently I'm using a simple (but dirty) hack to bsd.lib.mk, what I
would like is some advice on how something of similar function could
be implemented in the toolchain.
Here is what I'm doing currently, but how should it be done?
--- bsd.lib.mk 7 Dec 2003 12:56:45 -0000 1.242
+++ bsd.lib.mk 15 Dec 2003 14:35:30 -0000
@@ -326,6 +326,10 @@ FFLAGS+= ${FOPTS}
${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
rm -f ${.TARGET}.tmp
+.if defined(MOD)
+LIB=${MOD}
+.endif
+
.if defined(LIB)
.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
@@ -385,16 +389,31 @@ SOBJS=
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
+.if defined(MOD)
+__archivebuild: .USE
+ ${_MKTARGET_BUILD}
+ rm -f ${.TARGET}
+ ${LD} -X -r ${OBJS} -o ${.TARGET}
+.else
__archivebuild: .USE
${_MKTARGET_BUILD}
rm -f ${.TARGET}
${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} |
${TSORT}`
${RANLIB} ${.TARGET}
+.endif
+.if defined(MOD)
+__archiveinstall: .USE
+ ${_MKTARGET_INSTALL}
+ ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${SYSPKGTAG} ${.ALLSRC} ${MOD}.o
+
+.else
__archiveinstall: .USE
${_MKTARGET_INSTALL}
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${UPDATE:D:U-a "${RANLIB} -t"} ${SYSPKGTAG} ${.ALLSRC}
${.TARGET}
+.endif
__archivesymlinkpic: .USE
${_MKTARGET_INSTALL}
--
Tyler R. Retzlaff <rtr@NetBSD.org> http://www.NetBSD.org