Commit a87fc113 authored by Jules Saget's avatar Jules Saget
Browse files

Updating Makefiles to get a better understanding of them

parent d958e78f
......@@ -11,7 +11,6 @@ TEX=pdflatex -shell-escape
.DELETE_ON_ERROR:
.DEFAULT_GOAL := all
all: report slides
......@@ -19,21 +18,8 @@ report: report.pdf
slides: slides.pdf
slides.pdf: figs tables
$(TEX) slides.tex
if grep 'Rerun to get ' slides.log ; then $(MAKE) slides.pdf ; fi
%.pdf %.aux %.idx: %.tex figs tables %.bbl
$(TEX) $<
if grep 'Rerun to get ' $*.log ; then $(MAKE) $@ ; fi
if grep 'There were undefined references' $*.log ; then exit 1 ; fi
if grep 'Please (re)run Biber' $*.log ; then $(MAKE) $*.bbl ; $(MAKE) $@ ; fi
%.bbl: %.bcf ref.bib
biber $*
%.bcf: %.tex
$(TEX) $<
%.pdf: %.tex figs tables
latexmk -pdf -pdflatex="$(TEX)" $*.tex
figs:
$(MAKE) -C figures
......@@ -44,17 +30,4 @@ tables:
clean:
$(MAKE) -C figures clean
$(MAKE) -C tables clean
rm -f *.bbl
rm -f *.blg
rm -f *.out
rm -f *.run.xml
rm -f *.toc
rm -f *.aux
rm -f *.bcf
rm -f *.log
rm -f *.pdf
rm -f *.dvi
rm -rf _minted-*
rm -f *.lof
rm -f *.lot
rm -f *.lol
latexmk -c
......@@ -2,12 +2,18 @@ built_figs= comparator.pdf simple_graph_reductions.pdf ski_combinators.pdf 4ph.p
other_figs= andor.png gr_ex_0.pdf gr_ex_1.pdf gr_ex_2.pdf gr_ex_3.pdf gr_ex_4.pdf tam.png
figs: $(built_figs) $(other_figs) add_fsm_figs mul_fsm_figs
.PHONY: figs add_fsm_figs mul_fsm_figs clean
add_fsm_figs:
.DEFAULT: figs
.SECONDARY: add_fsm_figs mul_fsm_figs
figs: $(built_figs) $(other_figs)# add_fsm_figs mul_fsm_figs
add_fsm_figs: add_fsm.gv generate_fig.py generate_add_fsm_highlights.sh
./generate_add_fsm_highlights.sh
mul_fsm_figs:
mul_fsm_figs:
./generate_mul_fsm_highlights.sh
%.pdf: %.gv
......
tables: mul_exs arith_2cpl.tex arith_ex_clean.tex arith_ex_gonewrong.tex arith_ex_simple.tex
tables: arith_2cpl.tex arith_ex_clean.tex arith_ex_gonewrong.tex arith_ex_simple.tex #mul_exs
mul_exs: mul_2by2.tex
#python diapize.py
python diapize.py
clean:
rm -f mul_2by2_*.tex
import sys
"Test"
number_of_lines = 5
NUMBER_OF_LINES = 5
start_tokens = ["\\begin", "\\centering", "multi", "size"]
start_lines = []
......@@ -8,26 +8,30 @@ start_lines = []
end_tokens = ["\\end", "\\caption", "\\label"]
end_lines = []
base_file_name = "mul_2by2"
extension = ".tex"
BASE_FILE_NAME = "mul_2by2"
EXTENSION = ".tex"
filenum = 0
FILENUM = 0
out_files = []
base_file = open(base_file_name + extension, "rt")
base_file = open(BASE_FILE_NAME + EXTENSION, "rt")
def has_a_member(test_list, source):
"""
test_list : list
source : list
return type : bool
Tests wether a member of test_list is in source
"""
if test_list == []:
return False
else:
elt = test_list[-1]
if elt in source:
return True
else:
return (has_a_member(test_list[:-1], source))
elt = test_list[-1]
if elt in source:
return True
return has_a_member(test_list[:-1], source)
n = 0
N = 0
for line in base_file:
if has_a_member(start_tokens, line):
......@@ -35,14 +39,14 @@ for line in base_file:
elif has_a_member(end_tokens, line):
end_lines.append(line)
else:
new_out_file = open(base_file_name+'_'+str(filenum)+extension,"wt")
filenum+=1
new_out_file = open(BASE_FILE_NAME+'_'+str(FILENUM)+EXTENSION,"wt")
FILENUM+=1
for sl in start_lines:
new_out_file.write(sl)
out_files.append(new_out_file)
if n < number_of_lines:
n += 1
for out_file in out_files[-n:]:
if N < NUMBER_OF_LINES:
N += 1
for out_file in out_files[-N:]:
out_file.write(line)
base_file.close()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment