#-----------------------------------------------------------------------:A
SHELL=/bin/sh
#
#
# First where are we going to get the sources
#
SRCDIR=.
WEBDIR=/home/ansell/cmdv
PGPLOTDIR=/usr/local/pgplot
#SRCDIR=/home/ansell/win/nwin


# Fortran compiler and compilation flags
#
FCOMPL=g77
FFLAGC=-g -C -ffixed-line-length-132 -fvxt-intrinsics-enable -fno-backslash\
         -Wall
FFLAGD=

#
# C compiler and compilation flags
#
# XINCL=-I/usr/X11R6/include -I/usr/local/include/g++-v3
XINCL=-I/usr/X11R6/include
MOTIF_INCL=-I/usr/X11R6/include
RV_INCL=

#CCOMPL=/usr/local/bin/g++
CCOMPL=g++
CFLAGC=-g -Wall -Wno-comment -fexceptions -fno-implicit-templates 
CFLAGD=
CFLAGE=-g -Wall -Wno-comment -fexceptions
MCOMPL=
MFLAGC=
#
# Loader library-flags
#
LIBS=-L/usr/X11/lib -lX11 -lm

#Motif 2.1 link line. --
MOTIF_LIBS=-L/usr/X11R6/lib -lXm -lXpm -lXt -lSM -lXp -lICE -lXext -lX11
MOTIF_LIBS=-L/usr/X11R6/lib -lXm -lXt -lXmu -lXp -lX11 -lSM -lICE 
LESS_LIBS=-L/usr/X11R6/lib -lXm -lXt -lXmu -lXp -lX11 -lSM -lICE 
#
#	Loader command for PGPLOT library
#
PGPLOT_LIB=-L/usr/local/pgplot -lpgplot
OCPGPLOT_LIB= -L/usr/local/pgplot/ -lcpgplot -lpgplot
CPGPLOT_LIB= -L/usr/local/pgplot/ -lcpgplot -lpgplot

#-----------------------------------------------------------------------
# Rules for compiling the .o files
#-----------------------------------------------------------------------

ISRC = areaInt.h axis.h box_plot.h cmd.h control.h fortran.h fglobal.h \
       gaussbox.h new_read.h npic.h outinfo.h pgxwin.h poly2.h \
       readfunc.h space.h spacebox.h splx_fit.h words.h wordlist.h \
       wshare.h XmPgplot.h 	

CSRC = cmdspec2.cxx linespec.cxx areaInt.cxx axis.cxx box_plot.cxx curs.cxx \
       dein.cxx fglobal.cxx gamma.cxx gaussbox.cxx \
       gaussentry.cxx gfit.cxx inteprate.cxx \
       intep_c.cxx menu_build.cxx new_read.cxx npic.cxx out.cxx \
       outinfo.cxx poly_c.cxx qspace.cxx rebin.cxx savgol.cxx space.cxx \
       spacebox.cxx splx_fit2.cxx svd.cxx \
       supplot.cxx temp.cxx temp_inst.cxx wind.cxx dxops.cxx file_rec.cxx \
       editbox.cxx wave.cxx words.cxx xraymap.cxx XmPgplot.c pgxwin.c 

FSRC = cap_w.for dein_w.for errfunc.for eval_part.for ft.for fts_w.for \
       overlay_w.for trans_w.for \
       windviewg.for work_w.for 

MSRC = cmdspec2.cxx areaInt.cxx axis.cxx box_plot.cxx curs.cxx dein.cxx \
       drawM.cxx dxops.cxx extract.cxx fglobal.cxx file_rec.cxx frame.cxx \
       gamma.cxx gaussbox.cxx gaussentry.cxx gfit.cxx graphs.cxx  \
       graph_data.cxx inteprate.cxx \
       intep_c.cxx menu_build.cxx new_read.cxx npic.cxx  \
       object.cxx out.cxx \
       outinfo.cxx poly_c.cxx qspace.cxx rebin.cxx rotate.cxx \
       savgol.cxx self.cxx space.cxx spacebox.cxx splx_fit2.cxx supplot.cxx \
       svd.cxx temp.cxx temp_inst.cxx two_graphic.cxx wave.cxx wind.cxx  \
       words.cxx work.cxx xraymap.cxx  \
       cap_w.for dein_w.for eval_part.for ft.for fts_w.for \
       short_over.for \
       trans_w.for windviewg.for work_w.for \
       axis.h areaInt.h baseGraph.h box_plot.h cmd.h control.h \
       fortran.h extract.h fglobal.h file_rec.h frame.h  \
       gaussbox.h new_read.h npic.h outinfo.h poly2.h \
       readfunc.h space.h spacebox.h splx_fit.h \
       words.h wordlist.h wshare.h  

# Following developnment  files are included in ASRC
# gamma.cxx : nrot.cxx : rotate.cxx :
# 
ASRC = cmdspec2.cxx areaInt.cxx axis.cxx box_plot.cxx curs.cxx dein.cxx \
       drawM.cxx dxops.cxx editbox.cxx errfunc.cxx extract.cxx fglobal.cxx  \
       file_rec.cxx fileselect.cxx frame.cxx gamma.cxx gaussbox.cxx \
       gaussentry.cxx gfit.cxx graphs.cxx graph_data.cxx help.cxx \
       inteprate.cxx  \
       intep_c.cxx linfit.cxx menu_build.cxx new_read.cxx npic.cxx nrot.cxx \
       object.cxx out.cxx \
       outinfo.cxx poly_c.cxx qspace.cxx rebin.cxx rotate.cxx \
       savgol.cxx self.cxx space.cxx spacebox.cxx splx_fit2.cxx \
       svd.cxx two_graphic.cxx view.cxx wave.cxx wind.cxx   \
       words.cxx work.cxx xraymap.cxx \
       XmPgplot.c pgxwin.c \
       plot2db3.f pgxtal.f dsqinf.f pgcel0.f errfunc.for \
       areaInt.h axis.h baseGraph.h box_plot.h cmd.h control.h \
       editbox.h extract.h fglobal.h file_rec.h fileselect.h \
       fit_param.h fortran.h frame.h gaussbox.h help.h linfit.h \
       new_read.h npic.h outinfo.h poly2.h \
       readfunc.h space.h spacebox.h splx_fit.h svd.h \
       wave.h words.h wordlist.h wshare.h \
       cpgplot.h pgxwin.h XmPgplot.h rotated.h \
       pgxwin.hxx XmPgplotP.hxx XmPgplot.hxx  \
       grpckg1.inc coltabs.inc 

ODEP = cmdspec2.o areaInt.o axis.o box_plot.o curs.o dein.o drawM.o \
      dxops.o editbox.o extract.o fglobal.o file_rec.o fileselect.o frame.o \
      gaussbox.o gaussentry.o gfit.o graphs.o graph_data.o \
      help.o inteprate.o intep_c.o linfit.o menu_build.o new_read.o \
      npic.o object.o out.o \
      outinfo.o poly_c.o qspace.o rebin.o \
      savgol.o self.o space.o spacebox.o splx_fit2.o \
      svd.o two_graphic.o view.o wave.o wind.o words.o work.o xraymap.o \
      errfunc.o  plot2db3.o pgcel0.o pgxtal.o dsqinf.o  \
      XmPgplot.o pgxwin.o


cmdnw: $(ODEP)
	g++ -g -o cmdnw \
         $(ODEP) \
         $(CPGPLOT_LIB) \
        $(MOTIF_LIBS) \
          -lg2c -lgcc -lglib
#         /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/crtend.o \
#         /usr/lib/crtn.o
#/usr/lib/crtn.o 
#         -lg2c -lgcc_s -lm -lc
#           -L/usr/local/gcc/i686-pc-linux-gnu/libf2c \

cmdL: $(ODEP)
	$(CCOMPL) -g -o cmdL \
         $(ODEP) \
         $(CPGPLOT_LIB) \
        $(LESS_LIBS) \
	-lg2c -lm -lc

cmds: $(ODEP)
	$(CCOMPL) -static -g -o cmds $(ODEP) \
       /usr/local/pgplot/libcpgplot.a \
       /usr/local/pgplot/libpgplot.a \
       /usr/X11R6/lib/libXm.a \
       /usr/X11R6/lib/libXpm.a \
       /usr/X11R6/lib/libXt.a /usr/X11R6/lib/libSM.a \
       /usr/X11R6/lib/libXp.a \
       /usr/X11R6/lib/libICE.a /usr/X11R6/lib/libXext.a \
       /usr/X11R6/lib/libX11.a \
       /usr/lib/gcc-lib/i486-suse-linux/2.95.2/libg2c.a \
        -lm -lc
