11LANG := en
2- LANG_FILE := $(shell test -f LANGS.md.bak && echo LANGS.md.bak || echo LANGS.md)
2+ LANG_FILE := $(shell test -f .langs && echo .langs || echo LANGS.md)
33LANG_DATA := $(shell grep "$(LANG ) /" $(LANG_FILE ) )
44LANG_NAME := $(shell echo "$(LANG_DATA ) " | sed 's/.* \[\(.* \) \].*/\1/')
5- NODE := $(shell which nodse 1> /dev/null && echo "true")
65
76define ebook_support
87 @if which ebook-convert 1> /dev/null; then\
98 npx honkit $(1 ) ./ ./djangogirls.$(1 ) ;\
109 else\
11- echo "Error: ebook-convert is not found. Follow the guide at https://honkit.netlify.app/ebook";\
10+ echo "Error: ebook-convert is not found";\
11+ echo " * Follow the guide at https://honkit.netlify.app/ebook";\
12+ echo " - For Debian/Ubuntu, Try: sudo apt install calibre";\
13+ echo " - For MacOS, Try: brew install --cask calibre";\
14+ echo " - For Windows and any other OS, Download from https://github.com/kovidgoyal/calibre/releases";\
15+ false;\
1216 fi
1317endef
1418
@@ -35,15 +39,20 @@ help:
3539 @echo
3640
3741check : package.json book.json LANGS.md
38- ifeq ($(NODE ) ,)
39- $(error NodeJS not found. Please install/reinstall Node.js. NVM is recommended for installation(https://github.com/nvm-sh/nvm))
40- endif
42+ @if ! which node 1> /dev/null; then\
43+ echo " Error: Node.js not found" ; \
44+ echo " * Please install/reinstall NodeJS on your system." ; \
45+ echo " * NVM is recommended for installation (https://github.com/nvm-sh/nvm)." ; \
46+ false ; \
47+ fi
4148
4249setup : check
43- @if ! test -f " LANGS.md.bak" ; then\
44- cp LANGS.md LANGS.md.bak && echo " Language file backup is created." ; \
45- echo " $( LANG_DATA) " > LANGS.md && echo " Language list is reduced to $( LANG_NAME) for development" ; \
46- npm install && echo " Project is ready for development." ; \
50+ @if ! test -f " .langs" ; then\
51+ cp LANGS.md .langs && \
52+ echo " $( LANG_DATA) " > LANGS.md && \
53+ echo " You are set to $( LANG_NAME) for development" ; \
54+ npm install && \
55+ echo " Project is ready for development." ; \
4756 fi
4857
4958build : setup
@@ -59,15 +68,15 @@ dev: setup
5968 @npx honkit serve --log=debug
6069
6170mode :
62- @if test -f " LANGS.md.bak " ; then\
71+ @if test -f " .langs " ; then\
6372 echo " You are in development mode" ; \
6473 else\
6574 echo " You are not in development mode" ; \
6675 fi
6776
6877exit :
69- @if test -f " LANGS.md.bak " ; then\
70- mv -f LANGS.md.bak LANGS.md && echo " Language file is reset" ; \
78+ @if test -f " .langs " ; then\
79+ mv -f .langs LANGS.md && echo " Language file is reset" ; \
7180 rm -rf node_modules _book && echo " The project exited development mode." ; \
7281 fi
7382
0 commit comments