#!/bin/sh
#
# Installer for g95 <http://www.g95.org/>
#
##########################################################################
# for debian package
DESTDIR=/usr/local
#
# Directory to which the binary files are installed
BINDIR=$(DESTDIR)/bin
#
# Directory to which the libraries are installed
LIBDIR=$(DESTDIR)/lib/g95/lib
LIBBINDIR=$(DESTDIR)/lib/g95/bin
#
# Directory to which the documents are installed
DOCDIR=$(DESTDIR)/share/doc/g95

EXECFILE = i686-pc-linux-gnu-g95
EXECNAME = g95
DOCFILES = G95Manual.pdf INSTALL

##########################################################################

install: lib-install bin-install doc

lib-install:
	if [ ! -d $(LIBDIR) ]; then mkdir -p $(LIBDIR); fi
	if [ ! -d $(LIBBINDIR) ]; then mkdir -p $(LIBBINDIR); fi
	cp -r lib/* $(LIBDIR)/
	cp bin/$(EXECFILE) $(LIBBINDIR)/

bin-install: 
	if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); fi
	cd $(BINDIR) ; ln -s ../lib/g95/bin/$(EXECFILE) ./$(EXECNAME)

doc:
	if [ ! -d $(DOCDIR) ]; then mkdir -p $(DOCDIR); fi
	cp $(DOCFILES) $(DOCDIR)/

clean:	
	-rm *~ */*~
