# This is the Makefile for nc. 
# Don't forget to edit the settings in config.h before making !

# Set this to your binaries directory
BINDIR = ~/nc

# Set this to your man directory
MANDIR = /usr/man/mann

# If you use Slackware 1.1.2+ uncomment the next line
# LIBS2 = -liostream

# Nothing to edit after this point
CC = gcc
C++ = g++
CFLAGS = -traditional -Wall -static
C++FLAGS = -Wall -static
LIBS = -lncurses $(LIBS2)
objects = nc.o welcome.o inithome.o trim.o debug.o softlabel.o TFileWindow.o readkeys.o lineedit.o

all :
	$(MAKE) nc
	$(MAKE) hd
	$(MAKE) ncds
#	$(MAKE) del
#	$(MAKE) undel
	$(MAKE) man
	$(MAKE) manual

distrib:
	cd /home/andy/nc
	rm -f nc
	mkdir nc
	cp *.cc nc
	cp *.c nc
	cp *.h nc
	cp README Makefile HISTORY COPYING *.c *.nc manual.tex nc.man ncd nc
	cp /home/andy/.nc_keys /home/andy/.nc.getps1 nc
	tar cvf nc.tar nc/* nc/.nc*
	rm nc/* nc/.nc*
	gzip nc.tar
	mv nc.tar.gz nc/nc.tgz	

install :
	-mkdir $(BINDIR)
	-sh -c "cp nc $(BINDIR)"
	-cp nc.man $(MANDIR)/nc.n
	-sh -c "cp .nc* ~"

nc : $(objects)
	$(CC) $(C++FLAGS) -fwritable_strings -o nc $(objects) $(LIBS)
	-strip nc

man:
#	$(MAKE) nc.n

#nc.n : nc.man
#	groff -man nc.man > nc.n

manual :
	$(MAKE) manual.dvi

manual.dvi : manual.tex
	latex manual.tex

clean :
	rm -f $(objects) hd del undel ncds core nc.n manual.dvi
	touch nc

hd : hd.c
	$(CC) $(C++FLAGS) -o hd hd.c

ncds : ncds.cc globals.h config.h inithome.cc
	$(CC) $(C++FLAGS) -o ncds ncds.cc inithome.cc
	-strip ncds

#del : del.cc globals.h config.h inithome.cc
#	$(CC) $(C++FLAGS) -o del del.cc inithome.cc

#undel : undel.cc globals.h config.h inithome.cc
#	$(CC) $(C++FLAGS) -o undel undel.cc inithome.cc

nc.o : globals.h config.h TDir.h TList.h TPrompt.h welcome.h THistory.h TElem.h THistElem.h TFileWindow.h readkeys.h TArg.h TInfo.h TClock.h nc.cc
	$(C++) $(C++FLAGS) -c nc.cc

inithome.o : globals.h config.h inithome.cc
	$(C++) $(C++FLAGS) -c inithome.cc

softlabel.o : config.h globals.h softlabel.h softlabel.cc
	$(C++) $(C++FLAGS) -c softlabel.cc

welcome.o : welcome.h globals.h welcome.cc
	$(C++) $(C++FLAGS) -c welcome.cc

TFileWindow.o : globals.h config.h TDir.h TList.h TElem.h trim.h TFileWindow.h TInfo.h TFileWindow.cc
	$(C++) $(C++FLAGS) -c TFileWindow.cc

readkeys.o : readkeys.h globals.h config.h readkeys.cc
	$(C++) $(C++FLAGS) -c readkeys.cc

lineedit.o : lineedit.h globals.h config.h lineedit.cc
	$(C++) $(C++FLAGS) -c lineedit.cc

trim.o : trim.h globals.h config.h trim.c
	$(CC) $(C++FLAGS) -c trim.c



