diff options
author | B. Watson <yalhcru@gmail.com> | 2015-05-07 16:32:32 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2015-05-07 16:32:32 -0400 |
commit | 013ac7742311556022304e8b30ca170d48b3a016 (patch) | |
tree | 53faa33e75991363f1a6dcc7edc83a66b70e6995 /Makefile | |
download | bsd-games-extra-013ac7742311556022304e8b30ca170d48b3a016.tar.gz |
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..75fd54f --- /dev/null +++ b/Makefile @@ -0,0 +1,70 @@ +# Makefile for bsd-games-extra, by B. Watson. This file is +# released under the WTFPL, so do WTF you want with it. + +# You don't want to parallelize this. Use "make -j1" if you +# normally set -jN in your MAKEFLAGS. + +# This is just the date, yyyymmdd +VERSION=20150209 + +# Slackware-specific stuff. Try MANDIR=/usr/share/man and PMAKE=bmake +# for other Linux distros. +MANDIR=/usr/man +PMAKE=pmake + +# This bit of ugliness requires GNU make. I don't know BSD make +# well enough to write the equivalent for it. +INC:=$(shell pwd)/include +CFLAGS="$(OPTFLAGS) -I$(INC) -include bsdcompat.h -std=gnu99" + +# Which games are we building? +DIRS=boggle bs cgram ching colorbars \ + dab dm grdc hack hals_end larn \ + paranoia rogue tetris + +# BSD Makefiles don't create subdirs for man pages, so we have +# to do it here. +MANSECTS=5 6 8 + +# Some of this stuff installs with wrong permissions, +# fix_perms rule fixes it according to these 3 variables: +SCOREFILES=tetris.scores rogue.scores +SGIDBINS=tetris rogue hack +SAVEDIRS=hackdir larn + +all: + for dir in $(DIRS); do ( cd $$dir && $(PMAKE) CFLAGS=$(CFLAGS) ); done + [ -x boggle/mkdict/mkdict ] && cd boggle && $(PMAKE) realall + +clean: + for dir in $(DIRS); do ( cd $$dir && $(PMAKE) clean ); done + +install: install_files fix_perms + +install_files: + for sect in $(MANSECTS); do \ + mkdir -p $(DESTDIR)/$(MANDIR)/man$$sect ; \ + done + for dir in $(DIRS); do \ + ( cd $$dir && \ + $(PMAKE) install \ + INSTALL="install -D" \ + MANDIR=$(MANDIR) \ + DOCDIR=/usr/doc/bsd-games-extra-$(VERSION) \ + ) ; \ + done + rm -f $(DESTDIR)/mkdict $(DESTDIR)/mkindex + +fix_perms: + for file in $(SCOREFILES); do \ + install -D -o root -g games -m664 /dev/null $(DESTDIR)/var/games/$$file ; \ + done + for bin in $(SGIDBINS); do \ + chown root:games $(DESTDIR)/usr/games/$$bin ; \ + chmod 2755 $(DESTDIR)/usr/games/$$bin ; \ + done + for dir in $(SAVEDIRS); do \ + mkdir -p $(DESTDIR)/var/games/$$dir ; \ + chown -R root:games $(DESTDIR)/var/games/$$dir ; \ + chmod -R ug+rw $(DESTDIR)/var/games/$$dir ; \ + done |