#
# Useful ./configure options with respect to this Makefile:
# --prefix
# --exec_prefix
# --bindir
# --datadir
# --mandir
# --with-ncurses

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datadir = @datadir@/csokoban
mandir = @mandir@

CC = @CC@
CFLAGS =@CFLAGS@ '-DDATADIR="$(datadir)"'
LDFLAGS =@LDFLAGS@
LOADLIBES =@LOADLIBES@

OBJS = csokoban.o movelist.o fileread.o answers.o play.o dirio.o userio.o

csokoban: $(OBJS)

clean:
	rm -f $(OBJS) csokoban Makefile

install: csokoban
	install -d $(bindir)
	install -c ./csokoban $(bindir)/csokoban
	install -d $(mandir)/man6
	install -c ./csokoban.6 $(mandir)/man6/csokoban.6
	install -d -g games $(datadir)
	install -c -m 644 ./series/* $(datadir)/

movelist.o: movelist.c gen.h movelist.h
dirio.o   : dirio.c gen.h dirio.h
userio.o  : userio.c gen.h csokoban.h userio.h
fileread.o: fileread.c gen.h csokoban.h movelist.h dirio.h userio.h \
            answers.h fileread.h
answers.o : answers.c gen.h csokoban.h dirio.h movelist.h fileread.h \
            play.h answers.h
play.o    : play.c gen.h csokoban.h userio.h play.h movelist.h fileread.h
csokoban.o: csokoban.c gen.h csokoban.h movelist.h dirio.h fileread.h \
            answers.h play.h userio.h