#       /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/libg2c.a \
#       /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/libgcc.a \
#       -lm -lc

#       /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/libgcc.a \
#       /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/libg2c.a \
#       /usr/local/lib/libstdc++.a \
#       /usr/lib/libm.a  /usr/lib/libc.a 

testwind:  testedit.o
	$(CCOMPL) -g -o twin testedit.o \
	$(MOTIF_LIBS) \
	-lm -lc

mkill:  mkill.o link.o
	$(CCOMPL) -g -o mkill mkill.o link.o \
	$(MOTIF_LIBS) \
	-lm -lc

mkill.o: mkill.cxx 
	gcc -c -g -o mkill.o  mkill.cxx
link.o:	link.cxx link.h
	gcc -c -g -o link.o  link.cxx

testedit.o:	testedit.cxx
	g++ -c -g -o testedit.o  testedit.cxx

beut: beut.o
	$(CCOMPL) -o beut beut.o -lg2c -lm -lc	

cap_w.o: $(SRCDIR)/cap_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/cap_w.for

dein_w.o: $(SRCDIR)/dein_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/dein_w.for

eval_part.o: $(SRCDIR)/eval_part.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/eval_part.for

errfunc.o: $(SRCDIR)/errfunc.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/errfunc.for

ft.o: $(SRCDIR)/ft.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/ft.for

fts_w.o: $(SRCDIR)/fts_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/fts_w.for

short_over.o: $(SRCDIR)/short_over.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/short_over.for

overlay_w.o: $(SRCDIR)/overlay_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/overlay_w.for

plotspecg_w.o: $(SRCDIR)/plotspecg_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/plotspecg_w.for

plot2db3.o: $(SRCDIR)/plot2db3.f
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/plot2db3.f

pgcell.o: $(SRCDIR)/pgcell.f
	 $(FCOMPL) -c $(FFLAGC) $(SRCDIR)/pgcell.f

pgcel0.o: $(SRCDIR)/pgcel0.f
	 $(FCOMPL) -c $(FFLAGC) $(SRCDIR)/pgcel0.f

pgxtal.o: $(SRCDIR)/pgxtal.f
	 $(FCOMPL) -c $(FFLAGC) $(SRCDIR)/pgxtal.f

dsqinf.o: $(SRCDIR)/dsqinf.f
	 $(FCOMPL) -c $(FFLAGC) $(SRCDIR)/dsqinf.f

spltin_w.o: $(SRCDIR)/spltin_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/spltin_w.for

trans_w.o: $(SRCDIR)/trans_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/trans_w.for

windviewg.o: $(SRCDIR)/windviewg.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/windviewg.for

work_w.o: $(SRCDIR)/work_w.for
	$(FCOMPL) -c $(FFLAGC) $(SRCDIR)/work_w.for

areaInt.o: $(SRCDIR)/areaInt.cxx $(SRCDIR)/areaInt.h 
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/areaInt.cxx

axis.o:	$(SRCDIR)/axis.cxx $(SRCDIR)/axis.h  $(SRCDIR)/wshare.h \
         $(SRCDIR)/baseGraph.h $(SRCDIR)/frame.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/axis.cxx

beut.o:	$(SRCDIR)/beut.cxx   
	$(CCOMPL) -c $(CFLAGC)  $(SRCDIR)/beut.cxx

box_plot.o: $(SRCDIR)/box_plot.cxx $(SRCDIR)/box_plot.h \
           $(SRCDIR)/fglobal.h $(SRCDIR)/wshare.h \
            $(SRCDIR)/axis.h $(SRCDIR)/baseGraph.h \
	$(SRCDIR)/extract.h $(SRCDIR)/frame.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/box_plot.cxx

cmdspec2.o: $(SRCDIR)/cmdspec2.cxx  $(SRCDIR)/wshare.h\
     $(SRCDIR)/axis.h $(SRCDIR)/new_read.h $(SRCDIR)/cmd.h \
      $(SRCDIR)/fglobal.h $(SRCDIR)/box_plot.h $(SRCDIR)/gaussbox.h \
      $(SRCDIR)/words.h $(SRCDIR)/control.h $(SRCDIR)/npic.h \
      $(SRCDIR)/frame.h $(SRCDIR)/baseGraph.h $(SRCDIR)/space.h \
      $(SRCDIR)/fortran.h $(SRCDIR)/spacebox.h $(SRCDIR)/svd.h \
	$(SRCDIR)/fileselect.h $(SRCDIR)/readfunc.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/cmdspec2.cxx


