From a0880129a545dbb7ff35b456429b12e55146ef5d Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 2 Nov 2021 14:48:33 -0400 Subject: [PATCH] ssh: move common Makefile boilerplate to a new ssh.mk This moves SSHDIR and ssh_namespace.h handling to a common location, and will simplify future work such as adding U2F support (D32509). Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32808 (cherry picked from commit 9d63429fa16352f58037ac2aa6ddc734b25e8331) --- secure/Makefile.inc | 6 ------ secure/lib/libssh/Makefile | 4 +--- secure/libexec/sftp-server/Makefile | 3 +-- secure/libexec/ssh-keysign/Makefile | 3 +-- secure/libexec/ssh-pkcs11-helper/Makefile | 3 +-- secure/ssh.mk | 6 ++++++ secure/usr.bin/scp/Makefile | 3 +-- secure/usr.bin/sftp/Makefile | 3 +-- secure/usr.bin/ssh-add/Makefile | 3 +-- secure/usr.bin/ssh-agent/Makefile | 3 +-- secure/usr.bin/ssh-keygen/Makefile | 3 +-- secure/usr.bin/ssh-keyscan/Makefile | 3 +-- secure/usr.bin/ssh/Makefile | 4 +--- secure/usr.sbin/sshd/Makefile | 3 +-- 14 files changed, 18 insertions(+), 32 deletions(-) create mode 100644 secure/ssh.mk diff --git a/secure/Makefile.inc b/secure/Makefile.inc index 6c298be0223f..5de6eed37faf 100644 --- a/secure/Makefile.inc +++ b/secure/Makefile.inc @@ -1,15 +1,9 @@ # $FreeBSD$ -.include - .if exists(${.CURDIR:H:H}/lib/libcrypt/obj) CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt/obj .else CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt .endif -.if ${MK_OPENSSH} != "no" -SSHDIR= ${SRCTOP}/crypto/openssh -.endif - WARNS?= 0 diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index aa3dc27fb526..b7a6ba61700e 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" LIB= ssh PRIVATELIB= true @@ -45,9 +46,6 @@ SRCS+= getrrsetbyname-ldns.c LIBADD+= ldns .endif -CFLAGS+= -I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - .if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" CFLAGS+= -include krb5_config.h SRCS+= krb5_config.h diff --git a/secure/libexec/sftp-server/Makefile b/secure/libexec/sftp-server/Makefile index 24d675e0cf16..97408d332d34 100644 --- a/secure/libexec/sftp-server/Makefile +++ b/secure/libexec/sftp-server/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp-server SRCS= sftp-server.c sftp-common.c sftp-server-main.c MAN= sftp-server.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/libexec/ssh-keysign/Makefile b/secure/libexec/ssh-keysign/Makefile index e3fc51c66432..72acf1c2d75e 100644 --- a/secure/libexec/ssh-keysign/Makefile +++ b/secure/libexec/ssh-keysign/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keysign SRCS= ssh-keysign.c readconf.c uidswap.c MAN= ssh-keysign.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h BINMODE=4555 LIBADD= ssh diff --git a/secure/libexec/ssh-pkcs11-helper/Makefile b/secure/libexec/ssh-pkcs11-helper/Makefile index 19e114be935d..c4ae4f503197 100644 --- a/secure/libexec/ssh-pkcs11-helper/Makefile +++ b/secure/libexec/ssh-pkcs11-helper/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-pkcs11-helper SRCS= ssh-pkcs11.c ssh-pkcs11-helper.c MAN= ssh-pkcs11-helper.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/ssh.mk b/secure/ssh.mk new file mode 100644 index 000000000000..4ab8cd399ae8 --- /dev/null +++ b/secure/ssh.mk @@ -0,0 +1,6 @@ +# Common Make variables for OpenSSH + +SSHDIR= ${SRCTOP}/crypto/openssh + +CFLAGS+= -I${SSHDIR} -include ssh_namespace.h +SRCS+= ssh_namespace.h diff --git a/secure/usr.bin/scp/Makefile b/secure/usr.bin/scp/Makefile index 34469a443287..34caf79cf8bd 100644 --- a/secure/usr.bin/scp/Makefile +++ b/secure/usr.bin/scp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= scp SRCS= scp.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/sftp/Makefile b/secure/usr.bin/sftp/Makefile index 249fef233d37..868f7a23bfde 100644 --- a/secure/usr.bin/sftp/Makefile +++ b/secure/usr.bin/sftp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp SRCS= sftp.c sftp-client.c sftp-common.c sftp-glob.c progressmeter.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh edit diff --git a/secure/usr.bin/ssh-add/Makefile b/secure/usr.bin/ssh-add/Makefile index acce73d3841d..173b46c78e0d 100644 --- a/secure/usr.bin/ssh-add/Makefile +++ b/secure/usr.bin/ssh-add/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-add SRCS+= ssh-add.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-agent/Makefile b/secure/usr.bin/ssh-agent/Makefile index 95ccd05811fe..c8139ec376c3 100644 --- a/secure/usr.bin/ssh-agent/Makefile +++ b/secure/usr.bin/ssh-agent/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-agent SRCS= ssh-agent.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keygen/Makefile b/secure/usr.bin/ssh-keygen/Makefile index d6b5616dfc0a..e32a6b84302f 100644 --- a/secure/usr.bin/ssh-keygen/Makefile +++ b/secure/usr.bin/ssh-keygen/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keygen SRCS= ssh-keygen.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keyscan/Makefile b/secure/usr.bin/ssh-keyscan/Makefile index ade1e4237ff5..130e5f61ec64 100644 --- a/secure/usr.bin/ssh-keyscan/Makefile +++ b/secure/usr.bin/ssh-keyscan/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keyscan SRCS= ssh-keyscan.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile index 614cc7627fc5..5528aceed5ee 100644 --- a/secure/usr.bin/ssh/Makefile +++ b/secure/usr.bin/ssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= ssh_config CONFSDIR= /etc/ssh @@ -16,9 +17,6 @@ SRCS= ssh.c readconf.c clientloop.c sshtty.c \ # gss-genr.c really belongs in libssh; see src/secure/lib/libssh/Makefile SRCS+= gss-genr.c -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - LIBADD= ssh .if ${MK_LDNS} != "no" diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile index f5a4d94a62e6..66f4fc248d15 100644 --- a/secure/usr.sbin/sshd/Makefile +++ b/secure/usr.sbin/sshd/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= moduli sshd_config CONFSDIR= /etc/ssh @@ -25,8 +26,6 @@ PACKAGE= ssh SRCS+= gss-genr.c MAN= sshd.8 sshd_config.5 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h # Don't rebuild based on moduli.c moduli: .MADE