.utils 2.01 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
pr           = $(shell echo "\e[38;5;36m")
sc           = $(shell echo "\e[38;5;231m")
ac           = $(shell echo "\e[38;5;197m")
rst          = $(shell echo "\e[0m")
dollar       = `echo '\$$'`

out_length   = 80
header       = -------------------------------------------------------------------------------
print_banner = $1$(header)\n==$(rst) $2$1\n$(header)$(rst)\n

ERRS         = error
LOG          = @echo "$(call print_banner,$(ac),Error Log:$(sc)$1$(rst))\e[1A"                                  && \
13
               grep $(ERRS) $1 -nR -A4 -B8 | fold -sw $(out_length)                                           | \
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
               sed --expression='s/--/$(ac)$(header)\n$(header)$(rst)/g'                                  | \
               grep --color -E -e '' -e '$(ERRS)' && echo "$(ac)$(header)\n$(header)$(rst)"

INSTRUCTIONS = "$(call print_banner,$(pr),$(sc)Help Instructions $(rst))\n"\
               "Provided targets:\n\n   build, view, preview, log, clean, distclean, help\n\n"                  \
               "Set $(pr)$(dollar)TARGET$(rst) to specify the $(sc)tex$(rst) file to compile.\n"                \
               "Unset to turn off this help instruction.\n\n"                                                   \
               "Set $(pr)$(dollar)OPTS$(rst) to pass additional options to latexmk.\n"                          \
               "\n"\
               "Examples:\n\n"                                                                                  \
               " $(dollar) make $(pr)TARGET$(rst)=$(sc)tex/figures/logo$(rst) $(pr)OPTS$(rst)=$(sc)-gg$(rst)\n" \
               " $(dollar) make $(pr)TARGET$(rst)=$(sc)tex/figures/logo$(rst) clean\n\n"                        \
               "Export to set permanently.\n\n"\
               " $(dollar) export $(pr)TARGET$(rst)=$(sc)tex/chapter.tex$(rst)\n"\
               " $(dollar) make\n"\
               " $(dollar) make preview\n"\
               " $(dollar) make clean\n"\
               "\n$(pr)$(header)$(rst)"\
               "\n$(pr)$(header)$(rst)"