Skip to content
Snippets Groups Projects
Commit 75fc16f7 authored by Paweł Szostek's avatar Paweł Szostek
Browse files

makefile_writer.py: correct fetch and add sync remote

parent de46931c
Branches
Tags
No related merge requests found
......@@ -23,13 +23,17 @@
import os
import string
import logging
import global_mod
from string import Template
class MakefileWriter(object):
def __init__(self, filename):
def __init__(self, filename=None):
self._file = None
self._filename = filename
if filename:
self._filename = filename
else:
self._filename = "Makefile"
self._is_initialized = False
def __del__(self):
......@@ -38,7 +42,10 @@ class MakefileWriter(object):
def initialize(self):
if not self._is_initialized:
self._file = open(self._filename, "w")
if global_mod.options.append is True:
self._file = open(self._filename, "a+")
else:
self._file = open(self._filename, "w")
self.writeln("########################################")
self.writeln("# This file was generated by hdlmake #")
self.writeln("# http://ohwr.org/projects/hdl-make/ #")
......@@ -103,7 +110,7 @@ endif
self.writeln(files_tmpl.format(' \\\n'.join([s.rel_path() for s in files])))
self.writeln("")
self.writeln("#target for running simulation in the remote location")
self.writeln("remote: __test_for_remote_synthesis_variables __send __do_synthesis __send_back")
self.writeln("remote: __test_for_remote_synthesis_variables __send __do_synthesis")
self.writeln("__send_back: __do_synthesis")
self.writeln("__do_synthesis: __send")
self.writeln("__send: __test_for_remote_synthesis_variables")
......@@ -118,15 +125,15 @@ endif
tcl = "run.tcl"
synthesis_cmd = """__do_synthesis:
ifeq (x$(HDLMAKE_RSYNTH_USE_SCREEN), x1)
\t\tssh $(USER)@$(SERVER) 'screen bash -c "cd $(R_NAME)$(CWD) && $(HDLMAKE_RSYNTH_ISE_PATH)/xtclsh {1}"'
\t\tssh $(USER)@$(SERVER) 'screen bash -c "cd $(R_NAME)$(CWD) && $(HDLMAKE_RSYNTH_ISE_PATH)/xtclsh {0}"'
else
\t\tssh $(USER)@$(SERVER) 'cd $(R_NAME)$(CWD) && $(HDLMAKE_RSYNTH_ISE_PATH)/xtclsh {1}'
\t\tssh $(USER)@$(SERVER) 'cd $(R_NAME)$(CWD) && $(HDLMAKE_RSYNTH_ISE_PATH)/xtclsh {0}'
endif
"""
self.writeln(synthesis_cmd.format(tcl))
self.writeln()
send_back_cmd = "__send_back: \n\t\tcd .. && rsync -av $(USER)@$(SERVER):$(R_NAME)$(CWD) . && cd $(CWD)"
send_back_cmd = "sync: \n\t\tcd .. && rsync -av $(USER)@$(SERVER):$(R_NAME)/$(CWD) . && cd $(CWD)"
self.write(send_back_cmd)
self.write("\n\n")
......@@ -243,29 +250,30 @@ mrproper:
basename = module.basename
if module.source == "svn":
self.write("__"+basename+"_fetch:\n")
self.write("\t\t")
self.write("PWD=$(shell pwd) ")
self.write("cd " + rp(module.fetchto) + ' ')
c = "svn checkout {0}{1} {2}"
self.write("\t\tmkdir -p %s\n" % rp(module.fetchto))
self.write("\t\tPWD=$(shell pwd) ")
self.write("cd " + rp(module.fetchto) + ' && ')
c = "svn checkout {0}{1}"
if module.revision:
c = c.format(module.url, "@"+module.revision, module.basename)
c = c.format(module.url, "@"+module.revision)
else:
c = c.format(module.url, "", module.basename)
c = c.format(module.url, "")
self.write(c)
self.write("cd $(PWD) \n\n")
self.write("; cd $(PWD) \n\n")
elif module.source == "git":
self.write("__"+basename+"_fetch:\n")
self.write("\t\tmkdir -p %s\n" % rp(module.fetchto))
self.write("\t\t")
self.write("PWD=$(shell pwd) ")
self.write("cd " + rp(module.fetchto) + ' ')
self.write("if [ -d " + basename + " ] then cd " + basename + ' ')
self.write("cd " + rp(module.fetchto) + '; ')
self.write("if [ -d " + basename + " ]; then cd " + basename + ' && ')
self.write("git pull ")
if module.revision:
self.write("git checkout " + module.revision + '')
self.write("else git clone " + module.url + ' fi ')
self.write(" && git checkout " + module.revision + '')
self.write("else git clone " + module.url + '; fi ;')
if module.revision:
self.write("git checkout " + module.revision + '')
self.write("\t\tgit checkout " + module.revision)
self.write("cd $(PWD) \n\n")
def generate_iverilog_makefile(self, fileset, top_module, modules_pool):
......
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