From fc4da362e3f2013b849b1f31076c85360f89ace5 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 18 Jan 2017 15:18:55 -0600 Subject: [PATCH] Change makefile for IRPF90 v2 --- src/Makefile | 74 +++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/src/Makefile b/src/Makefile index 91f9ae6..3eef85d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,55 +1,45 @@ -# EZFIO is an automatic generator of I/O libraries -# Copyright (C) 2009 Anthony SCEMAMA, CNRS -# -# This program 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 2 of the License, or -# (at your option) any later version. -# -# This program 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Anthony Scemama -# LCPQ - IRSAMC - CNRS -# Universite Paul Sabatier -# 118, route de Narbonne -# 31062 Toulouse Cedex 4 -# scemama@irsamc.ups-tlse.fr +IRPF90= python ~/Work/Project/p16.03/irpf90/src/irpf90.py +IRPF90FLAGS= -I ./ +BUILD_SYSTEM= make -DEFAULT_TARGET: all +export LD_LIBARY_PATH = +export CXX = g++ +export CXXFLAGS = -O2 +export CC = gcc +export FC = gfortran +export CFLAGS = -O2 +export FCFLAGS = -O2 +export AR = AR +export RANLIB = ranlib -include ../make.config -export +ifeq ($(BUILD_SYSTEM),ninja) + CMD_PHONY=-t # Chose a specific target + BUILD_FILE=IRPF90_temp/build.ninja + IRPF90FLAGS += -j # Create ninja +else + CMD_PHONY= -j # All job abalaible + BUILD_FILE=IRPF90_temp/build.make +endif -include irpf90.make - -irpf90.make: $(wildcard *.irp.f) ../config/* - $(IRPF90) - -include ../version +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +current_dir := $(dir $(mkfile_path)) .PHONY: static all +export PYTHONPATH:=$(current_dir):$(PYTHONPATH) + all: static ../Python/ezfio.py ../Ocaml/ezfio.ml static: ../lib/libezfio.a ../lib/libezfio_irp.a ../lib/libezfio.a: IRPF90_temp/irpf90.a rm -f ../lib/libezfio.a - $(AR) cru ../lib/libezfio.a $(OBJ1) + cp IRPF90_temp/irpf90.a ../lib/libezfio.a $(RANLIB) ../lib/libezfio.a + ../lib/libezfio_irp.a: ../lib/libezfio.a - rm -f ../lib/libezfio_irp.a cp ../lib/libezfio.a ../lib/libezfio_irp.a - $(AR) dv ../lib/libezfio_irp.a irp_stack.irp.o - $(RANLIB) ../lib/libezfio_irp.a ../Python/ezfio.py: python create_python.py @@ -57,4 +47,16 @@ static: ../lib/libezfio.a ../lib/libezfio_irp.a ../Ocaml/ezfio.ml: python create_ocaml.py +IRPF90_temp/irpf90.a: $(BUILD_FILE) + $(BUILD_SYSTEM) -C $(dir $^) -f $(notdir $^) $(CMD_PHONY) $(current_dir)$@ && touch $@ +$(BUILD_FILE): $(shell find . -path ./IRPF90_temp -prune -o -name '*.irp.f' -maxdepth 2 -print) + $(IRPF90) $(IRPF90FLAGS) + +clean: $(BUILD_FILE) + $(BUILD_SYSTEM) -f $^ $(CMD_PHONY) clean + rm -f $(BUILD_FILE) + rm -f ../lib/libezfio.a ../lib/libezfio_irp.a + +veryclean: clean + rm -rf IRPF90_temp/ IRPF90_man/ irpf90_entities dist tags $(EXE)