added desc in makefile

master
jvdhorst 7 years ago
parent b490da671a
commit 073f17ffa9

@ -3,7 +3,7 @@ output_ocr:=$(dir_ocr)/output.txt
tmpfile:= $(shell mktemp) tmpfile:= $(shell mktemp)
space:= $(empty) $(empty) space:= $(empty) $(empty)
newline:= '\n' newline:= '\n'
listimgs:= $(subst $(space),$(newline), $(images) ) # list of the images, with one filename on each line $(subst $(delimitator),$(replacement),$(list)) listimgs:= $(subst $(space),$(newline), $(images) ) # list of the images, with one filename on each line $(subst $(delimitator),$(replacement),$(list))
OS:= $(shell uname) OS:= $(shell uname)
# Colors: add color to output ie @echo $(color_r) output text # Colors: add color to output ie @echo $(color_r) output text
color_w:="\033[0;29m" color_w:="\033[0;29m"
@ -30,9 +30,9 @@ clean: ## removes output (target) files
# ADMINISTRATIVE RECIPES # ADMINISTRATIVE RECIPES
dirs: ## create the dirs in working dir dirs: ## create the dirs in working dir
@-mkdir -p images/ @-mkdir -p images/
@-mkdir -p output/ @-mkdir -p output/
@echo $(color_r)'Directories made': images/ output/ @echo $(color_r)'Directories made': images/ output/
@ -53,18 +53,18 @@ ocr/output.txt: ## ocr with tesseract
#OUTPUT GENERATION RECIPES #OUTPUT GENERATION RECIPES
output/tagged-words.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependecies: python3's nltk, nltk's averaged_perceptron_tagger output/tagged-words.txt: ocr/output.txt ## Analyzes OCR'ed text using a Part of Speech (POS) tagger. Outputs a string of tags (e.g. nouns, verbs, adjectives, and adverbs). Dependencies: python3's nltk, nltk's averaged_perceptron_tagger
cat $< | python3 src/wordtagger.py > $(@) cat $< | python3 src/wordtagger.py > $(@)
# install nltk's 'averaged_perceptron_tagger': # install nltk's 'averaged_perceptron_tagger':
# $ python 3 # $ python 3
# >>> import nltk # >>> import nltk
# >>> nltk.download('averaged_perceptron_tagger') # >>> nltk.download('averaged_perceptron_tagger')
output/chatbot.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependecies: python3's chatterbot output/chatbot.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependencies: python3's chatterbot
cat $< | python3 src/textbotconversation.py $(@) cat $< | python3 src/textbotconversation.py $(@)
output/n7.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependecies: python3's chatterbot output/n7.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependencies: python3's chatterbot
cat $< | python3 src/n_7.py > $(@) cat $< | python3 src/n_7.py > $(@)

@ -2,7 +2,7 @@
# Tools for scanned pages # Tools for scanned pages
Get help on the different makefile targets by running: Get help on the different makefile targets by running:
`make` `make`
# Makefile Documentation # Makefile Documentation
@ -20,7 +20,7 @@ https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
- preceeding a command tells make to ignore errors in a recipe line - preceeding a command tells make to ignore errors in a recipe line
## DEPENDECIES AND RULES ## DEPENDENCIES AND RULES
a rule "asks" a *dependency* to be executed, only if the depency does not exist as a file a rule "asks" a *dependency* to be executed, only if the depency does not exist as a file
i.e. I have the 2 following rules in my make file: i.e. I have the 2 following rules in my make file:
@ -31,8 +31,8 @@ list.txt:
tts: list.txt tts: list.txt
cat $< | espeak cat $< | espeak
``` ```
when i run: `make tts` when i run: `make tts`
tts rule will execute its dependency list.txt IF the list.xt does not exist in the top level of working directory. ELSE it will execute the list.txt tts rule will execute its dependency list.txt IF the list.xt does not exist in the top level of working directory. ELSE it will execute the list.txt
## TARGET NAMES ## TARGET NAMES
@ -59,19 +59,19 @@ art: foo.txt
``` ```
For the first time you run `make art` the foo.txt dependency rule will be executed For the first time you run `make art` the foo.txt dependency rule will be executed
In subsequent runs of `make art` foo.txt dependency rule will NOT be executed, because its target: foo.txt is already in the make working directory In subsequent runs of `make art` foo.txt dependency rule will NOT be executed, because its target: foo.txt is already in the make working directory
To trigger the execution of foo.txt ruke, we need to remove its target from the working directoy To trigger the execution of foo.txt rule, we need to remove its target from the working directoy
That task if often delegate to a rule with target `clean` which removes the files/targets of make, such as That task if often delegate to a rule with target `clean` which removes the files/targets of make, such as
``` ```
clean: removes output (target) files clean: removes output (target) files
rm ocr/output.txt rm ocr/output.txt
rm $(wildcard output/*) rm $(wildcard output/*)
rm $(tmpfile) rm $(tmpfile)
``` ```
After running `make clean` the foo.txt rule is executed (as a dependancy) when running `make art` After running `make clean` the foo.txt rule is executed (as a dependancy) when running `make art`
Tagets can also include subfolders: Targets can also include subfolders:
``` ```
output/art.txt: foo.txt output/art.txt: foo.txt
@ -84,4 +84,3 @@ Read more on https://www.gnu.org/software/make/manual/html_node/Rule-Syntax.html
# LINKS # LINKS
* About Makefile syntax: [5 Writing Recipes in Rules](https://www.gnu.org/software/make/manual/make.html#Recipes) * About Makefile syntax: [5 Writing Recipes in Rules](https://www.gnu.org/software/make/manual/make.html#Recipes)

Loading…
Cancel
Save