Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 08 Jan 2021 12:46:52 +0200
changeset 960 b4b2d30f6c97
parent 959 25d27dfee90e
child 961 d7b4c9d10b92
Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Makefile
--- a/Makefile	Fri Jan 08 00:07:21 2021 +0200
+++ b/Makefile	Fri Jan 08 12:46:52 2021 +0200
@@ -106,63 +106,64 @@
 # Install/uninstall targets.
 
 .PHONY: install
+.ONESHELL:
 install:
-	for item in $(OVERRIDDEN_ITEMS); do \
-		if [[ -f $$item ]]; then \
-			$(INSTALL_DATA) $$item $(HOME)/$$item; \
-		fi; \
-		if [[ -d $$item ]]; then \
-			for file in `find $$item`; do \
-				if [[ -d $$file ]]; then \
-					mkdir -p $(HOME)/$$file; \
-					continue; \
-				fi; \
-				$(INSTALL_DATA) $$file $(HOME)/$$file; \
-			done; \
-		fi; \
+	for item in $(OVERRIDDEN_ITEMS); do
+		if [[ -f $$item ]]; then
+			$(INSTALL_DATA) $$item $(HOME)/$$item
+		fi
+		if [[ -d $$item ]]; then
+			for file in `find $$item`; do
+				if [[ -d $$file ]]; then
+					mkdir -p $(HOME)/$$file
+					continue
+				fi
+				$(INSTALL_DATA) $$file $(HOME)/$$file
+			done
+		fi
 	done
 	chmod 700 ~/.gnupg/
 	chmod a+x ~/.fvwm/FvwmKbdd.pl ~/.fvwm/xinit
-	command -v fvwm || exit 0; \
-	for f in /etc/xdg/menus/*.menu; do \
-		[[ -f "$$f" ]] || continue; \
-		fname=$${f%.menu}; \
-		fname=$${fname##*/}; \
-		python .fvwm/xdg2fvwm.py Menu-$$fname $$f >~/.fvwm/$$fname.hook; \
-		echo "Read $$[HOME]/.fvwm/$$fname.hook" >>~/.fvwm/config; \
-		echo "AddToMenu MenuMyRoot $$fname Popup Menu-$$fname" >>~/.fvwm/config; \
+	command -v fvwm || exit 0
+	for f in /etc/xdg/menus/*.menu; do
+		[[ -f "$$f" ]] || continue
+		fname=$${f%.menu}
+		fname=$${fname##*/}
+		python .fvwm/xdg2fvwm.py Menu-$$fname $$f >~/.fvwm/$$fname.hook
+		echo "Read $$[HOME]/.fvwm/$$fname.hook" >>~/.fvwm/config
+		echo "AddToMenu MenuMyRoot $$fname Popup Menu-$$fname" >>~/.fvwm/config
 	done
 	mkdir -p ~/.screenshot
-	for item in $(IFNONEXIST_ITEMS); do \
-		if [[ -f $$item ]] && ! [[ -f $(HOME)/$$item ]]; then \
-			$(INSTALL_DATA) $$item $(HOME)/$$item; \
-		fi; \
-		if [[ -d $$item ]]; then \
-			for file in `find $$item`; do \
-				if [[ -d $$file ]]; then \
-					mkdir -p $(HOME)/$$file; \
-					continue; \
-				fi; \
-				if [[ ! -f $(HOME)/$$file ]]; then \
-					$(INSTALL_DATA) $$file $(HOME)/$$file; \
-				fi; \
-			done; \
-		fi; \
+	for item in $(IFNONEXIST_ITEMS); do
+		if [[ -f $$item ]] && ! [[ -f $(HOME)/$$item ]]; then
+			$(INSTALL_DATA) $$item $(HOME)/$$item
+		fi
+		if [[ -d $$item ]]; then
+			for file in `find $$item`; do
+				if [[ -d $$file ]]; then
+					mkdir -p $(HOME)/$$file
+					continue
+				fi
+				if [[ ! -f $(HOME)/$$file ]]; then
+					$(INSTALL_DATA) $$file $(HOME)/$$file
+				fi
+			done
+		fi
 	done
 	chmod a+x ~/.xinitrc ~/.xserverrc
 	rm -f ~/.xsession
 	ln -s ~/.xinitrc ~/.xsession
 	rm -f ~/.bash_profile
 	cp ~/.bashrc ~/.bash_profile
-	mkdir -p $(HOME)/.config/mc $(HOME)/.local/share/mc/; \
-	umask 0117; \
-	$(INSTALL_DATA) .local/share/mc/bashrc $(HOME)/.local/share/mc/; \
+	mkdir -p $(HOME)/.config/mc $(HOME)/.local/share/mc/
+	umask 0117
+	$(INSTALL_DATA) .local/share/mc/bashrc $(HOME)/.local/share/mc/
 	cat .config/mc/mc.ext /etc/mc/mc.ext > $(HOME)/.config/mc/mc.ext
 ifneq '' '$(filter $(host_os),cygwin linux)'
-	if command -v file 1>/dev/null; then \
-		$(INSTALL_DATA) .magic $(HOME); \
-		cd $(HOME); \
-		file --compile -m .magic; \
+	if command -v file 1>/dev/null; then
+		$(INSTALL_DATA) .magic $(HOME)
+		cd $(HOME)
+		file --compile -m .magic
 	fi
 endif
 	mkdir -p $(HOME)/.local/share/applications/
@@ -170,20 +171,21 @@
 	sed -e 's=@CFG_FONT_SIZE@=$(CFG_FONT_SIZE)=' <.minttyrc >$(HOME)/.minttyrc
 
 .PHONY: uninstall
+.ONESHELL:
 uninstall:
-	for item in $(OVERRIDDEN_ITEMS); do \
-		if [ -f $$item ]; then \
-			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item; \
-		fi; \
-		if [ -d $$item ]; then \
-			for file in `find $$item -depth`; do \
-				if [ -d $$file ]; then \
-					rmdir $(HOME)/$$file || :; \
-					continue; \
-				fi; \
-				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file; \
-			done; \
-		fi; \
+	for item in $(OVERRIDDEN_ITEMS); do
+		if [ -f $$item ]; then
+			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item
+		fi
+		if [ -d $$item ]; then
+			for file in `find $$item -depth`; do
+				if [ -d $$file ]; then
+					rmdir $(HOME)/$$file || :
+					continue
+				fi
+				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file
+			done
+		fi
 	done
 	rm -f $(HOME)/.mc/bashrc $(HOME)/.mc/ini $(HOME)/.mc/bindings
 	rmdir $(HOME)/.mc || :