# $Id: Makefile.in,v 1.18 1996/11/16 22:05:54 tom Exp $
################################################################################
# Copyright 1996 by Thomas E. Dickey <dickey@clark.net>                        #
# All Rights Reserved.                                                         #
#                                                                              #
# Permission to use, copy, modify, and distribute this software and its        #
# documentation for any purpose and without fee is hereby granted, provided    #
# that the above copyright notice appear in all copies and that both that      #
# copyright notice and this permission notice appear in supporting             #
# documentation, and that the name of the above listed copyright holder(s) not #
# be used in advertising or publicity pertaining to distribution of the        #
# software without specific, written prior permission. THE ABOVE LISTED        #
# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,    #
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL,        #
# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM   #
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE   #
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR    #
# PERFORMANCE OF THIS SOFTWARE.                                                #
################################################################################
# Makefile for ncurses tests.

SHELL		= /bin/sh

srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@
libdir		= @libdir@
includedir	= @includedir@

CC		= @CC@

CFLAGS		= @CFLAGS@

CFLAGS_NORMAL	=
CFLAGS_DEBUG	= @CC_G_OPT@ -DTRACE
CFLAGS_PROFILE	= -pg
CFLAGS_SHARED	= @CC_SHARED_OPTS@

CPPFLAGS	= @CPPFLAGS@ -DHAVE_CONFIG_H -I$(srcdir)

CCFLAGS		= $(CFLAGS) $(CPPFLAGS) $(CFLAGS_@DFT_UPR_MODEL@)

LOCAL_LIBS	= @TEST_DEPS@

LINK		= $(CC)
LD_FLAGS	= @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS@ $(LDFLAGS)

LINT		= @LINT@
LINT_OPTS	= @LINT_OPTS@
LINT_LIBS	= -lform -lmenu -lpanel -lncurses @LIBS@

TESTS = \
	blue \
	bs \
	firework \
	gdc \
	hanoi \
	hashtest \
	knight \
	lrtest \
	ncurses \
	newdemo \
	rain \
	tclock \
	testcurs \
	view \
	worm \
	xmas 

.c.o:
	$(CC) -c $(CCFLAGS) $<

all: $(TESTS) 

blue: $(srcdir)/blue.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
bs: $(srcdir)/bs.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
firework: $(srcdir)/firework.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
gdc: $(srcdir)/gdc.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
hanoi: $(srcdir)/hanoi.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
hashtest: $(srcdir)/hashtest.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
knight: $(srcdir)/knight.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
lrtest: $(srcdir)/lrtest.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
ncurses: $(srcdir)/ncurses.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
newdemo: $(srcdir)/newdemo.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
rain: $(srcdir)/rain.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
tclock: $(srcdir)/tclock.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -lm -o $@
testcurs: $(srcdir)/testcurs.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
view: $(srcdir)/view.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
worm: $(srcdir)/worm.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@
xmas: $(srcdir)/xmas.c $(LOCAL_LIBS)
	@ECHO_LINK@ $(LINK) $(CCFLAGS) $(srcdir)/$@.c $(LD_FLAGS) -o $@

install:

clean:
	-rm -rf *.o trace screendump t $(TESTS)

distclean :: clean
	-rm -f Makefile config.*

mostlyclean :: clean

realclean :: distclean

lint:
	sh -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/$$N.c $(LINT_LIBS); done'
