# -*- Makefile -*- for if
# Copyright (C) 1996 Alan Shutko ats@hubert.wustl.edu
# $Header: /home/ats/Projects/if/Makefile,v 1.4 1997/05/15 21:27:18 ats Exp $
# $Log: Makefile,v $
# Revision 1.4  1997/05/15 21:27:18  ats
# Added ChangeLog to DISTFILES
#
# Revision 1.3  1997/05/15 21:21:32  ats
# Updated for version 1.0
#
# Revision 1.2  1997/05/15 21:16:41  ats
# Cleaned up makefile for release
#
# Revision 1.1  1996/12/09 01:56:45  ats
# Initial revision
#

INSTALL_DIR= /usr/local
GAME_LIST= $(INSTALL_DIR)/lib/int-fiction.lst
IF_PATH= /usr/local/lib/infocom:/usr/games//

CC = gcc
CFLAGS = -g -O -Wall -I./libats \
	 -DDEFAULT_GAME_LIST=\"$(GAME_LIST)\" -DDEFAULT_IF_PATH=\"$(IF_PATH)\"
LDFLAGS=  -g -L./libats -L.
LOADLIBES= -lats -lcurses -lm
MAKE = make
COMPRESS = gzip
#INSTALL= /usr/ucb/install	# SYSV Systems
INSTALL= install		# BSD-ish systems

# END USER SERVICABLE AREA

OBJS = int-fiction.o pathsearch.o menubox.o util.o mousewget.o 
SRCS = $(OBJS:.o=.c) dialog.h int-fiction.h
VERSION = 1.0
RUBBISH = $(OBJS) *.log *.aux *.tp *.vr *.cp *.fn *.ky *.pg

DISTFILES = $(SRCS) Makefile int-fiction.6 README int-fiction.lst ChangeLog libats

############################################################

all: int-fiction
	@echo All done.

int-fiction: $(OBJS) libats/libats.a
	$(CC) $(LDFLAGS) $(OBJS) $(LOADLIBES) -o int-fiction

libats/libats.a:
	cd libats; $(MAKE) CC="$(CC)"  CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

clean:
	-rm -f $(RUBBISH)
	cd libats; $(MAKE) clean

dist:	clean
	mkdir int-fiction-$(VERSION)
	cp -aR $(DISTFILES) int-fiction-$(VERSION)
	tar czf int-fiction-$(VERSION).tar.gz int-fiction-$(VERSION)
	rm -rf int-fiction-$(VERSION)

install: int-fiction
	$(INSTALL) -s -m 755 int-fiction $(INSTALL_DIR)/bin
	$(INSTALL) -m 644 int-fiction.6 $(INSTALL_DIR)/man/man6
	$(INSTALL) -m 644 int-fiction.lst $(GAME_LIST)
