summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2024-04-01 15:48:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2024-04-01 15:48:17 +0000
commit27d3494d26982d5f1c0abb47c3dc443eaefdb7a2 (patch)
tree08473a318e0e95135a9a4bb83ca5e0ee29a34f0e /usr.bin
parentcb816bf5576cb0312ae5d9f6f7b7435fdab7ede9 (diff)
new-style relink kit for sshd. The old scheme created a Makefile by
concatenating two Makefiles and was incredibly fragile. In the new way a narrow-purposed install.sh script is created and shipped with the objects. A recently commited /etc/rc script understands these files.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sshd/Makefile28
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/ssh/sshd/Makefile b/usr.bin/ssh/sshd/Makefile
index 5cf81da1ccf..77a0b8d0ccd 100644
--- a/usr.bin/ssh/sshd/Makefile
+++ b/usr.bin/ssh/sshd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.109 2024/02/10 11:28:52 naddy Exp $
+# $OpenBSD: Makefile,v 1.110 2024/04/01 15:48:16 deraadt Exp $
.PATH: ${.CURDIR}/..
@@ -50,21 +50,21 @@ DPADD+= ${LIBZ}
# The random relink kit, used on OpenBSD by /etc/rc
-CLEANFILES+= Makefile.relink sshd.tar
+CLEANFILES+= sshd.tar install.sh
-Makefile.relink: ${.CURDIR}/../Makefile.inc ${.CURDIR}/Makefile
- # XXX assume a concatenation of these is OK
- cat ${.CURDIR}/../Makefile.inc ${.CURDIR}/Makefile > Makefile.relink
+install.sh: Makefile
+ echo "set -o errexit" > $@
+ echo "${CC} ${LDFLAGS} ${LDSTATIC} -o ${PROG}" \
+ "\`echo " ${OBJS} "| tr ' ' '\\\n' | sort -R\`" ${LDADD} >> $@
+ echo "./${PROG} -V # test it works" >> $@
+ echo "install -c -s -o root -g bin -m ${BINMODE} ${PROG} " \
+ "${BINDIR}/${PROG}" >> $@
-sshd.tar: ${OBJS} Makefile.relink
- tar cf $@ ${OBJS} Makefile.relink
+${PROG}.tar: ${OBJS} install.sh
+ tar cf $@ ${OBJS} install.sh
-afterinstall: sshd.tar
+afterinstall: ${PROG}.tar
install -d -o root -g wheel -m 755 \
- ${DESTDIR}/usr/share/relink/usr/sbin/sshd
+ ${DESTDIR}/usr/share/relink/${BINDIR}/${PROG}
install -o ${BINOWN} -g ${BINGRP} -m 640 \
- sshd.tar ${DESTDIR}/usr/share/relink/usr/sbin/sshd/sshd.tar
-
-relink:
- cc -o sshd `echo ${OBJS} | tr ' ' '\n' | sort -R` ${LDADD}
- ./sshd -V && install -o root -g wheel -m ${BINMODE} sshd /usr/sbin/sshd
+ ${PROG}.tar ${DESTDIR}/usr/share/relink/${BINDIR}/${PROG}/${PROG}.tar