#
# **************************************************************
# *                  SIMUSOL PROYECT                           *
# *                                                            *
# *         sceptre-simusol for SIMUSOL                        *
# *                                                            *
# *                                                            *
# *   Developed by                                             *
# *   Dolores Alia  and Diego.Saravia@gmail.com                *
# *   2017                                                     *
# *   and could be used with GPL                               *
# *   or every free license with copyleft needed.              *
# *   http://www.simusol.org                                   *
# **************************************************************
# Requiere la instalacion PREVIA de summapack
# This file is part of Simusol proyect
# 
#
#    dia-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.
#
#    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/>.

# antes de lib
all: compile

FC      = gfortran
FFLAGS  = -fno-automatic  -finit-local-zero -O -W -Wall -Wextra -g
MAKE=make
PACK=sceptre-simusol

# salvo etc en home

compile:	
	cd auxpro;  ${MAKE} "FC=${FC}" "FFLAGS=${FFLAGS}" 
	cd phase1;  ${MAKE} "FC=${FC}" "FFLAGS=${FFLAGS}" 
	cd phase2;  ${MAKE} "FC=${FC}" "FFLAGS=${FFLAGS}"
	cd extras;  ${MAKE} "FC=${FC}" "FFLAGS=${FFLAGS}" 


BINFILES=phase1/sceptre1 auxpro/ngp_gnu

# VERE postinstall
LIBFILES=phase2/libsceptre.a phase2/sceptre2.o auxpro/libsceptreaux.a  extras/simusoltable.o extras/radiacion.o



# si SCRDIR=src se entiende que no se quiere instalar, dado que no tiene sentido instalrse sobre si misma


PREFIX=/usr/local/
BINDIR=bin/
LIBDIR=lib/



install:
	for FILE in ${BINFILES} ; do \
		FILEP=`basename  $${FILE}`;\
		install -m 755  $${FILE} ${PREFIX}/${BINDIR}/$${FILEP}  ;\
		echo "A:${PREFIX}/${BINDIR}/$${FILEP}" >> listado.ls ; \
		echo "A:${PREFIX}/${BINDIR}/$${FILEP}" ; \
		done;
	for FILE in ${LIBFILES} ; do \
		FILEP=`basename  $${FILE}`;\
		install -m 644  $${FILE} ${PREFIX}/${LIBDIR}/$${FILEP}  ;\
		echo "A:${PREFIX}/${LIBDIR}/$${FILEP}" >> listado.ls ; \
		echo "A:${PREFIX}/${LIBDIR}/$${FILEP}"  ; \
	done;


