Commit 6ca9dc4e authored by Roy Fabrice's avatar Roy Fabrice
Browse files

new makefiles architecture

parent 9e9f6db8
#------------------------------------------------------------------------------------------------------------------------------------
# Copyright 2011 Fabrice Roy
#
# Contact: fabrice.roy@obspm.fr
#
# This file is part of pFoF.
#
# pFoF 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.
#
# pFoF 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 pFoF. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------------------------------------------------------------
# DO NOT EDIT THIS FILE UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING
include Make.inc
all: pfof_snap.exe pfof_cone.exe amr2cell_hdf5.exe conepartcreator.exe conegravcreator.exe conemapper.exe
BINDIR=$(PREFIX)/bin
export BINDIR
# Install command
INSTALL=install -c -m 755
export INSTALL
pfof_snap.exe:
cd pfof_snap/src ; make
all: pfof_snap
pfof_snap:
cd pfof_snap && make
pfof_cone.exe:
cd pfof_cone/src ; make
......@@ -21,10 +50,23 @@ conemapper.exe:
cd tools/conemapper/src ; make
clean:
cd pfof_snap/src ; make clean
cd pfof_snap && make clean
cd pfof_cone/src ; make clean
cd amr2cell_hdf5/src ; make clean
cd tools/conepartcreator/src ; make clean
cd tools/conegravcreator/src ; make clean
cd tools/conemapper/src ; make clean
rm -f mod/* obj/*
installdirs:
./mkinstalldirs $(BINDIR)
install: installdirs
cd pfof_snap && make install
uninstall:
cd pfof_snap && make uninstall
doc:
cd pfof_snap && make doc
.PHONY: all pfof_snap clean test installdirs install uninstall doc
\ No newline at end of file
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2004-02-15.20
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit 0
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit 0
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
\ No newline at end of file
all: pfof_snap
pfof_snap:
cd src && make
test:
cd test && make
doc:
cd doc && make
install:
cd src && make install
uninstall:
cd src && make uninstall
clean:
cd src && make clean
cd test && make clean
cd doc && make clean
.PHONY: all pfof_snap test doc install uninstall clean
\ No newline at end of file
DOC_TOOL = doxygen
CONF_FILE = pfof_snap.doxygen
doc : html latex
html : $(CONF_FILE)
$(DOC_TOOL) $(CONF_FILE)
latex : html
cd latex ; make
clean:
rm -rf html latex
.PHONY: doc html latex clean
\ No newline at end of file
......@@ -3,8 +3,6 @@ include ../../Make.inc
EXE = pfof_snap.exe
COMMONDIR = ../../common/src/
OBJDIR=../../obj/
MODDIR=../../mod/
VPATH= $(COMMONDIR):.
SRC = modconstant.f90 \
......@@ -35,8 +33,7 @@ SRC = modconstant.f90 \
parallel_fof_m.f90 \
pfof_snap.f90
OBJS_NOPREFIX=$(SRC:%.f90=%.o)
OBJS=$(addprefix $(OBJDIR), $(OBJS_NOPREFIX))
OBJS=$(SRC:%.f90=%.o)
# variable containing if git is used or not
ifeq ($(wildcard ../../.git/HEAD ../../.git/index),)
......@@ -47,8 +44,9 @@ else
OBJ_GIT = ../../.git/HEAD ../../.git/index
endif
.SUFFIXES:
$(OBJDIR)%.o:%.f90
%.o:%.f90
@echo "--------------------------------"
@echo building $*.o with parameters \
FC=$(FC), FCFLAGS=$(FCFLAGS)
......@@ -60,13 +58,11 @@ $(OBJDIR)%.o:%.f90
FC=$(FC), FCFLAGS=$(FCFLAGS)
$(FC) -c $(FCFLAGS) $<
all: $(EXE)
all: directories release
release: $(EXE)
debug: FCFLAGS = $(DEBUGFLAGS)
debug: $(EXE)
$(EXE) : gitversion $(OBJS)
@echo "--------------------------------"
@echo $(ROOT_PFOF)
......@@ -74,16 +70,16 @@ $(EXE) : gitversion $(OBJS)
FC=$(FC), LDFLAGS=$(LDFLAGS)
$(FC) -g -o $(EXE) $(OBJS) $(LDFLAGS)
cleanall :
clean:
@echo "--------------------------------"
@echo cleaning compiled objects, modules and executable
rm -f $(OBJDIR)*.o $(MODDIR)*.mod *~ $(EXE) $(COMMONDIR)/gitversion.h
rm -f *.o *.mod *~ $(EXE) $(COMMONDIR)/gitversion.h
clean:
@echo "--------------------------------"
@echo cleaning executable
rm -f $(EXE)
install:
$(INSTALL) $(EXE) $(BINDIR)
uninstall:
rm -f $(BINDIR)/$(EXE)
# create file for git version
gitversion: $(OBJ_GIT)
......@@ -95,13 +91,5 @@ else
echo "#define GITVERSION \"no_version_found\"" > gitversion.h
endif
directories: ${MODDIR} ${OBJDIR}
${OBJDIR}:
${MKDIR_P} $@
${MODDIR}:
${MKDIR_P} $@
.PHONY: gitversion clean cleanall directories all
.PHONY: all install uninstall gitversion clean
#------------------------------------------------------------------------------------------------------------------------------------
# Copyright 2014 Fabrice Roy
#
# Contact: fabrice.roy@obspm.fr
#
# This file is part of fortran-hdf5-interface.
#
# fortran-hdf5-interface 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.
#
# fortran-hdf5-interface 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 fortran-hdf5-interface. If not, see <http://www.gnu.org/licenses/>.
#
# Makefile for tests included in the library
# Author Fabrice Roy
# ======================================================================
include ../../Make.inc
clean:
rm -f $(EXE) *.h5
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment