自己的:
common/batchProcess/Makefile
此处运行:
make help
竟然报错:
。。。 laywright web_automation_tool_puppeteer web_transfer_proxy_tech xpath_summary BOOKS_SRC_ROOT=/Users/xxx/dev/crifan/gitbook/gitbook_template/books /bin/sh: -c: line 1: syntax error: unexpected end of file make: *** [debug_nothing] Error 2
去试了:
help: @# echo help; @for each_item in $(TO_PROCESS_BOOKS); \ do \ if [ -d $(BOOKS_SRC_ROOT)/$$each_item ]; then \ echo $$each_item; \ fi; \ done;
又是可以正常运行的。
但是不知道为何:
@for each_item in $(TO_PROCESS_BOOKS); \ do \ if [ -f $(BOOKS_SRC_ROOT)/$$each_item/README.md ]; then \ cd $(BOOKS_SRC_ROOT)/$$each_item; \ # echo `pwd`; \ if [ -f Makefile ]; then \ # echo $$each_item; \ make $@ || exit "$$?"; \ fi; \ cd ..; \ else \ echo Omit not-existed book src or non-folder: $$each_item; \ fi; \ done;
会报错?
改为:
if [ -f $(BOOKS_SRC_ROOT)/$$each_item/README.md ]; then \
可以。
继续:
if [ -f $(BOOKS_SRC_ROOT)/$$each_item/README.md ]; then \ echo $$each_item; \ cd $(BOOKS_SRC_ROOT)/$$each_item; \ echo `pwd`; \
可以
继续:
if [ -f $(BOOKS_SRC_ROOT)/$$each_item/README.md ]; then \ echo $$each_item; \ cd $(BOOKS_SRC_ROOT)/$$each_item; \ # echo `pwd`; \ if [ -f Makefile ]; then \ echo $$each_item; \ fi; \ fi; \
难道是:
# echo `pwd`; \
语法报错?
echo `pwd`; \
结果:
正常。
说明就是上面这句报错的。
那去找找:
【无法解决】make中target中bash中for中do和done中间多行中如何加注释
此处情况特殊,无法加注释。
所以去掉注释。
最后是:
# echo `pwd`; \ # echo $$each_item; \ # Batch make for all gitbooks help debug_nothing debug_dir init sync_content pull status clean_all website pdf epub mobi all upload commit deploy: @echo "Current path="`pwd`; @echo "LS_OUTPUT="$(TO_PROCESS_BOOKS); @echo "BOOKS_SRC_ROOT="$(BOOKS_SRC_ROOT); @for each_item in $(TO_PROCESS_BOOKS); \ do \ if [ -f $(BOOKS_SRC_ROOT)/$$each_item/README.md ]; then \ cd $(BOOKS_SRC_ROOT)/$$each_item; \ if [ -f Makefile ]; then \ make $@ || exit "$$?"; \ fi; \ cd ..; \ else \ echo Omit not-existed book src or non-folder: $$each_item; \ fi; \ done;
详见: