phantasia(6): Separate hostprog.
authorzrj <rimvydas.jasinskas@gmail.com>
Wed, 25 Apr 2018 16:19:07 +0000 (19:19 +0300)
committerzrj <zrj@dragonflybsd.org>
Wed, 25 Apr 2018 18:19:07 +0000 (21:19 +0300)
Make substantial effort to reduce dependencies for setup.nx.
While there install monsters file as 640.

games/phantasia/Makefile
games/phantasia/Makefile.inc [new file with mode: 0644]
games/phantasia/include.h
games/phantasia/phantasia/Makefile [copied from games/phantasia/Makefile with 54% similarity]
games/phantasia/setup.c
games/phantasia/setup/Makefile [new file with mode: 0644]

index 1f23ed3..a758f06 100644 (file)
@@ -1,46 +1,3 @@
-#      @(#)Makefile    8.1 (Berkeley) 5/31/93
-# $FreeBSD: src/games/phantasia/Makefile,v 1.16.2.2 2002/08/07 16:31:42 ru Exp $
-
-PROG=  phantasia
-MAN=   phantasia.6
-SRCS=  main.c fight.c io.c interplayer.c gamesupport.c misc.c phantglobs.c
-DPADD= ${LIBM}
-LDADD= -lm
-VARGAMES=
-GAMESCURSES=
-
-NXLDLIBS=      -lm
-
-DATAFILES=     characs gold lastdead mess monsters motd scoreboard void
-CLEANFILES=    ${DATAFILES} cross-phantglobs.no map setup.nx setup.no \
-               stamp.setuprun
-
-all: stamp.setuprun
-
-build-tools: setup.nx
-
-cross-phantglobs.no: phantglobs.c
-       ${NXCC} ${NXCFLAGS} -c ${.ALLSRC} -o ${.TARGET}
-
-stamp.setuprun: monsters.asc setup.nx
-       ./setup.nx -m ${.CURDIR}/monsters.asc
-       touch ${.TARGET}
-
-setup.nx: cross-phantglobs.no setup.no ${LIBM}
-       ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC} ${NXLDLIBS} -o ${.TARGET}
-
-beforeinstall:
-.for file in ${DATAFILES}
-.if !exists(${DESTDIR}/var/games/phantasia/${file})
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 660 \
-           ${file} ${DESTDIR}/var/games/phantasia
-.endif
-.endfor
-
-# Make Phantasia map.  Change the map commands reflect your installation.
-# PLOTDEVICE is used for plotting the map.  Change as appropriate.
-map: map.c
-       ${CC} -static -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
-       ./map | plot > /dev/tty
-
-.include <bsd.prog.mk>
+SUBDIR=                setup
+SUBDIR+=       phantasia
+.include <bsd.subdir.mk>
diff --git a/games/phantasia/Makefile.inc b/games/phantasia/Makefile.inc
new file mode 100644 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
index 4876e86..696c7cd 100644 (file)
@@ -3,7 +3,9 @@
  */
 
 #include <ctype.h>
+#ifndef COMPILING_SETUP
 #include <curses.h>
+#endif
 #include <math.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <string.h>
 #include <unistd.h>
 
+#ifdef COMPILING_SETUP
+/* XXX this used to be provided by curses.h */
+#include <stdio.h>     /* for FILE */
+#include <stdbool.h>   /* for bool */
+#ifndef TRUE
+#define        TRUE    true
+#endif
+#endif
+
 #include "macros.h"
 #include "phantdefs.h"
 #include "phantstruct.h"
similarity index 54%
copy from games/phantasia/Makefile
copy to games/phantasia/phantasia/Makefile
index 1f23ed3..3ed2d71 100644 (file)
@@ -1,6 +1,8 @@
 #      @(#)Makefile    8.1 (Berkeley) 5/31/93
 # $FreeBSD: src/games/phantasia/Makefile,v 1.16.2.2 2002/08/07 16:31:42 ru Exp $
 
+.PATH: ${.CURDIR}/..
+
 PROG=  phantasia
 MAN=   phantasia.6
 SRCS=  main.c fight.c io.c interplayer.c gamesupport.c misc.c phantglobs.c
@@ -9,25 +11,17 @@ LDADD=       -lm
 VARGAMES=
 GAMESCURSES=
 
-NXLDLIBS=      -lm
-
-DATAFILES=     characs gold lastdead mess monsters motd scoreboard void
-CLEANFILES=    ${DATAFILES} cross-phantglobs.no map setup.nx setup.no \
-               stamp.setuprun
-
-all: stamp.setuprun
-
-build-tools: setup.nx
-
-cross-phantglobs.no: phantglobs.c
-       ${NXCC} ${NXCFLAGS} -c ${.ALLSRC} -o ${.TARGET}
+DATAFILES=     characs gold lastdead mess motd scoreboard void
+CLEANFILES=    ${DATAFILES} map monsters
 
-stamp.setuprun: monsters.asc setup.nx
-       ./setup.nx -m ${.CURDIR}/monsters.asc
-       touch ${.TARGET}
+FILES=         monsters
+FILESMODE=     640
+FILESGRP=      ${BINGRP}
+FILESDIR=      /var/games/phantasia
 
-setup.nx: cross-phantglobs.no setup.no ${LIBM}
-       ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC} ${NXLDLIBS} -o ${.TARGET}
+.ORDER: monsters ${DATAFILES}
+monsters ${DATAFILES}: monsters.asc setup.c
+       ${.OBJDIR}/../setup/setup.nx -m ${.CURDIR}/../monsters.asc
 
 beforeinstall:
 .for file in ${DATAFILES}
@@ -39,8 +33,9 @@ beforeinstall:
 
 # Make Phantasia map.  Change the map commands reflect your installation.
 # PLOTDEVICE is used for plotting the map.  Change as appropriate.
+# Requires dports graphics/plotutils
 map: map.c
-       ${CC} -static -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
+       ${CC} -static -O ${.CURDIR}/../map.c -L/usr/local/lib -lplot -o ${.TARGET}
        ./map | plot > /dev/tty
 
 .include <bsd.prog.mk>
index de4cf71..41e3a5d 100644 (file)
@@ -3,11 +3,21 @@
  *
  * $FreeBSD: src/games/phantasia/setup.c,v 1.11 1999/11/16 02:57:34 billf Exp $
  */
-#include "include.h"
+/*#include "include.h"*/
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
+#include "include.h"
+
 void Error(const char *, const char *) __dead2;
 
 static const char *const files[] = {           /* all files to create */
diff --git a/games/phantasia/setup/Makefile b/games/phantasia/setup/Makefile
new file mode 100644 (file)
index 0000000..d12889d
--- /dev/null
@@ -0,0 +1,14 @@
+.PATH: ${.CURDIR}/..
+
+PROG=  setup
+SRCS=  phantglobs.c setup.c
+
+# for floor()
+LDADD+=        -lm
+
+CFLAGS+=-DCOMPILING_SETUP -I${.CURDIR}/..
+
+# this setup is used in place, it is not installed anywhere
+install:
+
+.include <bsd.hostprog.mk>