最新消息:20210917 已从crifan.com换到crifan.org

【已解决】gitbook的template中batchProcess的make出错

gitbook crifan 610浏览 0评论
自己的:
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;
详见:
https://github.com/crifan/gitbook_template/blob/master/common/Makefile

转载请注明:在路上 » 【已解决】gitbook的template中batchProcess的make出错

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.181 seconds, using 23.34MB memory