-# $NetBSD: Makefile,v 1.5 1997/08/11 14:06:10 christos Exp $
+# $NetBSD: Makefile,v 1.14 2013/02/16 16:30:28 jmcneill Exp $
# @(#)Makefile 8.1 (Berkeley) 6/12/93
-WARNS?= 1
PROG= adventure
SRCS= main.c init.c done.c save.c subr.c vocab.c wizard.c io.c data.c crc.c
MAN= adventure.6
-HIDEGAME=hidegame
-CLEANFILES+=setup data.c
+CLEANFILES+=mkdata data.c
-data.c: glorkz setup
- ./setup ${.CURDIR}/glorkz > data.c
+all: $(PROG)
-setup: setup.c hdr.h
- ${HOST_CC} -o setup ${.CURDIR}/setup.c
+$(PROG): $(SRCS)
+ $(CC) $(CFLAGS) -o $(PROG) $(SRCS)
+ $(STRIP) $(PROG)
-.include <bsd.prog.mk>
+data.c: glorkz mkdata
+ ./mkdata glorkz > data.c
+
+mkdata: setup.c
+ clang -o mkdata setup.c
+
+install: $(PROG) $(MAN)
+ $(GINSTALL) -Dm755 $(PROG) $(DESTDIR)/$(PREFIX)/games/$(PROG)
+ $(GINSTALL) -Dm644 $(MAN) $(DESTDIR)/$(PREFIX)/share/man/man6/$(MAN)
+
+clean:
+ rm -f $(CLEANFILES) $(PROG)
+
+.PHONY: all clean install