diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index f2b261ad..114a2b0e 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -666,20 +666,26 @@ def ninja_binaries_build(path_module, l_children, d_binaries): # s t r i n g # # ~#~#~#~#~#~ # - path_readme = os.path.join(path_module.abs, "README.rst") - path_png = os.path.join(path_module.abs, "tree_dependency.png") - l_string = ["build {0}: build_binaries {1} {2}".format(" ".join(l_abs_bin), EZFIO_LIB, ninja_module_path), " module_abs = {0}".format(path_module.abs), " module_rel = {0}".format(path_module.rel), ""] - l_string += ["build module_{0}: phony {1} {2} {3}".format(path_module.rel, - " ".join(l_abs_bin), - path_readme, - path_png - ), ""] + return l_string + + +def ninja_module_build(path_module, d_binaries): + + l_abs_bin = [binary.abs for binary in d_binaries[path_module]] + + path_readme = os.path.join(path_module.abs, "README.rst") + path_png = os.path.join(path_module.abs, "tree_dependency.png") + + l_string = ["build module_{0}: phony {1} {2} {3}".format(path_module.rel, + " ".join(l_abs_bin), + path_readme, + path_png), ""] return l_string @@ -732,17 +738,19 @@ def create_build_ninja_module(path_module): ""] l_string += ["rule make_local_binaries", - " command = ninja -f {0} module_{1}".format( - ROOT_BUILD_NINJA, path_module.rel), " pool = console", + " command = ninja -f {0} module_{1}".format(ROOT_BUILD_NINJA, path_module.rel), + " pool = console", " description = Compile only {0}".format(path_module.rel), ""] l_string += ["rule make_all_binaries", " command = ninja -f {0}".format(ROOT_BUILD_NINJA), - " pool = console", " description = Compiling all modules", + " pool = console", + " description = Compiling all modules", ""] - l_string += ["rule make_clean", " command = module_handler.py clean {0}".format(path_module.rel), + l_string += ["rule make_clean", + " command = module_handler.py clean {0}".format(path_module.rel), " description = Cleaning module {0}".format(path_module.rel), ""] @@ -766,7 +774,7 @@ def create_build_ninja_global(): " command = {0} update".format(__file__), ""] - l_string += ["rule make_all_binaries", + l_string += ["rule make_all", " command = ninja -f {0}".format(ROOT_BUILD_NINJA), " pool = console", " description = Compiling all modules", ""] @@ -777,7 +785,7 @@ def create_build_ninja_global(): l_string += ["build dummy_target: update_build_ninja_root", "", - "build all: make_all_binaries dummy_target", + "build all: make_all dummy_target", "default all", "", "build clean: make_clean dummy_target", @@ -938,11 +946,18 @@ if __name__ == "__main__": l_string += ninja_irpf90_make_build(module_to_compile, l_children, d_irp) - l_string += ninja_binaries_build(module_to_compile, l_children, - d_binaries) + if arguments["--development"]: + l_string += ninja_binaries_build(module_to_compile, l_children, + d_binaries) - l_string += ninja_gitignore_build(module_to_compile, d_binaries, - l_symlink) + elif arguments["--production"]: + l_string += ninja_binaries_build(module_to_compile, l_children, + d_binaries) + + l_string += ninja_module_build(module_to_compile, d_binaries) + + l_string += ninja_gitignore_build(module_to_compile, d_binaries, + l_symlink) # ~#~#~#~#~ # # S a v e s #