aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/scripts/mkmakefile
blob: 95901199f10964be5b37d60d9c19c897195aea83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#
# mkmakefile -- build the Makefile.inc for all the papers
#
# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
#

#
# Header of the Makefile.inc
#
cat >common/Makefile.inc <<EOF
#
# Makefile.inc -- Makefile Targets und Variablen für Papers
#
# Achtung: dieses File wird erzeugt vom Skript scripts/mkmakefile
#
# (c) 2020 Prof Dr Andreas Müller, Hochschule Rapperswil
#
EOF

#
# add dependency variables for the main paper files
#
awk 'BEGIN {
	printf("PAPERFILES = \\\n")
	printf("\tpapers/part2.tex \\\n")
	printf("\tpapers/uebersicht.tex \\\n")
}
{
	printf("\tpapers/%s/main.tex \\\n", $1)
}
END {
	printf("\t\n")
}' common/paperlist >> common/Makefile.inc

#
# generate bibliographic dependency variables and commands
#
awk 'BEGIN {
	counter=1
}
{
	printf("buch%d-blx.bbl:\tbuch%d-blx.aux\n", counter, counter)
	printf("\tbibtex buch%d-blx\n\n", counter)
	counter++
}
END {
	printf("buch%d-blx.bbl:\tbuch%d-blx.aux\n", counter, counter)
	printf("\tbibtex buch%d-blx\n\n", counter)
	printf("BLXFILES = buch.bbl \\\n")
	for (i = 1; i <= counter; i++) {
		printf("\tbuch%d-blx.bbl \\\n", i)
	}
	#printf("\tbuch%d-blx.bbl\n", i)
	printf("\n")
}' common/paperlist >> common/Makefile.inc

#
# generate a directory list for 
#
awk 'BEGIN {
	printf("PAPER_DIRECTORIES = \\\n")
}
{
	printf("\t%s \\\n", $1)
}
END {
	printf("\t\n")
}' common/paperlist >> common/Makefile.inc

#
# generate a list of Makefile.inc to be used by the top level makefile
#
awk 'BEGIN {
	printf("PAPER_MAKEFILEINC = \\\n")
}
{
	printf("\tpapers/%s/Makefile.inc \\\n", $1)
}
END {
	printf("\t\n")
}' common/paperlist >> common/Makefile.inc

#
# add include directives for all papers
#
awk '{
	printf("include papers/%s/Makefile.inc\n", $1)
	texfiles = sprintf("%s\t$(dependencies-%s) \\\n", texfiles, $1);
}
END {
	printf("\n")
	printf("TEXFILES = \\\n")
	printf("%s\n", texfiles)
}' common/paperlist > common/includes.inc