Use the Makefile writer as another pool_module action

parent ec6a12a1
...@@ -115,9 +115,8 @@ def _action_runner(modules_pool): ...@@ -115,9 +115,8 @@ def _action_runner(modules_pool):
if options.command == "manifest-help": if options.command == "manifest-help":
ManifestParser().print_help() ManifestParser().print_help()
quit() quit()
elif options.command == "auto": elif options.command == "makefile":
from hdlmake.tools import write_makefile modules_pool.makefile()
write_makefile(modules_pool)
elif options.command == "fetch": elif options.command == "fetch":
modules_pool.fetch() modules_pool.fetch()
elif options.command == "clean": elif options.command == "clean":
...@@ -228,17 +227,17 @@ def _get_parser(): ...@@ -228,17 +227,17 @@ def _get_parser():
"--condition", "--condition",
dest="condition", dest="condition",
required=True) required=True)
auto = subparsers.add_parser( makefile = subparsers.add_parser(
"auto", "makefile",
help="default action for hdlmake. Run when no args are given") help="Write the Makefile -- default action for hdlmake.")
auto.add_argument( makefile.add_argument(
'-v', '-v',
'--version', '--version',
action='version', action='version',
version=parser.prog + version=parser.prog +
" " + " " +
__version__) __version__)
auto.add_argument( makefile.add_argument(
"--noprune", "--noprune",
help="prevent hdlmake from pruning unneeded files", help="prevent hdlmake from pruning unneeded files",
default=False, default=False,
...@@ -276,16 +275,16 @@ def _get_options(sys_aux, parser): ...@@ -276,16 +275,16 @@ def _get_options(sys_aux, parser):
"""Function that decodes and set the provided command user options""" """Function that decodes and set the provided command user options"""
options = None options = None
if len(sys_aux.argv[1:]) == 0: if len(sys_aux.argv[1:]) == 0:
options = parser.parse_args(['auto']) options = parser.parse_args(['makefile'])
elif len(sys_aux.argv[1:]) == 1: elif len(sys_aux.argv[1:]) == 1:
if sys_aux.argv[1] == "--help" or sys_aux.argv[1] == "-h": if sys_aux.argv[1] == "--help" or sys_aux.argv[1] == "-h":
options = parser.parse_args(sys_aux.argv[1:]) options = parser.parse_args(sys_aux.argv[1:])
elif sys_aux.argv[1].startswith('-'): elif sys_aux.argv[1].startswith('-'):
options = parser.parse_args(["auto"] + sys_aux.argv[1:]) options = parser.parse_args(["makefile"] + sys_aux.argv[1:])
else: else:
options = parser.parse_args(sys_aux.argv[1:]) options = parser.parse_args(sys_aux.argv[1:])
elif len(sys_aux.argv[1:]) % 2 == 0: elif len(sys_aux.argv[1:]) % 2 == 0:
options = parser.parse_args(sys_aux.argv[1:] + ["auto"]) options = parser.parse_args(sys_aux.argv[1:] + ["makefile"])
else: else:
options = parser.parse_args(sys_aux.argv[1:]) options = parser.parse_args(sys_aux.argv[1:])
return options return options
......
...@@ -29,6 +29,7 @@ import sys ...@@ -29,6 +29,7 @@ import sys
import os.path import os.path
import time import time
from hdlmake.tools import write_makefile
import hdlmake.fetch as fetch import hdlmake.fetch as fetch
import hdlmake.new_dep_solver as dep_solver import hdlmake.new_dep_solver as dep_solver
from hdlmake.util import path as path_mod from hdlmake.util import path as path_mod
...@@ -49,6 +50,12 @@ class ActionCore(Action): ...@@ -49,6 +50,12 @@ class ActionCore(Action):
self.svn_backend = Svn() self.svn_backend = Svn()
self.local_backend = Local() self.local_backend = Local()
def makefile(self):
"""Write the Makefile for the current design"""
write_makefile(self)
def _fetch_all(self): def _fetch_all(self):
"""Fetch all the modules declared in the design""" """Fetch all the modules declared in the design"""
......
"""Package that provides all the tool specific stuff""" """Package that provides all the tool specific stuff"""
from .iverilog import ToolIVerilog from .makefile_writer import write_makefile
from .isim import ToolISim
from .modelsim import ToolModelsim
from .active_hdl import ToolActiveHDL
from .riviera import ToolRiviera
from .ghdl import ToolGHDL
from .ise import ToolISE
from .planahead import ToolPlanAhead
from .vivado import ToolVivado
from .quartus import ToolQuartus
from .diamond import ToolDiamond
from .libero import ToolLibero
from .icestorm import ToolIcestorm
Markdown is supported
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