
#
# **************************************************************
# *                  SIMUSOL PROYECT                           *
# *                                                            *
# *         GSL for SIMUSOL                                    *
# *                                                            *
# *                                                            *
# *   Developed by                                             *
# *   Diego.Saravia@gmail.com, 2016                            *
# *   and could be used with GPL                               *
# *   or every free license with copyleft needed.              *
# *   http://www.simusol.org                                   *
# **************************************************************

# needs simusol_exprtk

# This file is part of simusol-gsl.
#
#    Table is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Table is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Table.  If not, see <http://www.gnu.org/licenses/>.

VERSION=0.1
NAME=simusol_exprtk

SUBDIRS=src examples
SUBDIRST=  $(SUBDIRS) perl
.PHONY:  subdirs  $(SUBDIRS)

all:  makefile.inc unzip cp $(SUBDIRS) perl


../makefile.inc:         # para el caso que se desempaquete fuera del arbol, mejor bajar del sistio de simusol
	if [ ! -e ../makefile.inc ];  then 	cp makefile.inc ../makefile.inc; fi;

makefile.inc: ../makefile.inc #, mejor bajar del sistio de simusol o si no ...
	cp ../makefile.inc makefile.inc

cp:   # bajar web
	if [ ! -e COPYING ];  then cp  ../gpl-3.0.txt   COPYING; fi


include makefile.inc

subdirs: $(SUBDIRS)

$(SUBDIRS):
	$(MAKE) -C $@

perl: src
	cd perl; perl Makefile.PL; make; sudo make install

clean:
	rm -rf *~
	cd perl;  if [ ! -e Makefile ]; then perl Makefile.PL; fi
	for dir in $(SUBDIRST); do \
	  echo CLEAN $$dir; \
	  $(MAKE) -C $$dir  clean; \
	done
	cd perl ; if [ ! -e Makefile ]; then  mv Makefile.old Makefile; echo ""; fi
	cd perl; rm -rf results blib lib MYMETA* META* pm_to_blib
	make -C perl/src clean
	rm -rf perl/Makefile.old perl/Makefile

install:
	sudo make -C src install
	cd perl;  if [ x"$$SUDO_USER" != x"" ] ; then echo SU $$SUDO_USER; sudo -u $$SUDO_USER perl Makefile.PL; sudo -u $$SUDO_USER make; else perl Makefile.PL; make; sudo make install; fi

