10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2025-01-05 10:58:51 +01:00

Merge pull request #9 from scemama/master

build.ninja in main directory
This commit is contained in:
Anthony Scemama 2015-06-05 18:39:16 +02:00
commit 0c2085cf88
2 changed files with 20 additions and 19 deletions

View File

@ -27,7 +27,16 @@
# Define auto-completion for bash # Define auto-completion for bash
case "$0" in case "$0" in
*bash*) *irpman)
if [[ -z $1 ]] ; then
echo "To activate auto-completion in bash:"
echo "source " $0
else
exec python $(dirname $0)/../src/irpman.py $1
fi
;;
*)
_irpman_complete() _irpman_complete()
{ {
local cur local cur
@ -37,12 +46,4 @@ case "$0" in
} && complete -F _irpman_complete irpman } && complete -F _irpman_complete irpman
;; ;;
*)
if [[ -z $1 ]] ; then
echo "To activate auto-completion in bash:"
echo "source " $0
else
python $(dirname $0)/../src/irpman.py $1
fi
;;
esac esac

View File

@ -33,7 +33,7 @@ irpdir = irpf90_t.irpdir
mandir = irpf90_t.mandir mandir = irpf90_t.mandir
irp_id = irpf90_t.irp_id irp_id = irpf90_t.irp_id
FILENAME = os.path.join(irpdir,"build.ninja") FILENAME = "build.ninja"
cwd = os.getcwd() cwd = os.getcwd()
@ -130,6 +130,8 @@ def create_build_target(t,list_of_other_o):
" short_in = {short_target_module_F90}", " short_in = {short_target_module_F90}",
" short_out = {short_target_module_o}", " short_out = {short_target_module_o}",
"", "",
"build {short_target}: phony {target}",
"",
] ) ] )
result = result.format( result = result.format(
@ -237,9 +239,7 @@ def create_build_remaining(f):
def create_irpf90_make(targets): def create_irpf90_make(targets):
targets = ' '.join(targets) targets = ' '.join(targets)
result = """NINJA += -C {0} result = """TARGETS={1}
TARGETS={1}
.PHONY: all clean veryclean .PHONY: all clean veryclean
@ -247,7 +247,7 @@ all:
$(NINJA) $(NINJA)
$(TARGETS): $(TARGETS):
$(NINJA) $(PWD)/$@ $(NINJA) $@
clean: clean:
$(NINJA) -t clean $(NINJA) -t clean
@ -264,7 +264,7 @@ veryclean: clean
def run(): def run():
output = [] output = [ "builddir = %s"%os.path.join(cwd,irpdir) ]
# Environment variables # Environment variables
@ -280,7 +280,7 @@ def run():
try: CXX = os.environ["CXX"] try: CXX = os.environ["CXX"]
except KeyError: CXX="g++" except KeyError: CXX="g++"
includes = [ "-I %s"%(i) for i in command_line.include_dir ] includes = [ "-I %s "%(os.path.join(irpdir,i)) for i in command_line.include_dir ]
FC += " "+' '.join(includes) FC += " "+' '.join(includes)
CC += " "+' '.join(includes) CC += " "+' '.join(includes)
@ -312,11 +312,11 @@ def run():
# Rules # Rules
t = [ "rule compile_fortran_{id}", t = [ "rule compile_fortran_{id}",
" command = {FC} {FCFLAGS} -c $in -o $out", " command = cd $builddir ; {FC} {FCFLAGS} -c $in -o $out",
" description = F : $short_in -> $short_out", " description = F : $short_in -> $short_out",
"", "",
"rule compile_touches_{id}", "rule compile_touches_{id}",
" command = {FC} -c $in -o $out", " command = cd $builddir ; {FC} -c $in -o $out",
" description = F : $short_in -> $short_out", " description = F : $short_in -> $short_out",
"", "",
"", "",
@ -336,7 +336,7 @@ def run():
" command = {FC} $in {LIB} -o $out" , " command = {FC} $in {LIB} -o $out" ,
" description = Link: $short_out"] " description = Link: $short_out"]
output = [ '\n'.join(t).format(id=irp_id, FC=FC, FCFLAGS=FCFLAGS, LIB=LIB, CXX=CXX, CXXFLAGS=CXXFLAGS, CC=CC, CFLAGS=CFLAGS, AR=AR) ] output += [ '\n'.join(t).format(id=irp_id, FC=FC, FCFLAGS=FCFLAGS, LIB=LIB, CXX=CXX, CXXFLAGS=CXXFLAGS, CC=CC, CFLAGS=CFLAGS, AR=AR) ]
# All modules : list of Fmodule objects # All modules : list of Fmodule objects