# 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" # Slackware64's pmake ships with broken includes. ifeq ($(shell uname -m),x86_64) PMAKEHACK="MAKESYSPATH=$(shell pwd)/pmake.hack" else PMAKEHACK=/usr/share/mk endif # 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: export $(PMAKEHACK) ; \ for dir in $(DIRS); do ( cd $$dir && $(PMAKE) CFLAGS=$(CFLAGS) ); done ; \ [ -x boggle/mkdict/mkdict ] && cd boggle && $(PMAKE) realall clean: export $(PMAKEHACK) ; \ 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