libzip makefile error: make: *** No rule to make target `/Makefile.common'. Stop - makefile

I cloned libzip from github and now want to do the make but it gives an error ***No rule to make target '/Makefile.common' Stop. The cloned folder (libzip) has 3 files (libzip.spec, sources, Makefile).This is the Makefile, what could be the problem.
# This makefile is downloading any file found in
# the 'sources' file already existing in this directory
# and validating the sha256sum of the archive against it.
NAME := libzip
define find-common-dir
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then echo "$$d"; break ; fi ; done
endef
COMMON_DIR := $(shell $(find-common-dir))
include $(COMMON_DIR)/Makefile.common
SOURCEFILES := $(shell cat sources 2>/dev/null | awk '{ print $$2 }' | awk -F'*' '{ print $$2 }')
sources: $(SOURCEFILES)
$(SOURCEFILES):
#for sourcefile in $(SOURCEFILES); do \
$(CLIENT) $(LOOKASIDE_URI)/$(NAME)/$${sourcefile}; \
done
sha256sum -c sources || ( echo 'SHA256 check failed' && rm $(SOURCEFILES); exit 1 )
clean:
rm $(SOURCEFILES)

Please use the official mercurial repository:
http://hg.nih.at/libzip/
and let us know if you still have problems.

Related

Single thread run 6 times slower than 2 thread run

I'm trying to optimize, and also improve features of, the Makefile of the Linux man-pages.
Before, it only had make uninstall and make install, both of which ran a small shell script that run in a single thread, which took between 5 and 10 seconds on my laptop (i7-8850H 6C/12T).
I added the possibility of installing only some section (e.g., man3/ only) with make install-man3.
That also made it possible to install everything in parallel, thus allowing make -j install.
Using multiple threads improves times drastically, but now using a single thread to install also drastically increases the time to install. For comparison, these are the times on my laptop (make does the same as make uninstall && make install):
Old Makefile:
~/src/linux/man-pages$ time sudo make >/dev/null
real 0m7.509s
user 0m5.269s
sys 0m2.614s
The times with the old makefile, varied a lot, between 5 and 10 seconds.
New Makefile:
~/src/linux/man-pages$ time sudo make >/dev/null
real 0m27.883s
user 0m18.257s
sys 0m10.735s
~/src/linux/man-pages$ time sudo make -j2 >/dev/null
real 0m4.636s
user 0m8.514s
sys 0m1.475s
~/src/linux/man-pages$ time sudo make -j4 >/dev/null
real 0m2.582s
user 0m8.400s
sys 0m1.369s
~/src/linux/man-pages$ time sudo make -j >/dev/null
real 0m2.071s
user 0m9.203s
sys 0m1.704s
These new times are very consistent.
If I run make -n I get very small times, so I think it's not make overhead, but actual work being done:
~/src/linux/man-pages$ time sudo make -n >/dev/null
real 0m1.086s
user 0m1.116s
sys 0m0.117s
~/src/linux/man-pages$ time sudo make -nj >/dev/null
real 0m0.652s
user 0m1.269s
sys 0m0.146s
The current (new) Makefile I'm working with is (after removing some uninteresting parts):
Makefile:
SHELL := /bin/bash -Eeuo pipefail
MAKEFLAGS += --no-print-directory
MAKEFLAGS += --silent
ROOTDIR := $(CURDIR)
DESTDIR :=
prefix := /usr/local
datarootdir := $(prefix)/share
MANDIR := $(ROOTDIR)
mandir := $(datarootdir)/man
MAN1DIR := $(MANDIR)/man1
MAN2DIR := $(MANDIR)/man2
MAN3DIR := $(MANDIR)/man3
MAN4DIR := $(MANDIR)/man4
MAN5DIR := $(MANDIR)/man5
MAN6DIR := $(MANDIR)/man6
MAN7DIR := $(MANDIR)/man7
MAN8DIR := $(MANDIR)/man8
man1dir := $(mandir)/man1
man2dir := $(mandir)/man2
man3dir := $(mandir)/man3
man4dir := $(mandir)/man4
man5dir := $(mandir)/man5
man6dir := $(mandir)/man6
man7dir := $(mandir)/man7
man8dir := $(mandir)/man8
man1ext := \.1
man2ext := \.2
man3ext := \.3
man4ext := \.4
man5ext := \.5
man6ext := \.6
man7ext := \.7
man8ext := \.8
INSTALL := install
INSTALL_DATA := $(INSTALL) -m 644
INSTALL_DIR := $(INSTALL) -m 755 -d
RM := rm -f
RMDIR := rmdir --ignore-fail-on-non-empty
.PHONY: all
all:
$(MAKE) uninstall;
$(MAKE) install;
%/:
#echo ' INSTALL $#';
$(INSTALL_DIR) $#;
.PHONY: install
install: install-man
.PHONY: uninstall remove
uninstall remove: uninstall-man
################################################################################
# man
MAN1PAGES := $(shell find $(MAN1DIR) -type f | grep '$(man1ext)$$' | sort)
MAN2PAGES := $(shell find $(MAN2DIR) -type f | grep '$(man2ext)$$' | sort)
MAN3PAGES := $(shell find $(MAN3DIR) -type f | grep '$(man3ext)$$' | sort)
MAN4PAGES := $(shell find $(MAN4DIR) -type f | grep '$(man4ext)$$' | sort)
MAN5PAGES := $(shell find $(MAN5DIR) -type f | grep '$(man5ext)$$' | sort)
MAN6PAGES := $(shell find $(MAN6DIR) -type f | grep '$(man6ext)$$' | sort)
MAN7PAGES := $(shell find $(MAN7DIR) -type f | grep '$(man7ext)$$' | sort)
MAN8PAGES := $(shell find $(MAN8DIR) -type f | grep '$(man8ext)$$' | sort)
man1pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN1PAGES))
man2pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN2PAGES))
man3pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN3PAGES))
man4pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN4PAGES))
man5pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN5PAGES))
man6pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN6PAGES))
man7pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN7PAGES))
man8pages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MAN8PAGES))
manpages := $(man1pages) \
$(man2pages) \
$(man3pages) \
$(man4pages) \
$(man5pages) \
$(man6pages) \
$(man7pages) \
$(man8pages)
$(manpages): $(DESTDIR)$(mandir)/%: $(MANDIR)/%
#echo ' INSTALL $#';
$(INSTALL_DATA) -T '$(MANDIR)/$*' '$#';
INSTALL_MANn := install-man1 \
install-man2 \
install-man3 \
install-man4 \
install-man5 \
install-man6 \
install-man7 \
install-man8
.PHONY: $(INSTALL_MANn)
$(INSTALL_MANn): install-%: | installdirs-%
$(MAKE) '_install-$*';
.PHONY: install-man
install-man: $(INSTALL_MANn)
#:;
.PHONY: _install-man1
_install-man1: $(man1pages)
.PHONY: _install-man2
_install-man2: $(man2pages)
.PHONY: _install-man3
_install-man3: $(man3pages)
.PHONY: _install-man4
_install-man4: $(man4pages)
.PHONY: _install-man5
_install-man5: $(man5pages)
.PHONY: _install-man6
_install-man6: $(man6pages)
.PHONY: _install-man7
_install-man7: $(man7pages)
.PHONY: _install-man8
_install-man8: $(man8pages)
INSTALLDIRS_MANn := installdirs-man1 \
installdirs-man2 \
installdirs-man3 \
installdirs-man4 \
installdirs-man5 \
installdirs-man6 \
installdirs-man7 \
installdirs-man8
.PHONY: $(INSTALLDIRS_MANn)
$(INSTALLDIRS_MANn): installdirs-%: $(DESTDIR)$(mandir)/%/ | installdirs-man
#:;
.PHONY: installdirs-man
installdirs-man: $(DESTDIR)$(mandir)/
#:;
uninstall_man1pages := $(addprefix uninstall-,$(wildcard $(man1pages)))
uninstall_man2pages := $(addprefix uninstall-,$(wildcard $(man2pages)))
uninstall_man3pages := $(addprefix uninstall-,$(wildcard $(man3pages)))
uninstall_man4pages := $(addprefix uninstall-,$(wildcard $(man4pages)))
uninstall_man5pages := $(addprefix uninstall-,$(wildcard $(man5pages)))
uninstall_man6pages := $(addprefix uninstall-,$(wildcard $(man6pages)))
uninstall_man7pages := $(addprefix uninstall-,$(wildcard $(man7pages)))
uninstall_man8pages := $(addprefix uninstall-,$(wildcard $(man8pages)))
uninstall_manpages := $(uninstall_man1pages) \
$(uninstall_man2pages) \
$(uninstall_man3pages) \
$(uninstall_man4pages) \
$(uninstall_man5pages) \
$(uninstall_man6pages) \
$(uninstall_man7pages) \
$(uninstall_man8pages)
.PHONY: $(uninstall_manpages)
$(uninstall_manpages): uninstall-%:
#echo ' RM $*';
$(RM) '$*';
UNINSTALL_MANn := uninstall-man1 \
uninstall-man2 \
uninstall-man3 \
uninstall-man4 \
uninstall-man5 \
uninstall-man6 \
uninstall-man7 \
uninstall-man8
uninstall-man1: $(uninstall_man1pages)
uninstall-man2: $(uninstall_man2pages)
uninstall-man3: $(uninstall_man3pages)
uninstall-man4: $(uninstall_man4pages)
uninstall-man5: $(uninstall_man5pages)
uninstall-man6: $(uninstall_man6pages)
uninstall-man7: $(uninstall_man7pages)
uninstall-man8: $(uninstall_man8pages)
.PHONY: $(UNINSTALL_MANn)
$(UNINSTALL_MANn): uninstall-%:
#echo ' RMDIR $(DESTDIR)$(mandir)/$*/';
$(RMDIR) '$(DESTDIR)$(mandir)/$*/' 2>/dev/null ||:;
.PHONY: uninstall-man
uninstall-man: $(UNINSTALL_MANn)
#echo ' RMDIR $(DESTDIR)$(mandir)/';
$(RMDIR) '$(DESTDIR)$(mandir)/' ||:;
My question is:
Why is it so slow to run it in a single thread? 6 times slower than 2 threads??
EDIT: Show --trace
Makefile:54: target 'all' does not exist
make uninstall;
Makefile:176: target 'uninstall-/usr/local/share/man/man1/getent.1' does not exist
echo ' RM /usr/local/share/man/man1/getent.1';
RM /usr/local/share/man/man1/getent.1
rm -f '/usr/local/share/man/man1/getent.1';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man1/time.1' does not exist
echo ' RM /usr/local/share/man/man1/time.1';
RM /usr/local/share/man/man1/time.1
rm -f '/usr/local/share/man/man1/time.1';
Makefile:200: update target 'uninstall-man1' due to: uninstall-/usr/local/share/man/man1/getent.1 ...XXX... uninstall-/usr/local/share/man/man1/time.1
echo ' RMDIR /usr/local/share/man/man1/';
RMDIR /usr/local/share/man/man1/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man1/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man2/accept.2' does not exist
echo ' RM /usr/local/share/man/man2/accept.2';
RM /usr/local/share/man/man2/accept.2
rm -f '/usr/local/share/man/man2/accept.2';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man2/writev.2' does not exist
echo ' RM /usr/local/share/man/man2/writev.2';
RM /usr/local/share/man/man2/writev.2
rm -f '/usr/local/share/man/man2/writev.2';
Makefile:200: update target 'uninstall-man2' due to: uninstall-/usr/local/share/man/man2/accept.2 ...XXX... uninstall-/usr/local/share/man/man2/writev.2
echo ' RMDIR /usr/local/share/man/man2/';
RMDIR /usr/local/share/man/man2/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man2/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man3/a64l.3' does not exist
echo ' RM /usr/local/share/man/man3/a64l.3';
RM /usr/local/share/man/man3/a64l.3
rm -f '/usr/local/share/man/man3/a64l.3';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man3/ynl.3' does not exist
echo ' RM /usr/local/share/man/man3/ynl.3';
RM /usr/local/share/man/man3/ynl.3
rm -f '/usr/local/share/man/man3/ynl.3';
Makefile:200: update target 'uninstall-man3' due to: uninstall-/usr/local/share/man/man3/a64l.3 ...XXX... uninstall-/usr/local/share/man/man3/ynl.3
echo ' RMDIR /usr/local/share/man/man3/';
RMDIR /usr/local/share/man/man3/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man3/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man4/cciss.4' does not exist
echo ' RM /usr/local/share/man/man4/cciss.4';
RM /usr/local/share/man/man4/cciss.4
rm -f '/usr/local/share/man/man4/cciss.4';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man4/zero.4' does not exist
echo ' RM /usr/local/share/man/man4/zero.4';
RM /usr/local/share/man/man4/zero.4
rm -f '/usr/local/share/man/man4/zero.4';
Makefile:200: update target 'uninstall-man4' due to: uninstall-/usr/local/share/man/man4/cciss.4 ...XXX... uninstall-/usr/local/share/man/man4/zero.4
echo ' RMDIR /usr/local/share/man/man4/';
RMDIR /usr/local/share/man/man4/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man4/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man5/acct.5' does not exist
echo ' RM /usr/local/share/man/man5/acct.5';
RM /usr/local/share/man/man5/acct.5
rm -f '/usr/local/share/man/man5/acct.5';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man5/wtmp.5' does not exist
echo ' RM /usr/local/share/man/man5/wtmp.5';
RM /usr/local/share/man/man5/wtmp.5
rm -f '/usr/local/share/man/man5/wtmp.5';
Makefile:200: update target 'uninstall-man5' due to: uninstall-/usr/local/share/man/man5/acct.5 ...XXX... uninstall-/usr/local/share/man/man5/wtmp.5
echo ' RMDIR /usr/local/share/man/man5/';
RMDIR /usr/local/share/man/man5/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man5/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man6/intro.6' does not exist
echo ' RM /usr/local/share/man/man6/intro.6';
RM /usr/local/share/man/man6/intro.6
rm -f '/usr/local/share/man/man6/intro.6';
Makefile:200: update target 'uninstall-man6' due to: uninstall-/usr/local/share/man/man6/intro.6
echo ' RMDIR /usr/local/share/man/man6/';
RMDIR /usr/local/share/man/man6/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man6/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man7/address_families.7' does not exist
echo ' RM /usr/local/share/man/man7/address_families.7';
RM /usr/local/share/man/man7/address_families.7
rm -f '/usr/local/share/man/man7/address_families.7';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man7/xattr.7' does not exist
echo ' RM /usr/local/share/man/man7/xattr.7';
RM /usr/local/share/man/man7/xattr.7
rm -f '/usr/local/share/man/man7/xattr.7';
Makefile:200: update target 'uninstall-man7' due to: uninstall-/usr/local/share/man/man7/address_families.7 ...XXX... uninstall-/usr/local/share/man/man7/xattr.7
echo ' RMDIR /usr/local/share/man/man7/';
RMDIR /usr/local/share/man/man7/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man7/' 2>/dev/null ||:;
Makefile:176: target 'uninstall-/usr/local/share/man/man8/iconvconfig.8' does not exist
echo ' RM /usr/local/share/man/man8/iconvconfig.8';
RM /usr/local/share/man/man8/iconvconfig.8
rm -f '/usr/local/share/man/man8/iconvconfig.8';
...XXX...
Makefile:176: target 'uninstall-/usr/local/share/man/man8/zic.8' does not exist
echo ' RM /usr/local/share/man/man8/zic.8';
RM /usr/local/share/man/man8/zic.8
rm -f '/usr/local/share/man/man8/zic.8';
Makefile:200: update target 'uninstall-man8' due to: uninstall-/usr/local/share/man/man8/iconvconfig.8 ...XXX... uninstall-/usr/local/share/man/man8/zic.8
echo ' RMDIR /usr/local/share/man/man8/';
RMDIR /usr/local/share/man/man8/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/man8/' 2>/dev/null ||:;
Makefile:205: update target 'uninstall-man' due to: uninstall-man1 uninstall-man2 uninstall-man3 uninstall-man4 uninstall-man5 uninstall-man6 uninstall-man7 uninstall-man8
echo ' RMDIR /usr/local/share/man/';
RMDIR /usr/local/share/man/
rmdir --ignore-fail-on-non-empty '/usr/local/share/man/' ||:;
make install;
Makefile:154: update target 'installdirs-man' due to: /usr/local/share/man/
:;
Makefile:150: update target 'installdirs-man1' due to: /usr/local/share/man/man1/
:;
Makefile:115: target 'install-man1' does not exist
make '_install-man1';
Makefile:100: update target '/usr/local/share/man/man1/getent.1' due to: /home/user/src/linux/man-pages/man1/getent.1
echo ' INSTALL /usr/local/share/man/man1/getent.1';
INSTALL /usr/local/share/man/man1/getent.1
install -m 644 -T '/home/user/src/linux/man-pages/man1/getent.1' '/usr/local/share/man/man1/getent.1';
...XXX...
Makefile:100: update target '/usr/local/share/man/man1/time.1' due to: /home/user/src/linux/man-pages/man1/time.1
echo ' INSTALL /usr/local/share/man/man1/time.1';
INSTALL /usr/local/share/man/man1/time.1
install -m 644 -T '/home/user/src/linux/man-pages/man1/time.1' '/usr/local/share/man/man1/time.1';
Makefile:150: update target 'installdirs-man2' due to: /usr/local/share/man/man2/
:;
Makefile:115: target 'install-man2' does not exist
make '_install-man2';
Makefile:100: update target '/usr/local/share/man/man2/accept.2' due to: /home/user/src/linux/man-pages/man2/accept.2
echo ' INSTALL /usr/local/share/man/man2/accept.2';
INSTALL /usr/local/share/man/man2/accept.2
install -m 644 -T '/home/user/src/linux/man-pages/man2/accept.2' '/usr/local/share/man/man2/accept.2';
...XXX...
Makefile:100: update target '/usr/local/share/man/man2/writev.2' due to: /home/user/src/linux/man-pages/man2/writev.2
echo ' INSTALL /usr/local/share/man/man2/writev.2';
INSTALL /usr/local/share/man/man2/writev.2
install -m 644 -T '/home/user/src/linux/man-pages/man2/writev.2' '/usr/local/share/man/man2/writev.2';
Makefile:150: update target 'installdirs-man3' due to: /usr/local/share/man/man3/
:;
Makefile:115: target 'install-man3' does not exist
make '_install-man3';
Makefile:100: update target '/usr/local/share/man/man3/a64l.3' due to: /home/user/src/linux/man-pages/man3/a64l.3
echo ' INSTALL /usr/local/share/man/man3/a64l.3';
INSTALL /usr/local/share/man/man3/a64l.3
install -m 644 -T '/home/user/src/linux/man-pages/man3/a64l.3' '/usr/local/share/man/man3/a64l.3';
...XXX...
Makefile:100: update target '/usr/local/share/man/man3/ynl.3' due to: /home/user/src/linux/man-pages/man3/ynl.3
echo ' INSTALL /usr/local/share/man/man3/ynl.3';
INSTALL /usr/local/share/man/man3/ynl.3
install -m 644 -T '/home/user/src/linux/man-pages/man3/ynl.3' '/usr/local/share/man/man3/ynl.3';
Makefile:59: target '/usr/local/share/man/man4/' does not exist
echo ' INSTALL /usr/local/share/man/man4/';
INSTALL /usr/local/share/man/man4/
install -m 755 -d /usr/local/share/man/man4/;
Makefile:150: update target 'installdirs-man4' due to: /usr/local/share/man/man4/
:;
Makefile:115: target 'install-man4' does not exist
make '_install-man4';
Makefile:100: update target '/usr/local/share/man/man4/cciss.4' due to: /home/user/src/linux/man-pages/man4/cciss.4
echo ' INSTALL /usr/local/share/man/man4/cciss.4';
INSTALL /usr/local/share/man/man4/cciss.4
install -m 644 -T '/home/user/src/linux/man-pages/man4/cciss.4' '/usr/local/share/man/man4/cciss.4';
...XXX...
Makefile:100: update target '/usr/local/share/man/man4/zero.4' due to: /home/user/src/linux/man-pages/man4/zero.4
echo ' INSTALL /usr/local/share/man/man4/zero.4';
INSTALL /usr/local/share/man/man4/zero.4
install -m 644 -T '/home/user/src/linux/man-pages/man4/zero.4' '/usr/local/share/man/man4/zero.4';
Makefile:59: target '/usr/local/share/man/man5/' does not exist
echo ' INSTALL /usr/local/share/man/man5/';
INSTALL /usr/local/share/man/man5/
install -m 755 -d /usr/local/share/man/man5/;
Makefile:150: update target 'installdirs-man5' due to: /usr/local/share/man/man5/
:;
Makefile:115: target 'install-man5' does not exist
make '_install-man5';
Makefile:100: update target '/usr/local/share/man/man5/acct.5' due to: /home/user/src/linux/man-pages/man5/acct.5
echo ' INSTALL /usr/local/share/man/man5/acct.5';
INSTALL /usr/local/share/man/man5/acct.5
install -m 644 -T '/home/user/src/linux/man-pages/man5/acct.5' '/usr/local/share/man/man5/acct.5';
...XXX...
Makefile:100: update target '/usr/local/share/man/man5/wtmp.5' due to: /home/user/src/linux/man-pages/man5/wtmp.5
echo ' INSTALL /usr/local/share/man/man5/wtmp.5';
INSTALL /usr/local/share/man/man5/wtmp.5
install -m 644 -T '/home/user/src/linux/man-pages/man5/wtmp.5' '/usr/local/share/man/man5/wtmp.5';
Makefile:59: target '/usr/local/share/man/man6/' does not exist
echo ' INSTALL /usr/local/share/man/man6/';
INSTALL /usr/local/share/man/man6/
install -m 755 -d /usr/local/share/man/man6/;
Makefile:150: update target 'installdirs-man6' due to: /usr/local/share/man/man6/
:;
Makefile:115: target 'install-man6' does not exist
make '_install-man6';
Makefile:100: update target '/usr/local/share/man/man6/intro.6' due to: /home/user/src/linux/man-pages/man6/intro.6
echo ' INSTALL /usr/local/share/man/man6/intro.6';
INSTALL /usr/local/share/man/man6/intro.6
install -m 644 -T '/home/user/src/linux/man-pages/man6/intro.6' '/usr/local/share/man/man6/intro.6';
Makefile:59: target '/usr/local/share/man/man7/' does not exist
echo ' INSTALL /usr/local/share/man/man7/';
INSTALL /usr/local/share/man/man7/
install -m 755 -d /usr/local/share/man/man7/;
Makefile:150: update target 'installdirs-man7' due to: /usr/local/share/man/man7/
:;
Makefile:115: target 'install-man7' does not exist
make '_install-man7';
Makefile:100: update target '/usr/local/share/man/man7/address_families.7' due to: /home/user/src/linux/man-pages/man7/address_families.7
echo ' INSTALL /usr/local/share/man/man7/address_families.7';
INSTALL /usr/local/share/man/man7/address_families.7
install -m 644 -T '/home/user/src/linux/man-pages/man7/address_families.7' '/usr/local/share/man/man7/address_families.7';
...XXX...
Makefile:100: update target '/usr/local/share/man/man7/xattr.7' due to: /home/user/src/linux/man-pages/man7/xattr.7
echo ' INSTALL /usr/local/share/man/man7/xattr.7';
INSTALL /usr/local/share/man/man7/xattr.7
install -m 644 -T '/home/user/src/linux/man-pages/man7/xattr.7' '/usr/local/share/man/man7/xattr.7';
Makefile:59: target '/usr/local/share/man/man8/' does not exist
echo ' INSTALL /usr/local/share/man/man8/';
INSTALL /usr/local/share/man/man8/
install -m 755 -d /usr/local/share/man/man8/;
Makefile:150: update target 'installdirs-man8' due to: /usr/local/share/man/man8/
:;
Makefile:115: target 'install-man8' does not exist
make '_install-man8';
Makefile:100: update target '/usr/local/share/man/man8/iconvconfig.8' due to: /home/user/src/linux/man-pages/man8/iconvconfig.8
echo ' INSTALL /usr/local/share/man/man8/iconvconfig.8';
INSTALL /usr/local/share/man/man8/iconvconfig.8
install -m 644 -T '/home/user/src/linux/man-pages/man8/iconvconfig.8' '/usr/local/share/man/man8/iconvconfig.8';
...XXX...
Makefile:100: update target '/usr/local/share/man/man8/zic.8' due to: /home/user/src/linux/man-pages/man8/zic.8
echo ' INSTALL /usr/local/share/man/man8/zic.8';
INSTALL /usr/local/share/man/man8/zic.8
install -m 644 -T '/home/user/src/linux/man-pages/man8/zic.8' '/usr/local/share/man/man8/zic.8';
Makefile:119: update target 'install-man' due to: install-man1 install-man2 install-man3 install-man4 install-man5 install-man6 install-man7 install-man8
:;
EDIT: Remove echo lines
I removed echo lines, and got a very important improvement (around 30% faster in both single- and multi-threaded mode):
~/src/linux/man-pages$ time sudo make >/dev/null
real 0m20.190s
user 0m11.629s
sys 0m7.177s
~/src/linux/man-pages$ time sudo make -j2 >/dev/null
real 0m2.917s
user 0m5.469s
sys 0m1.046s
~/src/linux/man-pages$ time sudo make -j >/dev/null
real 0m1.434s
user 0m5.906s
sys 0m1.170s
EDIT: Remove actual work lines
~/src/linux/man-pages$ time sudo make >/dev/null
real 0m7.260s
user 0m5.445s
sys 0m2.110s
~/src/linux/man-pages$ time sudo make -j2 >/dev/null
real 0m1.754s
user 0m2.798s
sys 0m0.411s
~/src/linux/man-pages$ time sudo make -j >/dev/null
real 0m1.229s
user 0m3.059s
sys 0m0.402s
If instead of the echo lines, I remove the lines that do the actual work, I get the rest of the improvement.
It looks like most of the time is actually happening at work, but then how does it improve so much by using -j2? Maybe I'm keeping the cache hot?

How to call bash scripts inside a sh_binary?

I have two shell scripts. One (a) prints "Hello" and the other one (b) prints "World". I want to have a Bazel target (c) that calls both scripts and gives me "Hello World".
My attempt:
mkdir BashScriptDemo
cd BashScriptDemo
touch WORKSPACE.bazel # empty WORKSPACE file
touch BUILD.bazel # empty BUILD file
mkdir my_package
cd my_package
echo '3.5.0' > .bazelversion # use Bazel 3.5.0
echo 'echo -n "Hello"' > a.sh # echo Hello
echo 'echo " World!"' > b.sh # echo World!
echo './a.sh\n./b.sh' > c.sh # script c that calls a and b
chmod +x a.sh b.sh c.sh
echo 'sh_binary(name="a",srcs=["a.sh"])' > BUILD.bazel
echo 'sh_binary(name="b",srcs=["b.sh"])' >> BUILD.bazel
echo 'sh_binary(name="c",srcs=["c.sh"],data=[":a", ":b"])' >> BUILD.bazel
buildifier BUILD.bazel # optional in the case you have buildifier installed
bazel run //my_package:c # Bazel is an alias to bazelisk
When I try to run the script I get this error:
/home/user/.cache/bazel/_bazel_user/2e3943447179c1e4f0f547d49ba1444f/execroot/__main__/bazel-out/k8-fastbuild/bin/my_package/c: line 1: ./a.sh: No such file or directory
/home/user/.cache/bazel/_bazel_user/2e3943447179c1e4f0f547d49ba1444f/execroot/__main__/bazel-out/k8-fastbuild/bin/my_package/c: line 2: ./b.sh: No such file or directory
How do I need to change the BUILD.bazel file (or any other file) to get the desired output?
runfiles.bash is the preferred way to find paths to runfiles from a shell script. Documentation is in comments at the top of the linked file.
For your example, this should do it:
# --- begin runfiles.bash initialization v2 ---
# Copy-pasted from the Bazel Bash runfiles library v2.
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---
"$(rlocation my_workspace/a)"
"$(rlocation my_workspace/b)"
You also need to add the dependency from the shell script by replacing the line in your BUILD.bazel with:
sh_binary(
name = "c",
srcs = ["c.sh"],
data = [
":a",
":b",
]),
deps = ["#bazel_tools//tools/bash/runfiles"],
)
And name your workspace by adding this to your WORKSPACE:
workspace(name = "my_workspace")

Recursive Arch Linux Shell Script To Get Dependencies

I wrote a shell script to print out to a file all of the dependencies from a specified package. Obviously it's not working (or else I wouldn't be here lol). I'm new to shell scriping / bash programming. I am running on Arch Linux and have searched the web to get me to where I'm at. But now I get a bunch of errors from a "empty string package name". It starts off good, then it's an endless loop of doom. My current code is this:
#!/bin/bash
echo -n "Enter a package: "
read p
echo "Searching through package...$p"
get_dependencies() {
# Make sure we get the package too...
pacman -Sp "$1" >> myPackages.list
# Get dependency list from current package and output to tmp file
pacman -Si "$1" | awk -F'[:<=>' '/^Depends/ {print $2}' | xargs -n1 | sort -u > depList.list
# Read from that output file and store in array
listArray=()
while read -r input ; do
listArray+=("$input")
done < "depList.list"
# Get the number of dependencies
numList=${#listArray[#]}
echo "$numList dependencies from $1"
echo "Delving deeper.."
# Loop through each depend and get all those dependencies
for i in "${listArray[#]}" ; do
get_dependencies "$i"
done
}
# Get dependcies of package that user typed
get_dependencies "$p"
# Finished
echo "Done!"
To avoid cyclic dependencies, you can keep track of what packages you've visited and which you have yet to visit in seperate files. Comparing those files before descending into the dependencies will hopefully keep your script out of trouble.
deps() {
pacman -Si "$1" |
awk -F'[:<=>]' '/^Depends/ {print $2}' |
xargs -n1 |
sort -u |
grep -v None
}
alldeps() {
# needed files, potentially cached for later
unseen_f=unseen.$1.txt
seen_f=seen.$1.txt
deps_f=deps.$1.txt
# start of with the root packaage
echo $1 > $unseen_f
# while we still have unseen packages, find depends
while [ $(sed /^$/d $unseen_f |wc -l ) -gt 0 ]; do
# read in all unseen, and get their deps
for d in $(cat $unseen_f); do
echo $d >> $seen_f
deps $d >> $deps_f
done
# those in deps but not in seen to go unseen
# we'll finish when unseen is empty: nothing in deps we haven't seen
comm -23 <(sort -u $deps_f) <(sort -u $seen_f) > $unseen_f
done
cat $seen_f
#sort -u $seen_f $deps_f
# rm $seen_f $deps_f $unseen_f
}
alldeps xterm

Makefile: make text file and append strings in it

I'm having difficulties with makefiles.
So in a recipe, I'm making a file (with a name and a .ujc extension) in a for loop and would like to have a text file at the end which contains all the created files. Purpose is to feed it to an application.
For example, in a semi high-level example,
List= [Class1,Class2,Class3]
foreach(Class C in List) {
#do operations on C > outputs a ClassX.ujc file
# add name of file to a text file named "list_of_files"
}
At the end I should have a text file, list_of_files.txt, which contains the following string:
Class1.ujc Class2.ujc Class3.ujc
As a reference, the code I have at the moment (and which does a bit of the stuff above but does not work is) is:
pc: $(APP)
$(foreach C, $(shell echo $(CLASS) | tr ',' ' '), \
make -C BUILDENV CLASS=$(C) BUILD=just_filelist OUTPUT=filelist.txt SKIPSELF=yes && \
../classCvt/classCvt <./Applications/$(C).class> ./Applications/$(C).ujc && \
cat app_file_list.txt | xargs echo ./Applications/$(C).ujc >app_file_list.txt && \
) true
time -p ./$(APP) `cat app_file_list.txt` `cat filelist.txt`
The internal make does make a filelist which is fed to the app, but I'd also like to feed the app_file_list but its construction goes totally wrong.
Probably simple, but I'm not getting there.
Edit:
The code below does what I want:
pc: $(APP)
rm -f cat app_file_list.txt
$(foreach C, $(shell echo $(CLASS) | tr ',' ' '), \
make -C BUILDENV CLASS=$(C) BUILD=just_filelist OUTPUT=filelist.txt SKIPSELF=yes && \
../classCvt/classCvt <./Applications/$(C).class> ./Applications/$(C).ujc && \
cat app_file_list.txt | echo ./Applications/$(C).ujc >>app_file_list.txt && \
) true
time -p ./$(APP) `cat app_file_list.txt` `cat filelist.txt`
Notable mistake I made was the xargs.
(Also in the post)
The solution turned out to be not-so-difficult. I needed to remove the xargs command and do the correct operation (i.e., >> instead of >) in the 'cat app_file_list.txt | etc...' line.
The code below does what I want:
pc: $(APP)
rm -f cat app_file_list.txt
$(foreach C, $(shell echo $(CLASS) | tr ',' ' '), \
make -C BUILDENV CLASS=$(C) BUILD=just_filelist OUTPUT=filelist.txt SKIPSELF=yes && \
../classCvt/classCvt <./Applications/$(C).class> ./Applications/$(C).ujc && \
cat app_file_list.txt | echo ./Applications/$(C).ujc >>app_file_list.txt && \
) true
time -p ./$(APP) `cat app_file_list.txt` `cat filelist.txt`
Notable mistake I made was the xargs which caused strings to repeat into the .txt file.

Problem in Makefile

I am executing the following command in Makefile:-
#ls export_mojave/marker_*.tcl > export_mojave.list
#for file in `cat export_mojave_tcl_files.list`; do \
diff $$file bk_marker > $$file.diff ; \
if ! [ -s $$file.diff ]; then\
rm -f $$file.diff ; \
else \
echo $$file >> marker.fill.tcl.diff; \
fi \
done ;
If there exists some file related to the above expression in the mentioned directory,
it will run fine but if there does not exits any files matching to above expression, It is marking an error. Is there anything exists like "catch" in Makefile?
If you need to skip error in makefiles' rule, then prefix command with '-' sign:
-#ls .... > some_file || echo Error: no file;
if [ -e some_file ] ....
Or modify to be more in make-style:
FILES := $(shell ls ...)
ifeq ($(FILES),)
$(error no files)
endif
....
target:
$(foreach file,$(FILES), ...)

Resources