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

#
#    Simusol 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.
#
#    Calcula 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=2017.0.1
NAME=simusol_Base

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

all:   perl


install: 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:
	cd perl; perl Makefile.PL; make; sudo make install

clean:
	rm -rf *~
	cd perl;  if [ ! -e Makefile ]; then perl Makefile.PL; fi
	cd perl ; if [ ! -e Makefile ]; then  mv Makefile.old Makefile; echo ""; fi
	cd perl; rm -rf results tests tmps blib MYMETA* META* pm_to_blib lib/Simusol/*~ examples2/cauxes examples2/cdata examples2/cfunctions examples2/cprojects examples2/results examples2/tests examples2/tmps examples2/simusol.log
	rm -rf perl/Makefile.old perl/Makefile

# no entiendo pq no borra ~ en l a primera linea


#	for dir in $(SUBDIRST); do \
#	  echo CLEAN $$dir; \
#	  $(MAKE) -C $$dir  clean; \
#	done

#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

distcleanI: clean
	rm -f ../${NAME}_*.tar.gz

dist:   distcleanI   # I para que no choque con Makefile.PL
	echo DIST INC ${NAME}-${VERSION}
	rm -rf /tmp/${NAME}-${VERSION}
	mkdir  /tmp/${NAME}-${VERSION}
	cp -La . /tmp/${NAME}-${VERSION}  #usar link, ver tar
	cd /tmp; tar -zcvf $(CURDIR)/../${NAME}_${VERSION}.tar.gz ${NAME}-${VERSION}
