-CFLAGS+=-O
+# $NetBSD: Makefile,v 1.5 2020/11/11 20:04:02 christos Exp $
+
+PROG= warp
SRCS= bang.c init.c intrp.c move.c object.c play.c score.c sig.c term.c \
them.c us.c util.c version.c warp.c weapon.c
-OBJS= bang.o init.o intrp.o move.o object.o play.o score.o sig.o term.o \
- them.o us.o util.o version.o warp.o weapon.o
-
-warp: ${OBJS}
- ${CC} ${OBJS} -o $@ -ltermlib -lm
-
-install: warp
- export PATH || exit 1
- - mv $(bin)/warp $(bin)/warp.old
- - if test `pwd` != $(bin); then cp $(public) $(bin); fi
- - cd $(bin); chmod 755 $(public); chown '$(CHOWNER)' $(public)
- - chmod 4711 $(bin)/warp
- - chmod 755 makedir
- - ./makedir `./filexp $(privlib)`
- - \
-if test `pwd` != `./filexp $(privlib)`; then \
-cp $(private) `./filexp $(privlib)`; \
-fi
- - \
-cd `./filexp $(privlib)`; \
-chmod 755 $(private); \
-chown '$(CHOWNER)' . $(private); \
-cp /dev/null save.blurfl
- - \
-if test ! -f `./filexp $(privlib)/warp.news`; then \
-cp warp.news `./filexp $(privlib)`; \
-fi
- - \
-if test `pwd` != $(mansrc); then \
-for page in $(manpages); do \
-cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
-done; \
-fi
+
+CPPFLAGS+=-DHAVETERMLIB
+
+CLEANFILES+=sm smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
+CLEANFILES+=warp.6
+MAN= warp.6
+
+FILES=smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
+FILESDIR=$(PREFIX)/share/games/warp
+
+all: $(PROG) $(MAN) $(FILES)
+
+$(PROG): $(SRCS)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(SRCS) -lncursesw -I$(ROOT)
+ $(STRIP) $(PROG)
+
+install: $(PROG) $(MAN) $(FILES)
+ $(GINSTALL) -Dm2755 $(PROG) $(DESTDIR)/$(PREFIX)/games/$(PROG)
+ $(GINSTALL) -Dm644 $(MAN) $(DESTDIR)/$(PREFIX)/share/man/man6/$(MAN)
+ $(GINSTALL) -d $(DESTDIR)$(FILESDIR)
+ $(GINSTALL) -Dm644 $(FILES) $(DESTDIR)$(FILESDIR)
clean:
- rm -f warp core ${OBJS}
+ rm -f $(CLEANFILES) $(PROG)
+
+warp.6:
+ cat warp.man > $@
smap.0: smp.0 sm
- sm <smp.0 >smap.0
+ ./sm < smp.0 > $@
+
smap.1: smp.1 sm
- sm <smp.1 >smap.1
+ ./sm < smp.1 > $@
+
smap.2: smp.2 sm
- sm <smp.2 >smap.2
+ ./sm < smp.2 > $@
+
smap.3: smp.3 sm
- sm <smp.3 >smap.3
+ ./sm < smp.3 > $@
+
smap.4: smp.4 sm
- sm <smp.4 >smap.4
+ ./sm < smp.4 > $@
+
smap.5: smp.5 sm
- sm <smp.5 >smap.5
+ ./sm < smp.5 > $@
+
smap.6: smp.6 sm
- sm <smp.6 >smap.6
+ ./sm < smp.6 > $@
+
smap.7: smp.7 sm
- sm <smp.7 >smap.7
+ ./sm < smp.7 > $@
+
sm: sm.c
- ${CC} sm.c -o $@
+ clang -o $@ sm.c -I$(ROOT)
-depend: ${SRCS}
- mkdep ${SRCS}
+.PHONY: all clean install