-CFLAGS+=-I${.CURDIR}/../primes
-MAN6= factor.0
-MLINKS+=factor.6 primes.6
-.PATH: ${.CURDIR}/../primes
+CPPFLAGS+=-I${PRIMES}
+
+.if (${MKCRYPTO} != "no")
+CPPFLAGS+=-DHAVE_OPENSSL
+LDADD+= -lcrypto -lcrypt
+DPADD+= ${LIBCRYPTO} ${LIBCRYPT}
+.endif
+
+MAN= factor.6
+.PATH: ${PRIMES}