curs.o: $(SRCDIR)/curs.cxx $(SRCDIR)/wshare.h \
           $(SRCDIR)/cmd.h  $(SRCDIR)/axis.h $(SRCDIR)/fglobal.h \
          $(SRCDIR)/frame.h $(SRCDIR)/baseGraph.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/curs.cxx

dein.o: $(SRCDIR)/dein.cxx  $(SRCDIR)/cmd.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/fortran.h \
	$(SRCDIR)/extract.h $(SRCDIR)/readfunc.h \
	$(SRCDIR)/fileselect.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/dein.cxx

drawM.o: $(SRCDIR)/drawM.cxx  $(SRCDIR)/cmd.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/wshare.h \
	   $(SRCDIR)/frame.h $(SRCDIR)/baseGraph.h  \
          $(SRCDIR)/axis.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/drawM.cxx


dxops.o: $(SRCDIR)/dxops.cxx  $(SRCDIR)/new_read.h \
          $(SRCDIR)/axis.h $(SRCDIR)/cmd.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/wshare.h \
          $(SRCDIR)/box_plot.h $(SRCDIR)/npic.h \
          $(SRCDIR)/fortran.h $(SRCDIR)/space.h $(SRCDIR)/spacebox.h \
          $(SRCDIR)/frame.h $(SRCDIR)/baseGraph.h \
          $(SRCDIR)/svd.h $(SRCDIR)/editbox.h $(SRCDIR)/readfunc.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/dxops.cxx

editbox.o: $(SRCDIR)/editbox.cxx $(SRCDIR)/editbox.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/editbox.cxx

extract.o: $(SRCDIR)/extract.cxx $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/extract.cxx

fglobal.o: $(SRCDIR)/fglobal.cxx  $(SRCDIR)/fglobal.h \
            $(SRCDIR)/cmd.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/fglobal.cxx

file_rec.o: $(SRCDIR)/file_rec.cxx  $(SRCDIR)/cmd.h \
	    $(SRCDIR)/fglobal.h $(SRCDIR)/extract.h \
            $(SRCDIR)/file_rec.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/file_rec.cxx

fileselect.o: $(SRCDIR)/fileselect.cxx  $(SRCDIR)/cmd.h \
	    $(SRCDIR)/fglobal.h $(SRCDIR)/fileselect.h \
            $(SRCDIR)/wshare.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/fileselect.cxx

frame.o: $(SRCDIR)/frame.cxx  $(SRCDIR)/cmd.h \
	    $(SRCDIR)/frame.h $(SRCDIR)/fglobal.h $(SRCDIR)/wshare.h \
           $(SRCDIR)/baseGraph.h $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/frame.cxx

gamma.o: $(SRCDIR)/gamma.cxx $(SRCDIR)/cmd.h \
         $(SRCDIR)/fglobal.h $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/gamma.cxx

gaussbox.o: $(SRCDIR)/gaussbox.cxx $(SRCDIR)/gaussbox.h \
            $(SRCDIR)/wshare.h $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h \
            $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/gaussbox.cxx

gaussentry.o: $(SRCDIR)/gaussentry.cxx $(SRCDIR)/gaussbox.h \
            $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/gaussentry.cxx

gfit.o: $(SRCDIR)/gfit.cxx $(SRCDIR)/gaussbox.h \
            $(SRCDIR)/cmd.h $(SRCDIR)/fglobal.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/gfit.cxx

graphs.o: $(SRCDIR)/graphs.cxx  $(SRCDIR)/cmd.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/wshare.h \
	   $(SRCDIR)/frame.h  $(SRCDIR)/baseGraph.h $(SRCDIR)/axis.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/graphs.cxx

graph_data.o: $(SRCDIR)/graph_data.cxx  $(SRCDIR)/cmd.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/wshare.h \
	   $(SRCDIR)/frame.h $(SRCDIR)/baseGraph.h $(SRCDIR)/axis.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/graph_data.cxx

inteprate.o: $(SRCDIR)/inteprate.cxx $(SRCDIR)/poly2.h \
          $(SRCDIR)/splx_fit.h $(SRCDIR)/wshare.h $(SRCDIR)/cmd.h \
           $(SRCDIR)/fit_param.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/inteprate.cxx

help.o: $(SRCDIR)/help.cxx $(SRCDIR)/help.h \
         $(SRCDIR)/cmd.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/help.cxx

