#
MAINVERSION = '"6.03"'
GUIVERSION = '".54"'
VERSION=6.3.54
ALIGNSIZE = 8
LIBDIR = '"/usr/local/lib/Ngraph"'
INSTALLDIR = /usr/local/lib/Ngraph
BINDIR = /usr/local/bin
#
#
###############################################################################
#
# Linux + Open Motif 2.1 [dynamic link]
#
CC = gcc
CCOPTION = -O2
MAKE = make
AR = ar
RANLIB = ranlib
STRIP = strip
DEFS = -DJAPANESE
PLATFORM  = '"for X11 [Linux(glibc2) + Open Motif]"'
X11INCLUDE = 
STATICLINK =
X11LIB = -L/usr/X11R6/lib -lm -lXm -lXext -lXt -lXp -lX11 -lICE -lSM
#
#
###############################################################################
#
# Linux + Open Motif 2.1 [static link]
#
#CC = gcc
#CCOPTION = -O2 -m486
#MAKE = make
#AR = ar
#RANLIB = ranlib
#STRIP = strip
#DEFS = -DJAPANESE
#PLATFORM  = '"for X11 [Linux(glibc2) + Open Motif]"'
#X11INCLUDE = 
#STATICLINK = /usr/X11R6/lib/libXm.a 
#X11LIB = -L/usr/X11R6/lib -lm -lXext -lXt -lXp -lX11 -lICE -lSM
#
#
###############################################################################
#
# Linux + LessTif (Motif 2.0 compatible) [dynamic link]
#
#CC = gcc
#CCOPTION = -O2 -m486
#MAKE = make
#AR = ar
#RANLIB = ranlib
#STRIP = strip
#DEFS =
#PLATFORM  = '"for X11 [Linux+LessTif]"'
#X11INCLUDE = -I/usr/local/LessTif/Motif2.0/include
#STATICLINK = 
#X11LIB = -L/usr/local/lib -L/usr/X11R6/lib -lm -lXm -lXt -lX11
#
#
###############################################################################
#
# Linux + LessTif (Motif 1.2 compatible) [static link]
#
#CC = gcc
#CCOPTION = -O2 -m486
#MAKE = make
#AR = ar
#RANLIB = ranlib
#STRIP = strip
#DEFS = -DMOTIF12
#PLATFORM  = '"for X11 [Linux+LessTif]"'
#X11INCLUDE = -I/usr/local/LessTif/Motif1.2/include -I../combo
#STATICLINK = ./combo/ComboBox.o /usr/local/LessTif/Motif1.2/lib/libXm.a
#X11LIB = -L/usr/X11R6/lib -lm -lXmu -lXt -lX11 
#
#
###############################################################################
#
# generic + Motif 1.2 [dynamic link]
#
#CC = gcc
#CCOPTION = -O2 -m486
#MAKE = make
#AR = ar
#RANLIB = ranlib
#STRIP = strip
#DEFS = -DJAPANESE -DMOTIF12
#PLATFORM  = '"for X11 [Motif1.2]"'
#X11INCLUDE = -I../combo
#STATICLINK = ./combo/ComboBox.o
#X11LIB = -L/usr/X11R6/lib -lm -lXm -lXmu -lXt -lX11 
#
#
###############################################################################
#
# EWS4800 EWS-UX
#
#CC = cc
#CCOPTION = -O
#MAKE = make
#AR = ar
#RANLIB = echo
#STRIP = strip
#DEFS = -DJAPANESE -DMOTIF12
#PLATFORM  = '"for X11 [EWS-UX]"'
#X11INCLUDE = -I../combo
#STATICLINK = ./combo/ComboBox.o
#X11LIB = -L/usr/X11R6/lib -lm -lXm -lXmu -lXt -lX11 -lXext -lICE -lSM -lsocket -lnsl -lgen
#
###############################################################################
#
# digital UNIX
#
#CC = cc
#CCOPTION = -O -assume noaligned_objects
#MAKE = make
#AR = ar
#RANLIB = ranlib
#STRIP = strip
#DEFS = -DJAPANESE -DMOTIF12 -DCDE
#PLATFORM  = '"for X11 [digital UNIX]"'
#X11INCLUDE = -I/usr/dt/share/include/Dt
#STATICLINK =
#X11LIB = -lm -lXm -lDtWidget -lXt -lX11
#
###############################################################################
#
# Solaris 2.6 
#
# (Thanks to Kenya SUYAMA <kenya@cyclone.tokai.jaeri.go.jp>)
#
## WorkShop Compilers 4.2 30 Oct 1996 C 4.2
#CC = cc
#CCOPTION = -O
#MAKE = gmake
#AR = /usr/ccs/bin/ar
#RANLIB = /usr/ccs/bin/ranlib
#STRIP= /usr/ccs/bin/strip
#DEFS = -DJAPANESE -DMOTIF12 -DCDE
#PLATFORM  = '"for X11 [Solaris 2.6]"'
#X11INCLUDE = -I/usr/dt/share/include/Dt
#STATICLINK =
#X11LIB = -L/usr/dt/lib -lm -lXm -lDtWidget -lXt -lX11
#
###############################################################################
#
# FreeBSD (3.2-RELEASE) + Motif 2.1 (apps2go)  [static link] 
#
# (Thanks to MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>)
#
#CC = gcc
#CCOPTION = ${CFLAGS}
#MAKE = gmake
#AR = ar
#RANLIB = ranlib
#STRIP = strip
#DEFS = -DJAPANESE
#PLATFORM  = '"for X11 [FreeBSD+Motif2.1]"'
#X11INCLUDE = -I/usr/X11R6/include -I/usr/dt/include
#STATICLINK = /usr/dt/lib/libXm.a
#X11LIB = -L/usr/X11R6/lib -L/usr/dt/lib -lm -lXext -lXt -lXp -lX11 -lICE -lSM -lxpg4
#
###############################################################################

