Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
0c3c21f3
Commit
0c3c21f3
authored
Jun 11, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makefile.py: simplify code.
parent
d08cfef6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
makefile.py
hdlmake/tools/makefile.py
+10
-16
No files found.
hdlmake/tools/makefile.py
View file @
0c3c21f3
...
...
@@ -150,23 +150,16 @@ class ToolMakefile(object):
self
.
writeln
(
tmp
)
def
initialize
(
self
):
"""Open the Makefile file and print a header if not initialized"""
if
not
self
.
_initialized
:
if
os
.
path
.
exists
(
self
.
_filename
):
if
os
.
path
.
isfile
(
self
.
_filename
):
os
.
remove
(
self
.
_filename
)
elif
os
.
path
.
isdir
(
self
.
_filename
):
os
.
rmdir
(
self
.
_filename
)
"""Open the Makefile file and print a header"""
if
os
.
path
.
exists
(
self
.
_filename
):
os
.
remove
(
self
.
_filename
)
self
.
_file
=
open
(
self
.
_filename
,
"a+"
)
self
.
_initialized
=
True
self
.
writeln
(
"########################################"
)
self
.
writeln
(
"# This file was generated by hdlmake #"
)
self
.
writeln
(
"# http://ohwr.org/projects/hdl-make/ #"
)
self
.
writeln
(
"########################################"
)
self
.
writeln
()
elif
not
self
.
_file
:
self
.
_file
=
open
(
self
.
_filename
,
"a+"
)
self
.
_file
=
open
(
self
.
_filename
,
"w"
)
self
.
writeln
(
"########################################"
)
self
.
writeln
(
"# This file was generated by hdlmake #"
)
self
.
writeln
(
"# http://ohwr.org/projects/hdl-make/ #"
)
self
.
writeln
(
"########################################"
)
self
.
writeln
()
def
makefile_close
(
self
):
self
.
_file
.
close
()
...
...
@@ -175,6 +168,7 @@ class ToolMakefile(object):
def
write
(
self
,
line
=
None
):
"""Write a string in the manifest, no new line"""
if
not
self
.
_initialized
:
self
.
_initialized
=
True
self
.
initialize
()
if
shell
.
check_windows
():
self
.
_file
.
write
(
line
.
replace
(
'
\\
"'
,
'"'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment