#
# Makefile for nn release 6.3
#
# Specify your favourite compiler, preprocessor, and compiler flags:
#
# Some alternatives for CPP might be /lib/cpp and $(CC) -P
# Common values for CFLAGS are '-O -s' or '-g'
#

CC =		cc
CPP =		$(CC) -E
CFLAGS =	   -O
MAKE =		make

#
# Before compiling, read the instructions in the file INSTALLATION!
# -----------------------------------------------------------------
#
#	make all	compile programs
#	make install	install programs
#	make initdb	initialize database
#	make clean	remove all make'd files from source directory
#
# no changes are needed below this line
#

SHELL = /bin/sh

all: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile all

nn: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile nn

lint: ymakefile
	$(MAKE) -f ymakefile lint

install: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile install

initdb: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile initdb

online: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile online.manual

client: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile client

install.client: ymakefile
	$(MAKE) $(MFLAGS) -f ymakefile install.client

ymakefile: Makefile xmakefile config.h
	cp xmakefile MF.c
	$(CPP) -DCOMPILER="$(CC)" -DPREPROC="$(CPP)" \
	       -DCDEBUG="$(CFLAGS)" MF.c | \
	sed -e '1,/MAKE WILL CUT HERE/d' \
	    -e '/^#/d' \
	    -e '/^[ \f	]$$/d' \
	    -e '/^[ /]*[*]/d' | \
	sed -n -e '/^..*$$/p' > ymakefile
	rm -f MF.c

#
# clean up 
#	Will remove object and executeable files.
#

clean:	ymakefile
	make -f ymakefile clean
	rm -f *.o *~ ymakefile

#
# distribution
#

distrib:
	[ ! -d DIST ]
	mkdir DIST
	cp `cat MANIFEST` DIST
	echo '#define UPDATE 0' > DIST/update.h
	cd DIST ; shar -v -s -d'NO_NEWS_IS_GOOD_NEWS' \
		  -onn-6.3. -l50 `cat MANIFEST`


