diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2020-04-10 10:05:17 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2020-04-10 10:05:17 +0200 |
commit | fe3086a7339f0c2731fb1a14f6ef0e4d93a0377e (patch) | |
tree | 47dbe6b20205c9faecee0217a863486e68ef253e /icebox | |
parent | d1cee1d4ae545fdca995cd656ef52d8923aa77e9 (diff) | |
download | icestorm-fe3086a7339f0c2731fb1a14f6ef0e4d93a0377e.tar.gz icestorm-fe3086a7339f0c2731fb1a14f6ef0e4d93a0377e.tar.bz2 icestorm-fe3086a7339f0c2731fb1a14f6ef0e4d93a0377e.zip |
Support custom PROGRAM_PREFIX
Diffstat (limited to 'icebox')
-rw-r--r-- | icebox/Makefile | 95 | ||||
-rwxr-xr-x | icebox/icebox_asc2hlc.py | 8 | ||||
-rwxr-xr-x | icebox/icebox_chipdb.py | 6 | ||||
-rwxr-xr-x | icebox/icebox_colbuf.py | 6 | ||||
-rwxr-xr-x | icebox/icebox_diff.py | 6 | ||||
-rwxr-xr-x | icebox/icebox_explain.py | 6 | ||||
-rwxr-xr-x | icebox/icebox_hlc2asc.py | 8 | ||||
-rwxr-xr-x | icebox/icebox_html.py | 2 | ||||
-rwxr-xr-x | icebox/icebox_maps.py | 19 | ||||
-rwxr-xr-x | icebox/icebox_stat.py | 6 | ||||
-rwxr-xr-x | icebox/icebox_vlog.py | 6 |
11 files changed, 95 insertions, 73 deletions
diff --git a/icebox/Makefile b/icebox/Makefile index 6906681..c35015f 100644 --- a/icebox/Makefile +++ b/icebox/Makefile @@ -36,45 +36,66 @@ clean: rm -f icebox.pyc iceboxdb.pyc install: all - mkdir -p $(DESTDIR)$(PREFIX)/share/icebox + mkdir -p $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox mkdir -p $(DESTDIR)$(PREFIX)/bin - cp chipdb-384.txt $(DESTDIR)$(PREFIX)/share/icebox/ - cp chipdb-1k.txt $(DESTDIR)$(PREFIX)/share/icebox/ - cp chipdb-8k.txt $(DESTDIR)$(PREFIX)/share/icebox/ - cp chipdb-5k.txt $(DESTDIR)$(PREFIX)/share/icebox/ - cp chipdb-u4k.txt $(DESTDIR)$(PREFIX)/share/icebox/ - cp chipdb-lm4k.txt $(DESTDIR)$(PREFIX)/share/icebox/ - cp icebox.py $(DESTDIR)$(PREFIX)/bin/icebox.py - cp iceboxdb.py $(DESTDIR)$(PREFIX)/bin/iceboxdb.py - cp icebox_chipdb.py $(DESTDIR)$(PREFIX)/bin/icebox_chipdb$(PY_EXE) - cp icebox_diff.py $(DESTDIR)$(PREFIX)/bin/icebox_diff$(PY_EXE) - cp icebox_explain.py $(DESTDIR)$(PREFIX)/bin/icebox_explain$(PY_EXE) - cp icebox_asc2hlc.py $(DESTDIR)$(PREFIX)/bin/icebox_asc2hlc$(PY_EXE) - cp icebox_hlc2asc.py $(DESTDIR)$(PREFIX)/bin/icebox_hlc2asc$(PY_EXE) - cp icebox_colbuf.py $(DESTDIR)$(PREFIX)/bin/icebox_colbuf$(PY_EXE) - cp icebox_html.py $(DESTDIR)$(PREFIX)/bin/icebox_html$(PY_EXE) - cp icebox_maps.py $(DESTDIR)$(PREFIX)/bin/icebox_maps$(PY_EXE) - cp icebox_vlog.py $(DESTDIR)$(PREFIX)/bin/icebox_vlog$(PY_EXE) - cp icebox_stat.py $(DESTDIR)$(PREFIX)/bin/icebox_stat$(PY_EXE) + cp chipdb-384.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ + cp chipdb-1k.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ + cp chipdb-8k.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ + cp chipdb-5k.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ + cp chipdb-u4k.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ + cp chipdb-lm4k.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ + cp icebox.py $(DESTDIR)$(PREFIX)/bin/$(subst -,_,$(PROGRAM_PREFIX))icebox.py + cp iceboxdb.py $(DESTDIR)$(PREFIX)/bin/$(subst -,_,$(PROGRAM_PREFIX))iceboxdb.py + cp icebox_chipdb.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_chipdb$(PY_EXE) + cp icebox_diff.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_diff$(PY_EXE) + cp icebox_explain.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_explain$(PY_EXE) + cp icebox_asc2hlc.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_asc2hlc$(PY_EXE) + cp icebox_hlc2asc.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_hlc2asc$(PY_EXE) + cp icebox_colbuf.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_colbuf$(PY_EXE) + cp icebox_html.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_html$(PY_EXE) + cp icebox_maps.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_maps$(PY_EXE) + cp icebox_vlog.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_vlog$(PY_EXE) + cp icebox_stat.py $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_stat$(PY_EXE) + sed -i 's+import iceboxdb+import $(subst -,_,$(PROGRAM_PREFIX))iceboxdb as iceboxdb+g' $(DESTDIR)$(PREFIX)/bin/$(subst -,_,$(PROGRAM_PREFIX))icebox.py + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_chipdb$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_diff$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_diff$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_explain$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_explain$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_asc2hlc$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_asc2hlc$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_hlc2asc$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_hlc2asc$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_colbuf$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_colbuf$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_html$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_html$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_maps$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_maps$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_vlog$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_vlog$(PY_EXE) + sed -i 's+/usr/local/share/icebox+$(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_vlog$(PY_EXE) + sed -i 's+import icebox+import $(subst -,_,$(PROGRAM_PREFIX))icebox as icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_stat$(PY_EXE) + sed -i 's+from icebox+from $(subst -,_,$(PROGRAM_PREFIX))icebox+g' $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_stat$(PY_EXE) uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/icebox.py - rm -f $(DESTDIR)$(PREFIX)/bin/iceboxdb.py - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_chipdb$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_diff$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_explain$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_asc2hlc$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_hlc2asc$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_colbuf$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_html$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_maps$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_vlog$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/bin/icebox_stat$(PY_EXE) - rm -f $(DESTDIR)$(PREFIX)/share/icebox/chipdb-384.txt - rm -f $(DESTDIR)$(PREFIX)/share/icebox/chipdb-1k.txt - rm -f $(DESTDIR)$(PREFIX)/share/icebox/chipdb-8k.txt - rm -f $(DESTDIR)$(PREFIX)/share/icebox/chipdb-lm4k.txt - rm -f $(DESTDIR)$(PREFIX)/share/icebox/chipdb-u4k.txt - -rmdir $(DESTDIR)$(PREFIX)/share/icebox + rm -f $(DESTDIR)$(PREFIX)/bin/$(subst -,_,$(PROGRAM_PREFIX))cebox.py + rm -f $(DESTDIR)$(PREFIX)/bin/$(subst -,_,$(PROGRAM_PREFIX))iceboxdb.py + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_chipdb$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_diff$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_explain$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_asc2hlc$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_hlc2asc$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_colbuf$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_html$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_maps$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_vlog$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icebox_stat$(PY_EXE) + rm -f $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/chipdb-384.txt + rm -f $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/chipdb-1k.txt + rm -f $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/chipdb-8k.txt + rm -f $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/chipdb-lm4k.txt + rm -f $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/chipdb-u4k.txt + -rmdir $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox .PHONY: all check clean install uninstall diff --git a/icebox/icebox_asc2hlc.py b/icebox/icebox_asc2hlc.py index 003106f..8e64997 100755 --- a/icebox/icebox_asc2hlc.py +++ b/icebox/icebox_asc2hlc.py @@ -1068,7 +1068,7 @@ def main(): except getopt.GetoptError as e: sys.stderr.write("%s: %s\n" % (program_short_name, e.msg)) sys.stderr.write("Try `%s --help' for more information.\n" - % sys.argv[0]) + % program_short_name) sys.exit(1) for opt, arg in opts: @@ -1085,7 +1085,7 @@ Usage: %s [OPTION]... FILE If you have a bug report, please file an issue on github: https://github.com/rlutz/icestorm/issues -""" % sys.argv[0]) +""" % program_short_name) sys.exit(0) if opt == '--version': @@ -1113,13 +1113,13 @@ GNU General Public License for more details. if not args: sys.stderr.write("%s: missing argument\n" % (program_short_name)) sys.stderr.write("Try `%s --help' for more information.\n" - % sys.argv[0]) + % program_short_name) sys.exit(1) if len(args) != 1: sys.stderr.write("%s: too many arguments\n" % (program_short_name)) sys.stderr.write("Try `%s --help' for more information.\n" - % sys.argv[0]) + % program_short_name) sys.exit(1) ic = icebox.iceconfig() diff --git a/icebox/icebox_chipdb.py b/icebox/icebox_chipdb.py index 9c8d6df..722ec37 100755 --- a/icebox/icebox_chipdb.py +++ b/icebox/icebox_chipdb.py @@ -16,7 +16,7 @@ # import icebox -import getopt, sys, re +import getopt, sys, re, os mode_384 = False mode_lm4k = False @@ -26,7 +26,7 @@ mode_8k = False def usage(): print(""" -Usage: icebox_chipdb [options] [bitmap.asc] +Usage: %s [options] [bitmap.asc] -3 create chipdb for 384 device @@ -42,7 +42,7 @@ Usage: icebox_chipdb [options] [bitmap.asc] -u create chipdb for u4k device -""") +""" % os.path.basename(sys.argv[0])) sys.exit(0) try: diff --git a/icebox/icebox_colbuf.py b/icebox/icebox_colbuf.py index ec6843e..3003a90 100755 --- a/icebox/icebox_colbuf.py +++ b/icebox/icebox_colbuf.py @@ -17,21 +17,21 @@ import icebox from icebox import re_match_cached -import getopt, sys, re +import getopt, sys, re, os check_mode = False fixup_mode = False def usage(): print(""" -Usage: icebox_colbuf [options] [input.asc [output.asc]] +Usage: %s [options] [input.asc [output.asc]] -c check colbuf bits -f fix colbuf bits -""") +""" % os.path.basename(sys.argv[0])) sys.exit(1) try: diff --git a/icebox/icebox_diff.py b/icebox/icebox_diff.py index 5252fc4..f433bcf 100755 --- a/icebox/icebox_diff.py +++ b/icebox/icebox_diff.py @@ -17,13 +17,13 @@ import icebox from icebox import re_match_cached -import sys +import sys, os import re if len(sys.argv) != 3: print(""" -Usage: icebox_diff bitmap1.asc bitmap2.asc -""") +Usage: %s bitmap1.asc bitmap2.asc +""" % os.path.basename(sys.argv[0])) sys.exit(0) print("Reading file '%s'.." % sys.argv[1]) diff --git a/icebox/icebox_explain.py b/icebox/icebox_explain.py index f843c09..25061ab 100755 --- a/icebox/icebox_explain.py +++ b/icebox/icebox_explain.py @@ -17,7 +17,7 @@ import icebox from icebox import re_match_cached, re_search_cached -import getopt, sys, re +import getopt, sys, re, os print_bits = False print_map = False @@ -26,7 +26,7 @@ print_all = False def usage(): print(""" -Usage: icebox_explain [options] [bitmap.asc] +Usage: %s [options] [bitmap.asc] -b print config bit names for each config statement @@ -39,7 +39,7 @@ Usage: icebox_explain [options] [bitmap.asc] -t '<x-coordinate> <y-coordinate>' print only the specified tile -""") +""" % os.path.basename(sys.argv[0])) sys.exit(0) try: diff --git a/icebox/icebox_hlc2asc.py b/icebox/icebox_hlc2asc.py index a95f610..59d2f69 100755 --- a/icebox/icebox_hlc2asc.py +++ b/icebox/icebox_hlc2asc.py @@ -1147,7 +1147,7 @@ def main(): except getopt.GetoptError as e: sys.stderr.write("%s: %s\n" % (program_short_name, e.msg)) sys.stderr.write("Try `%s --help' for more information.\n" - % sys.argv[0]) + % program_short_name) sys.exit(1) for opt, arg in opts: @@ -1161,7 +1161,7 @@ Usage: %s [OPTION]... FILE If you have a bug report, please file an issue on github: https://github.com/rlutz/icestorm/issues -""" % sys.argv[0]) +""" % program_short_name) sys.exit(0) if opt == '--version': @@ -1184,13 +1184,13 @@ GNU General Public License for more details. if not args: sys.stderr.write("%s: missing argument\n" % (program_short_name)) sys.stderr.write("Try `%s --help' for more information.\n" - % sys.argv[0]) + % program_short_name) sys.exit(1) if len(args) != 1: sys.stderr.write("%s: too many arguments\n" % (program_short_name)) sys.stderr.write("Try `%s --help' for more information.\n" - % sys.argv[0]) + % program_short_name) sys.exit(1) if args[0] == '-': diff --git a/icebox/icebox_html.py b/icebox/icebox_html.py index b710f61..3785a45 100755 --- a/icebox/icebox_html.py +++ b/icebox/icebox_html.py @@ -27,7 +27,7 @@ mode384 = False tx, ty = 0, 0 def usage(): - print("Usage: %s [options]" % sys.argv[0]) + print("Usage: %s [options]" % os.path.basename(sys.argv[0])) print(" -x tile_x_coordinate") print(" -y tile_y_coordinate") print(" -d outdir") diff --git a/icebox/icebox_maps.py b/icebox/icebox_maps.py index 35ff316..062335d 100755 --- a/icebox/icebox_maps.py +++ b/icebox/icebox_maps.py @@ -17,20 +17,21 @@ import icebox from icebox import re_match_cached -import getopt, sys, re +import getopt, sys, re, os mode = None def usage(): + program_short_name = os.path.basename(sys.argv[0]) print("Usage:") - print(" icebox_maps -m bitmaps") - print(" icebox_maps -m io_tile_nets_l") - print(" icebox_maps -m io_tile_nets_r") - print(" icebox_maps -m io_tile_nets_t") - print(" icebox_maps -m io_tile_nets_b") - print(" icebox_maps -m logic_tile_nets") - print(" icebox_maps -m ramb_tile_nets") - print(" icebox_maps -m ramt_tile_nets") + print(" %s -m bitmaps" % program_short_name) + print(" %s -m io_tile_nets_l" % program_short_name) + print(" %s -m io_tile_nets_r" % program_short_name) + print(" %s -m io_tile_nets_t" % program_short_name) + print(" %s -m io_tile_nets_b" % program_short_name) + print(" %s -m logic_tile_nets" % program_short_name) + print(" %s -m ramb_tile_nets" % program_short_name) + print(" %s -m ramt_tile_nets" % program_short_name) sys.exit(0) try: diff --git a/icebox/icebox_stat.py b/icebox/icebox_stat.py index ec404fb..5752267 100755 --- a/icebox/icebox_stat.py +++ b/icebox/icebox_stat.py @@ -17,18 +17,18 @@ import icebox from icebox import re_match_cached -import getopt, sys, re +import getopt, sys, re, os verbose = False def usage(): print(""" -Usage: icebox_stat [options] [bitmap.asc] +Usage: %s [options] [bitmap.asc] -v verbose output -""") +""" % os.path.basename(sys.argv[0])) sys.exit(0) try: diff --git a/icebox/icebox_vlog.py b/icebox/icebox_vlog.py index a2c7950..0133347 100755 --- a/icebox/icebox_vlog.py +++ b/icebox/icebox_vlog.py @@ -17,7 +17,7 @@ import icebox from icebox import re_match_cached, re_sub_cached, re_search_cached -import getopt, sys, re +import getopt, sys, re, os strip_comments = False strip_interconn = False @@ -34,7 +34,7 @@ modname = "chip" def usage(): print(""" -Usage: icebox_vlog [options] [bitmap.asc] +Usage: %s [options] [bitmap.asc] -s strip comments from output @@ -70,7 +70,7 @@ Usage: icebox_vlog [options] [bitmap.asc] -D enable exactly-one-driver checks -""") +""" % os.path.basename(sys.argv[0])) sys.exit(0) try: |