intep_c.o: $(SRCDIR)/intep_c.cxx $(SRCDIR)/poly2.h \
          $(SRCDIR)/cmd.h  $(SRCDIR)/wshare.h \
          $(SRCDIR)/fit_param.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/intep_c.cxx

linespec.o: $(SRCDIR)/linespec.cxx  $(SRCDIR)/wshare.h\
     $(SRCDIR)/axis.h $(SRCDIR)/new_read.h $(SRCDIR)/cmd.h \
      $(SRCDIR)/fglobal.h $(SRCDIR)/box_plot.h $(SRCDIR)/gaussbox.h \
      $(SRCDIR)/words.h $(SRCDIR)/control.h 
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/linespec.cxx

linfit.o: $(SRCDIR)/linfit.cxx $(SRCDIR)/linfit.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/linfit.cxx

menu_build.o: $(SRCDIR)/menu_build.cxx $(SRCDIR)/wshare.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/menu_build.cxx

new_read.o: $(SRCDIR)/new_read.cxx $(SRCDIR)/wshare.h \
       $(SRCDIR)/new_read.h $(SRCDIR)/fglobal.h $(SRCDIR)/axis.h \
        $(SRCDIR)/cmd.h $(SRCDIR)/space.h $(SRCDIR)/extract.h \
        $(SRCDIR)/areaInt.h $(SRCDIR)/spacebox.h $(SRCDIR)/readfunc.h \
	$(SRCDIR)/baseGraph.h 
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/new_read.cxx

npic.o: $(SRCDIR)/npic.cxx $(SRCDIR)/npic.h $(SRCDIR)/wshare.h \
        $(SRCDIR)/cmd.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/npic.cxx

nrot.o: $(SRCDIR)/nrot.cxx $(SRCDIR)/npic.h $(SRCDIR)/wshare.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/nrot.cxx

object.o: $(SRCDIR)/object.cxx $(SRCDIR)/cmd.h $(SRCDIR)/fglobal.h \
          $(SRCDIR)/baseGraph.h $(SRCDIR)/frame.h $(SRCDIR)/wshare.h \
          $(SRCDIR)/extract.h $(SRCDIR)/axis.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/object.cxx

out.o: $(SRCDIR)/out.cxx $(SRCDIR)/cmd.h $(SRCDIR)/fglobal.h \
        $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/out.cxx

outinfo.o: $(SRCDIR)/outinfo.cxx $(SRCDIR)/cmd.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/outinfo.cxx

poly.o: $(SRCDIR)/poly.cxx $(SRCDIR)/poly2.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/poly.cxx

poly_c.o: $(SRCDIR)/poly_c.cxx $(SRCDIR)/fglobal.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/poly_c.cxx

qspace.o: $(SRCDIR)/qspace.cxx $(SRCDIR)/cmd.h $(SRCDIR)/fglobal.h \
          $(SRCDIR)/fortran.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/qspace.cxx

rebin.o: $(SRCDIR)/rebin.cxx $(SRCDIR)/cmd.h $(SRCDIR)/fglobal.h \
          $(SRCDIR)/fortran.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/rebin.cxx


savgol.o: $(SRCDIR)/savgol.cxx $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/savgol.cxx

self.o: $(SRCDIR)/self.cxx $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h \
        $(SRCDIR)/fortran.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/self.cxx

space.o: $(SRCDIR)/space.cxx $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h \
          $(SRCDIR)/baseGraph.h $(SRCDIR)/frame.h $(SRCDIR)/wshare.h \
	$(SRCDIR)/axis.h $(SRCDIR)/space.h 
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/space.cxx

spacebox.o: $(SRCDIR)/spacebox.cxx $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h \
          $(SRCDIR)/wshare.h $(SRCDIR)/space.h $(SRCDIR)/fglobal.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/spacebox.cxx

splx_fit2.o: $(SRCDIR)/splx_fit2.cxx $(SRCDIR)/splx_fit.h \
           $(SRCDIR)/poly2.h $(SRCDIR)/cmd.h $(SRCDIR)/fglobal.h \
            $(SRCDIR)/fit_param.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/splx_fit2.cxx

supplot.o: supplot.cxx wshare.h $(SRCDIR)/poly2.h 
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/supplot.cxx

svd.o: $(SRCDIR)/svd.cxx $(SRCDIR)/svd.h 
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/svd.cxx

two_graphic.o: $(SRCDIR)/two_graphic.cxx $(SRCDIR)/cmd.h \
     $(SRCDIR)/wshare.h $(SRCDIR)/axis.h $(SRCDIR)/new_read.h \
      $(SRCDIR)/pgxwin.hxx $(SRCDIR)/fglobal.h $(SRCDIR)/XmPgplot.hxx \
      $(SRCDIR)/XmPgplotP.hxx $(SRCDIR)/frame.h $(SRCDIR)/space.h \
       $(SRCDIR)/spacebox.h $(SRCDIR)/baseGraph.h $(SRCDIR)/box_plot.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/two_graphic.cxx 

temp.o: $(SRCDIR)/temp.cxx $(SRCDIR)/poly2.h $(SRCDIR)/temp.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/temp.cxx

temp_inst.o: $(SRCDIR)/temp_inst.cxx $(SRCDIR)/poly2.h 
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/temp_inst.cxx

view.o:	$(SRCDIR)/view.cxx $(SRCDIR)/cmd.h $(SRCDIR)/fortran.h \
	$(SRCDIR)/fglobal.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/view.cxx

wave.o: $(SRCDIR)/wave.cxx $(SRCDIR)/wave.h \
          $(SRCDIR)/fglobal.h $(SRCDIR)/cmd.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/wave.cxx

wind.o: $(SRCDIR)/wind.cxx $(SRCDIR)/wshare.h $(SRCDIR)/poly2.h \
         $(SRCDIR)/cmd.h $(SRCDIR)/fit_param.h $(SRCDIR)/fglobal.h 
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/wind.cxx

words.o: $(SRCDIR)/words.cxx $(SRCDIR)/cmd.h $(SRCDIR)/wordlist.h \
          $(SRCDIR)/words.h $(SRCDIR)/extract.h
	$(CCOMPL) -c $(CFLAGE) $(XINCL) $(SRCDIR)/words.cxx

work.o: $(SRCDIR)/work.cxx $(SRCDIR)/fortran.h $(SRCDIR)/cmd.h  \
        $(SRCDIR)/fglobal.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/work.cxx

xraymap.o: $(SRCDIR)/xraymap.cxx cmd.h $(SRCDIR)/fglobal.h \
        $(SRCDIR)/new_read.h  $(SRCDIR)/axis.h $(SRCDIR)/wshare.h \
        $(SRCDIR)/baseGraph.h $(SRCDIR)/areaInt.h $(SRCDIR)/spacebox.h \
        $(SRCDIR)/space.h
	$(CCOMPL) -c $(CFLAGC) $(XINCL) $(SRCDIR)/xraymap.cxx

XmPgplot.o: $(SRCDIR)/XmPgplot.c  
	gcc -c -g -DPG_PPU $(XINCL) $(SRCDIR)/XmPgplot.c


pgxwin.o: $(SRCDIR)/pgxwin.c $(SRCDIR)/pgxwin.h 
	gcc -c -g -DPG_PPU  $(SRCDIR)/pgxwin.c

zip: tar cpress

dist: full_tar cpress

tar: atar

full_tar:
	tar -cvf nwin.tar $(ASRC)  makefile \
                 readme.txt licence.txt 


atar:
	tar -cvf nwin.tar $(ASRC) XmPgplotP.hxx XmPgplot.hxx \
                 pgcel0.f pgxwin.hxx cpgplot.h makefile \
                 dsqinf.f  pgxtal.f  plot2db3.f XmPgplotP.h XmPgplot.h \
                 grpckg1.inc coltabs.inc 


cpress:
	gzip nwin.tar

htar:
	tar -cvf ncmdh.tar $(ISRC) makefile

ctar:
	tar -cvf ncmdc++.tar $(CSRC) makefile

ftar:
	tar -cvf ncmdfor.tar $(FSRC) 

distrib: cmds full_tar cpress bin_zip

bin_tar: $(SRCDIR)/cmds $(SRCDIR)/grfont.dat \
           $(SRCDIR)/licence.txt $(SRCDIR)/readme.txt 
	tar -cvf bin_nwin.tar cmds readme.txt \
                 grfont.dat licence.txt 

bin_zip: bin_tar 
	gzip bin_nwin.tar

tags:
	etags $(ASRC)

words_F:
	lines.pl $(FSRC)
words: 
	lines.pl $(MSRC)

clean:
	rm *.o

