#  NETMAJ-XUI -- X User Interface --  Copyright Notice
#
#      Copyright (c) 1995,1996 Todo Software All rights reserved.
#
#   You can redistribute it and/or modify this software under the terms
#  of the GNU General Public License version 2 as published by
#  the Free Software Foundation.
#
#   This software is provided 'as-is', without any express or implied
#  warranty.  In no event will the author be held liable for any damages
#  arising from the use of this software.
#  See the gpl.text for more details.
#
#   If you would like to do something with NETMAJ that this copyright
#  prohibits (such as distributing it with a commercial product,
#  using portions of the source in some other program, etc.), please
#  contact the author (preferably via email).  Arrangements can
#  probably be worked out.
#
#   Todo Software : NBC02365@niftyserve.or.jp
#

VERSION=2
REVISION=0
INTERNAL_REVISION=7
ARCFILE=netmaj-xui-$(VERSION).$(REVISION).$(INTERNAL_REVISION).tar.gz

# C compiler fcc, gcc, or cc; ANSI C compiler required 
# fcc is Fujitsu Optimizing C compiler
CC=cc
# Debugging option or Optimization Option
G=-g
# C Compiler options: Please compile ANSI C: -Xa or -ansi
CCFLAGS=-DHUGEPAI=0
# where X11
X11INC=/usr/X11R6/include
X11LIB=/usr/X11R6/lib
RANLIB=ranlib
INSTALL=install
LIBS=
CFLAGS=
BINDIR=/usr/local/bin
LIBDIR=/usr/local/lib/netmaj
#CP1=$(INSTALL) -s -m 755 -o bin -g bin 
#CP2=$(INSTALL) -c -m 666 -o bin -g bin 
CP1=$(INSTALL) -s  
CP2=$(INSTALL) -c  

all:
	- (cd src/gt; make CC="$(CC)" G="$(G)" CCFLAGS="$(CCFLAGS)" X11INC="$(X11INC)" X11LIB="$(X11LIB)" RANLIB="$(RANLIB)")
	- (cd src/util; make CC="$(CC)" G="$(G)" CCFLAGS="$(CCFLAGS)" RANLIB="$(RANLIB)" )
	- (cd src/int; make CC="$(CC)" G="$(G)" CCFLAGS="$(CCFLAGS)"  RANLIB="$(RANLIB)" )
	- if test -d src/netmaj-1.2.x; then \
	(cd src/netmaj-1.2.x; make CC="$(CC)" G="$(G)" CCFLAGS="$(CCFLAGS)" OS_CFLAGS="$(OS_CFLAGS)" RANLIB="$(RANLIB)" ); fi
	- (cd src/xui; make CC="$(CC)" G="$(G)" CCFLAGS="$(CCFLAGS)" X11INC="$(X11INC)" X11LIB="$(X11LIB)" RANLIB="$(RANLIB)" LIBS="$(LIBS)" OS_CFLAGS="$(OS_CFLAGS)" BINDIR=$(BINDIR) LIBDIR=$(LIBDIR))

clean:
	-(cd src/gt; make -k clean)
	- (cd src/util; make -k clean)
	- (cd src/int; make -k clean)
	-if test -d src/netmaj-1.2.x; then \
		(cd src/netmaj-1.2.x; make -k clean); fi
	- (cd src/xui; make -k clean)
	/bin/rm -f *~ doc/*~ pf/.*~ pf/.*.pf~ *.core core .*~ *.bak

install:
		$(CP1) src/xui/xclient $(LIBDIR)/xclient
		$(CP1) src/xui/xnetmaj1 $(BINDIR)/xnetmaj1
		$(CP1) src/xui/xplview $(BINDIR)/xplview
		@echo "xnetmaj install done"

install-pf:
	-if test -d $(LIBDIR); then \
		$(CP2) ./misc/pf/.*.pf $(LIBDIR); fi

uninstall:
	/bin/rm -f $(LIBDIR)/xclient
	/bin/rm -f $(BINDIR)/xnetmaj1
	/bin/rm -f $(BINDIR)/xplview
	/bin/rm -f $(LIBDIR)/.xnetmaj
	/bin/rm -f $(LIBDIR)/.*.pf

tar:
	(cd  ..; tar -zcvf $(ARCFILE) `cat xui/FILES`)
