#	$Id: makefile,v 1.24 1998/07/20 23:34:17 jvuokko Exp $	

#
# makefile for unix-version.
#
# Define debug=1, if want debug version
#        devel=1, if only assertions, not other debug stuff
#        profile=1, if profile
#        build=1, for build version used in my binary distributions
#        experimental=1, if you want experimental code compiled
#

prog = jmr


CFLAGS = -DNDEBUG -O2 -Wall -W 

ifdef debug
CFLAGS = -DUSE_DEBUG -O -g -Wall -W \
         -Wtraditional -Wpointer-arith \
         -Wcast-align -Wwrite-strings -Wstrict-prototypes  \
         -Wmissing-declarations -Wnested-externs -Wbad-function-cast\
         -Woverloaded-virtual
endif

ifdef devel
CFLAGS = -O -g -Wall -W \
         -Wtraditional -Wpointer-arith \
         -Wcast-align -Wwrite-strings -Wstrict-prototypes  \
         -Wmissing-declarations -Wnested-externs -Wbad-function-cast\
         -Woverloaded-virtual
endif

ifdef build
CFLAGS = -O2 -Wall -W -s
endif



ifdef profile
CFLAGS := $(CFLAGS) -pg
endif

# LSFLAGS = -s	
DEFS = -D__OLD_GCC__ -DNO_EXCEPTIONS -DTAGB

#ifdef build
#DEFS := $(DEFS) -DDO_NOT_USE_UNAME
#endif

ifdef experimental
DEFS := $(DEFS) -DF_TO_ALL
CFLAGS := $(CFLAGS) # -DUSE_DEBUG
endif

RM=/bin/rm -f
CXX = c++ $(DEFS) $(CFLAGS)


# If your system does not have termcap library, then replace text 'termcap'
# with 'curses' or 'ncurses'.
termlib = termcap

libs = -l$(termlib) -lstdc++
utilib=../utilib
O = o
utilib_objs = $(utilib)/String.$(O) $(utilib)/misc.$(O) 
objs = $(utilib_objs) menu.$(O) qwk.$(O) jmr.$(O) terminal_io.$(O) \
       message_menu.$(O) message_display.$(O) mail.$(O) replies.$(O) \
       time.$(O) filelist.$(O) messagelog.$(O) messagedata.$(O) \
       tree.$(O) menubar.$(O) groupselect.$(O) window.$(O) threads.$(O) \
       wrapmsg.$(O) userselect.$(O) jmrmisc.$(O) linereader.$(O)



all : prog 

dist: prog #distclean

clean : 
	$(RM) $(prog) *.$(O) .depend core *.err *.map *.obj
	$(RM) ../utilib/*.$(O) ../utilib/.depend ../utilib/core ../utilib/*.err ../utilib/*.map ../utilib/*.obj

distclean:
	$(RM) *.$(O) .depend core *.err *.map *.obj
	$(RM) ../utilib/*.$(O) ../utilib/.depend ../utilib/core ../utilib/*.err ../utilib/*.map ../utilib/*.obj


prog : $(objs)
	$(CXX) -o $(prog) $(objs) $(libs) $(LDFLAGS)

$(objs): 
 
depend .depend:
	$(CXX) -MM *.cc ../utilib/*.cc > .depend

include .depend
