From 2a746234fec2f6d14e9bfa40fd7f3478cdd539ea Mon Sep 17 00:00:00 2001 From: Xiretza Date: Wed, 29 Jan 2020 18:07:13 +0100 Subject: [PATCH 1/2] Clean up 'install' Makefile target - libyosys.so is now only installed to LIBDIR instead of LIBDIR, BINDIR and PYTHON_DESTDIR - replace mkdir/cp for single files with `install` --- Makefile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 43c4d0890..f147a4f47 100644 --- a/Makefile +++ b/Makefile @@ -763,8 +763,7 @@ clean-unit-test: @$(MAKE) -C $(UNITESTPATH) clean install: $(TARGETS) $(EXTRA_TARGETS) - $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR) - $(INSTALL_SUDO) cp $(TARGETS) $(DESTDIR)$(BINDIR) + $(INSTALL_SUDO) install -D -t $(DESTDIR)$(BINDIR) $(filter-out libyosys.so,$(TARGETS)) ifneq ($(filter yosys,$(TARGETS)),) $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(BINDIR)/yosys endif @@ -777,13 +776,11 @@ endif $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(DATDIR) $(INSTALL_SUDO) cp -r share/. $(DESTDIR)$(DATDIR)/. ifeq ($(ENABLE_LIBYOSYS),1) - $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(LIBDIR) - $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)/ + $(INSTALL_SUDO) install -D -t $(DESTDIR)$(LIBDIR) libyosys.so $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so ifeq ($(ENABLE_PYOSYS),1) - $(INSTALL_SUDO) mkdir -p $(PYTHON_DESTDIR)/pyosys - $(INSTALL_SUDO) cp libyosys.so $(PYTHON_DESTDIR)/pyosys/ - $(INSTALL_SUDO) cp misc/__init__.py $(PYTHON_DESTDIR)/pyosys/ + $(INSTALL_SUDO) install -Dm644 -t $(PYTHON_DESTDIR)/pyosys/ misc/__init__.py + $(INSTALL_SUDO) ln -s $(LIBDIR)/libyosys.so $(PYTHON_DESTDIR)/pyosys/ endif endif From 90404e1969443a1b8a767ab8f3dc311709c5fe9d Mon Sep 17 00:00:00 2001 From: Xiretza Date: Wed, 29 Jan 2020 19:05:23 +0100 Subject: [PATCH 2/2] Improve ABC repository management in Makefile `rev-parse --short` output may have a different abbreviated hash length than ABCREV, so a simple string comparison always fails, even if the correct commit is checked out. Pass both commits through rev-parse and then compare the full hashes instead. Add an `echo-abc-rev` target so that packaging scripts can set ABCPULL=0 and handle all the git nastiness themselves. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f147a4f47..ed2b7a147 100644 --- a/Makefile +++ b/Makefile @@ -668,7 +668,8 @@ ifneq ($(ABCREV),default) $(Q) if ( cd abc 2> /dev/null && ! git diff-index --quiet HEAD; ); then \ echo 'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; false; \ fi - $(Q) if test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \ + # set a variable so the test fails if git fails to run - when comparing outputs directly, empty string would match empty string + $(Q) if ! { cd abc && rev="`git rev-parse $(ABCREV)`" && test "`git rev-parse HEAD`" == "$$rev"; }; then \ test $(ABCPULL) -ne 0 || { echo 'REEBE: NOP abg hc gb qngr naq NOPCHYY frg gb 0 va Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; exit 1; }; \ echo "Pulling ABC from $(ABCURL):"; set -x; \ test -d abc || git clone $(ABCURL) abc; \ @@ -925,6 +926,9 @@ echo-yosys-ver: echo-git-rev: @echo "$(GIT_REV)" +echo-abc-rev: + @echo "$(ABCREV)" + -include libs/*/*.d -include frontends/*/*.d -include passes/*/*.d