export CC CCOPTION MAKE AR RANLIB STRIP INSTALL
export MAINVERSION GUIVERSION LIBDIR ALIGNSIZE
export DEFS PLATFORM X11INCLUDE
export INSTALLDIR BINDIR

OBJECT = x11/main.o x11/x11.a src/kern.a

all:
	($(MAKE) clean)
	($(MAKE) src/kern.a)
	($(MAKE) x11/main.o)
	($(MAKE) x11/main.o)
	($(MAKE) x11/x11.a)
	($(MAKE) ngraph)
	($(MAKE) x11drive/gra2ps)
	($(MAKE) x11drive/gra2wmf)
	($(MAKE) x11addin/fft)
	($(MAKE) terminal)

ngraph:	$(OBJECT)
	$(CC) -o ngraph $(OBJECT) $(STATICLINK) $(X11LIB)
	$(STRIP) ngraph

terminal: terminal.c
	$(CC) -o terminal terminal.c

src/kern.a:
	(cd src; $(MAKE) kern.a)

x11/x11.a:
	(cd x11; $(MAKE) x11.a)

x11/main.o:
	(cd x11; $(MAKE) main.o)

x11drive/gra2ps: x11drive/gra2ps.c
	(cd x11drive; $(MAKE) gra2ps)

x11drive/gra2wmf: x11drive/gra2wmf.c x11drive/wmfapi.c x11drive/wmfapi.h
	(cd x11drive; $(MAKE) gra2wmf)

x11addin/fft:
	(cd x11addin; $(MAKE) fft)

clean:
	- rm ngraph terminal
	- (cd src; $(MAKE) clean)
	- (cd x11; $(MAKE) clean)
	- (cd x11drive; $(MAKE) clean)
	- (cd x11addin; $(MAKE) clean)

