#For Debian compilation, uncomment the 2 lines below 
#HELPFILE= -DDEFAULT_HELPFILE=\"/usr/share/doc/seaview/seaview.html\"
#PHYMLNAME= -DPHYMLNAME=\"phyml\"


#to compile with PDF (through PDFlib Lite) rather than PostScript output, 
#comment out next and uncomment next 4 lines
PDF_PS_FLAGS = -DNO_PDF
#PDF_INC = $(HOME)/PDFlibLite #customize by setting to place of pdflib.h
#PDF_LIB = $(HOME)/PDFlibLite #customize by setting to place of libpdf.*
#PDF_PS_FLAGS = -I$(PDF_INC)
#LPDF = -L$(PDF_LIB) -lpdf

FLTK = /usr/include
#uncomment the next 3 lines to use your own, uninstalled FLTK library
#FLTK = $(HOME)/fltk-1.3.2
#IFLTK = -I$(FLTK)
#LFLTK = -L$(FLTK)/lib

EXTRALIBS = -lXft -lXext -lfontconfig -ljpeg -lpng -lXinerama $(LPDF)

CC = gcc
CXX = g++
CSRC = csrc

#DEBUG = -g
OPT = $(shell if [ '$(DEBUG)' = '' ]; then echo '-O3'; else echo '-O0'; fi)
EXTRA = -DFl_Native_File_Chooser=mgFl_Native_File_Chooser

SVFLAGS = -Dunix $(OPT) $(IFLTK) -I$(CSRC) -I. $(DEBUG) $(HELPFILE) $(PHYMLNAME) $(PDF_PS_FLAGS) $(EXTRA)


OBJECTS = seaview.o custom.o use_mase_files.o regions.o load_seq.o align.o xfmatpt.o \
comlines.o resource.o nexus.o \
viewasprots.o racnuc_fetch.o concatenate.o statistics.o \
trees.o treedraw.o addbootstrap.o least_squares_brl.o \
pseudoterminal.o unrooted.o pdf_or_ps.o svg.o threads.o Fl_Native_File_Chooser_FLTK.o
 

COBJECTS = raa_acnuc.o parser.o md5.o zsockr.o misc_acnuc.o dnapars.o protpars.o lwl.o bionj.o phyml_util.o


seaview : $(OBJECTS) $(COBJECTS)
	$(CXX) -o $@ $(DEBUG) $(LDFLAGS) $(OBJECTS) $(COBJECTS)  \
	      $(LFLTK) -lfltk_images -lfltk  \
	     $(EXTRALIBS) \
         -lX11 -lm -lz -lpthread

$(COBJECTS) : $(CSRC)/$*
	$(CC) -c $(DEBUG) $(OPT) $(CFLAGS) -I$(CSRC) $(CSRC)/$*.c

Fl_Native_File_Chooser_FLTK.o : FL/Fl_Native_File_Chooser_FLTK.cxx
	$(CXX)  -c -I. -I$(FLTK)/src  $(SVFLAGS) FL/Fl_Native_File_Chooser_FLTK.cxx

.SUFFIXES:	.c .cxx .h .o

.cxx.o :
	$(CXX) -c $(CPPFLAGS) $(CFLAGS) $(SVFLAGS) $<
