# $Id: Makefile,v 0.7 1996/01/25 23:49:52 dld Exp $
#
# Makefile for lafe (Latency Free Empire)

SHELL = /bin/sh

SRC = lafe.c
OBJ = $(SRC:.c=.o)

all:
	@echo "Chose one of the following architectures, or add a new entry to the Makefile:"
	@echo "    termcap curses"
	@echo "irix5 irix6 aix solaris osf1"


#
#  Make targets that only need CFLAGS and LDFLAGS different
#

# the Irix 6 target uses the -32 flag to be runnable on Irix5
irix6:
	CFLAGS='-g -I. -32' LDFLAGS='-g -32' make termcap

# should work on irix5 or irix6
irix:
	CFLAGS='-g -I.' LDFLAGS='-g' make termcap

# should work on AIX3 or AIX4, posixy
aix:
	CFLAGS='-g -I.' LDFLAGS='-g' make curses

# another posixy unix, note the vanilla flags.
osf1:
	CFLAGS='-g -I.' LDFLAGS='-g' make curses

# not so posixy, weird libraries
solaris:
	CFLAGS='-g -I.' LDFLAGS='-g -lsocket -lns' make termcap

#
# Internal lafe targets, CFLAGS and LDFLAGS won't get set if you call these
# Since lafe is a single source file at present, it's faster to compile and
# link in a single step.  Will split it up if lafe grows.

termcap: configure $(OBJ) 
	cd readline ; make
	$(CC) $(LDFLAGS) -o lafe $(OBJ) -lreadline -ltermcap -Lreadline

curses: configure $(OBJ) 
	cd readline ; make
	$(CC) $(LDFLAGS) -o lafe $(OBJ) -lreadline -lcurses -Lreadline


configure: readline/config.status

readline/config.status:
	cd readline ; CFLAGS='$(CFLAGS)' ./configure

clean:
	-rm -f lafe *.o lafe.tar.gz

distclean: clean
	-cd readline ; make distclean

dist: distclean
	cd .. ; tar cf - lafe/Makefile lafe/lafe.c lafe/README lafe/ChangeLog lafe/readline | gzip -9 >lafe.tar.gz
	mv ../lafe.tar.gz .