cleanbackup:
	rm *~ src/*~ x11/*~ x11drive/*~

install:
	(sh install.sh)

distbin:
	- rm -r ./distb/Ngraph
	mkdir ./distb/Ngraph
	mkdir ./distb/Ngraph/x11drive
	mkdir ./distb/Ngraph/x11addin
	mkdir ./distb/Ngraph/x11demo
	mkdir ./distb/Ngraph/x11help
	mkdir ./distb/Ngraph/x11help/img
	mkdir ./distb/Ngraph/x11help/tutorial
	mkdir ./distb/Ngraph/x11help/dialogs
	mkdir ./distb/Ngraph/icon
	mkdir ./distb/Ngraph/ja
	chmod 0755 ./distb/Ngraph
	chmod 0755 ./distb/Ngraph/x11drive
	chmod 0755 ./distb/Ngraph/x11addin
	chmod 0755 ./distb/Ngraph/x11demo
	chmod 0755 ./distb/Ngraph/x11help
	chmod 0755 ./distb/Ngraph/x11help/img
	chmod 0755 ./distb/Ngraph/x11help/tutorial
	chmod 0755 ./distb/Ngraph/x11help/dialogs
	chmod 0755 ./distb/Ngraph/icon
	chmod 0755 ./distb/Ngraph/ja
	cp gpl.txt gpl.ja.txt INSTALL.jis Ngraph.ini Ngraph .Ngraph .Ngraph.ngp .fit.ngp install.sh ngraph.sh ngraph terminal ./distb/Ngraph
	(cd ./distb/Ngraph; \
	chmod 0644 gpl.txt gpl.ja.txt INSTALL.jis Ngraph.ini Ngraph .Ngraph .Ngraph.ngp .fit.ngp; \
	chmod 0755 install.sh ngraph.sh ngraph terminal )
	cp  ja/Ngraph ./distb/Ngraph/ja
	(cd ./distb/Ngraph/ja; \
	chmod 0644 Ngraph )
	cp x11drive/gra2ps x11drive/Ngraph.ps x11drive/gra2ps.ini x11drive/gra2wmf x11drive/gra2wmf.ini ./distb/Ngraph/x11drive
	(cd ./distb/Ngraph/x11drive; \
	chmod 0644 Ngraph.ps gra2ps.ini gra2wmf.ini; \
	chmod 0755 gra2ps gra2wmf )
	cp x11addin/append.nsc x11addin/math.nsc x11addin/text-in.nsc x11addin/calc.nsc x11addin/calc.tcl x11addin/legend.nsc x11addin/legend.tcl x11addin/fitrslt.nsc x11addin/fitrslt.tcl x11addin/fft x11addin/fft.tcl x11addin/fft.nsc ./distb/Ngraph/x11addin
	(cd ./distb/Ngraph/x11addin; \
	chmod 0644 append.nsc math.nsc text-in.nsc calc.nsc calc.tcl legend.nsc legend.tcl fitrslt.nsc fitrslt.tcl; \
	chmod 0755 fft )
	cp x11demo/demo*.dat x11demo/*.ngp ./distb/Ngraph/x11demo
	(cd ./distb/Ngraph/x11demo; \
	chmod 0644 demo*.dat *.ngp )
	cp x11help/*.htm ./distb/Ngraph/x11help
	cp x11help/img/*.gif ./distb/Ngraph/x11help/img
	cp x11help/tutorial/* ./distb/Ngraph/x11help/tutorial
	cp x11help/dialogs/* ./distb/Ngraph/x11help/dialogs
	(cd ./distb/Ngraph/x11help; \
	chmod 0644 *.htm img/* tutorial/* dialogs/* )
	cp icon/Ngraph.xpm ./distb/Ngraph/icon
	(cd ./distb/Ngraph/icon; \
	chmod 0644 Ngraph.xpm )
	(cd ./distb/Ngraph; \
	ln -s install.sh Install; \
	ln -s INSTALL.jis README.jis )
	- rm ./distb/Ngraph-${VERSION}-linux.tar.gz
	(cd ./distb; \
	mv Ngraph Ngraph-${VERSION}-linux; \
	tar cvzf Ngraph-${VERSION}-linux.tar.gz ./Ngraph-${VERSION}-linux; \
	mv Ngraph-${VERSION}-linux Ngraph )

distsrc:
	- rm -r ./dists/Ngraph
	mkdir ./dists/Ngraph
	mkdir ./dists/Ngraph/src
	mkdir ./dists/Ngraph/x11
	mkdir ./dists/Ngraph/x11drive
	mkdir ./dists/Ngraph/x11addin
	mkdir ./dists/Ngraph/x11demo
	mkdir ./dists/Ngraph/x11help
	mkdir ./dists/Ngraph/x11help/img
	mkdir ./dists/Ngraph/x11help/tutorial
	mkdir ./dists/Ngraph/x11help/dialogs
	mkdir ./dists/Ngraph/ja
	mkdir ./dists/Ngraph/icon
	cp gpl.txt gpl.ja.txt INSTALL.jis TODO.jis install.sh ngraph.sh ./dists/Ngraph
	cp  Makefile Ngraph.ini Ngraph .Ngraph .Ngraph.ngp .fit.ngp terminal.c ./dists/Ngraph
	cp src/Makefile src/*.c src/*.h ./dists/Ngraph/src
	cp x11/Makefile x11/*.c x11/*.h ./dists/Ngraph/x11
	cp x11drive/Makefile x11drive/gra2ps.c x11drive/gra2prn.c x11drive/Ngraph.ps x11drive/gra2ps.ini x11drive/gra2wmf.c x11drive/wmfapi.c x11drive/wmfapi.h x11drive/gra2wmf.ini ./dists/Ngraph/x11drive
	cp x11addin/Makefile x11addin/append.nsc x11addin/math.nsc x11addin/text-in.nsc x11addin/calc.nsc x11addin/calc.tcl x11addin/legend.nsc x11addin/legend.tcl x11addin/fitrslt.nsc x11addin/fitrslt.tcl x11addin/fft.c x11addin/fft.nsc x11addin/fft.tcl ./dists/Ngraph/x11addin
	cp x11demo/demo*.dat x11demo/*.ngp ./dists/Ngraph/x11demo
	cp x11help/*.htm ./dists/Ngraph/x11help
	cp x11help/img/*.gif ./dists/Ngraph/x11help/img
	cp x11help/tutorial/* ./dists/Ngraph/x11help/tutorial
	cp x11help/dialogs/* ./dists/Ngraph/x11help/dialogs
	cp ja/Ngraph ./dists/Ngraph/ja
	cp icon/Ngraph.xpm ./dists/Ngraph/icon
	- rm ./dists/Ngraph-${VERSION}-src.tar.gz
	(cd ./dists; \
	mv Ngraph Ngraph-${VERSION}-src; \
	tar cvzf Ngraph-${VERSION}-src.tar.gz ./Ngraph-${VERSION}-src; \
	mv Ngraph-${VERSION}-src Ngraph )
