-# $NetBSD: Makefile,v 1.9 2002/06/16 22:24:01 itojun Exp $
+# $NetBSD: Makefile,v 1.13 2017/05/21 15:28:41 riastradh Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# For MKCRYPTO
-.include <bsd.own.mk>
-
PROG= factor
-SRCS= factor.c pr_tbl.c
-CPPFLAGS+=-I${.CURDIR}/../primes
+SRCS= factor.c ../primes/pr_tbl.c
+MAN= factor.6
-.if (${MKCRYPTO} != "no")
-CPPFLAGS+=-DHAVE_OPENSSL
-LDADD+= -lcrypto
-DPADD+= ${LIBCRYPTO}
-.endif
+all: $(PROG)
-MAN= factor.6
-MLINKS+=factor.6 primes.6
-.PATH: ${.CURDIR}/../primes
+$(PROG): $(SRCS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(SRCS) -I../primes -DHAVE_OPENSSL -lcrypto
+ $(STRIP) $(PROG)
+
+install: $(PROG) $(MAN)
+ $(GINSTALL) -Dm755 $(PROG) $(DESTDIR)/$(PREFIX)/games/$(PROG)
+ $(GINSTALL) -Dm644 $(MAN) $(DESTDIR)/$(PREFIX)/share/man/man6/$(MAN)
+
+clean:
+ rm -f $(CLEANFILES) $(PROG)
-.include <bsd.prog.mk>
+.PHONY: all clean install