Note that there are some explanatory texts on larger screens.

plurals
  1. POMakefile works in bash but fails in zsh. Can you point out error in syntax of for loop?
    primarykey
    data
    text
    <p>Here's the beginning of a GNUMakefile that works well under bash but has failed since I switched to zsh (and oh-my-zsh). It is annoying that I need to start a bash shell to perform it, so do you think you can help point out the syntax problem?</p> <pre><code>SUBDIRS = generator geometry io management physicslist processing makeall: @echo "********************************************************************************" @echo " Building Project" @echo "********************************************************************************" @for dir in $(SUBDIRS); do (echo; echo; echo Building $$dir...; cd $$dir; $(MAKE) "SUBDIRS=$(SUBDIRS)"); done </code></pre> <p>This results in an infinite loop:</p> <pre><code>[●]% make ******************************************************************************** Building Project ******************************************************************************** Building generator... /bin/sh: line 0: cd: generator: No such file or directory ******************************************************************************** Building Project ******************************************************************************** Building generator... /bin/sh: line 0: cd: generator: No such file or directory ******************************************************************************** Building Project ******************************************************************************** ... ... </code></pre> <p>It seems I fork-bomb myself with make's and /bin/sh's:</p> <pre><code>... ... 24921 ttys012 0:00.00 make SUBDIRS=generator geometry io management physicslist processing 24925 ttys012 0:00.00 /bin/sh -c for dir in generator geometry io management physicslist processing; do (echo; echo; echo Building $dir...; cd $dir; make "SUBDIRS=generator geometry io man 24926 ttys012 0:00.00 /bin/sh -c for dir in generator geometry io management physicslist processing; do (echo; echo; echo Building $dir...; cd $dir; make "SUBDIRS=generator geometry io man 24927 ttys012 0:00.00 make SUBDIRS=generator geometry io management physicslist processing 24931 ttys012 0:00.00 /bin/sh -c for dir in generator geometry io management physicslist processing; do (echo; echo; echo Building $dir...; cd $dir; make "SUBDIRS=generator geometry io man 24932 ttys012 0:00.00 /bin/sh -c for dir in generator geometry io management physicslist processing; do (echo; echo ... ... </code></pre> <p>EDIT:</p> <p>The makefile inside of generator looks like:</p> <pre><code>name := generator include ../ProgramConfig/Libraries.gmk </code></pre> <p>Libraries.gmk looks like</p> <pre><code>.PHONY: all lib all: lib include ../ProgramConfig/BuildDirs.gmk include $(G4INSTALL)/config/architecture.gmk include $(G4INSTALL)/config/common.gmk include ../ProgramConfig/ExtraDeps.gmk include ../ProgramConfig/GEANT4.gmk # Add the sub-directory include directories to the compilation list CPPFLAGS += $(addprefix -I../, $(addsuffix /include, $(SUBDIRS))) -O2 cleanup: cd $(G4WORKDIR) rm -rf bin tmp lib </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload