-# $NetBSD: Makefile,v 1.10 1997/06/30 19:33:34 phil Exp $
+# $NetBSD: Makefile,v 1.37 2014/06/14 20:49:37 mrg Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= phantasia
-SRCS= main.c fight.c io.c interplayer.c gamesupport.c misc.c phantglobs.c
-DPADD= ${LIBM} ${LIBCURSES} ${LIBTERM} ${LIBCOMPAT}
-LDADD= -lm -lcurses -ltermlib -lcompat
-HIDEGAME=hidegame
-USETBL=
+SRCS= fight.c gamesupport.c interplayer.c io.c main.c misc.c phantglobs.c
MAN= phantasia.6
-CLEANFILES+=map setup setup.o host_phantglobs.o
-all: setup phantasia
+FILESDIR=/var/games/phantasia
+FILESMODE=0660
+ALLFILES=gold lastdead mess monsters void motd characs scoreboard
+FILES=gold lastdead mess monsters void motd
-setup: host_phantglobs.o setup.o monsters.asc ${LIBM}
- ${HOST_CC} host_phantglobs.o setup.o -o ${.TARGET} -lm
+CLEANFILES+=map mkdata $(ALLFILES) files.stamp
-host_phantglobs.o: ${.CURDIR}/phantglobs.c
- ${HOST_COMPILE.c} -o host_phantglobs.o ${.CURDIR}/phantglobs.c
+all: $(PROG) $(FILES)
-setup.o: ${.CURDIR}/setup.c
- ${HOST_COMPILE.c} ${.CURDIR}/setup.c
+$(FILES): files.stamp
+files.stamp: mkdata monsters.asc
+ rm -f files.stamp
+ ./mkdata -m monsters.asc
+ touch files.stamp
-afterinstall:
- ./setup -m ${.CURDIR}/monsters.asc
- chown games:bin ${DESTDIR}/var/games/phantasia/*
+mkdata: phantglobs.c setup.c
+ clang -o mkdata phantglobs.c setup.c
# Make Phantasia map. Change the map commands reflect your installation.
# PLOTDEVICE is used for plotting the map. Change as appropriate.
map: map.c
- ${CC} -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
+ clang -o map map.c -lplot
./map | plot > /dev/tty
-.include <bsd.prog.mk>
+$(PROG): $(SRCS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(SRCS) -lncursesw
+ $(STRIP) $(PROG)
+
+$(ALLFILES): $(FILES)
+
+install: $(PROG) $(MAN) $(ALLFILES)
+ $(GINSTALL) -Dm2755 $(PROG) $(DESTDIR)/usr/games/$(PROG)
+ $(GINSTALL) -Dm644 $(MAN) $(DESTDIR)/usr/share/man/man6/$(MAN)
+ $(GINSTALL) -d $(DESTDIR)$(FILESDIR)
+ $(GINSTALL) -Dm$(FILESMODE) $(ALLFILES) $(DESTDIR)$(FILESDIR)
+
+clean:
+ rm -f $(CLEANFILES) $(PROG)
+
+.PHONY: all clean install