-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (53 loc) · 1.76 KB
/
Makefile
File metadata and controls
63 lines (53 loc) · 1.76 KB
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
#
# Makefile for compilation of Lecture Notes in Electromagnetic Theory,
# Uppsala University, 2025. Code for the lectures written in plain TeX.
# Lectures available at Github: https://github.com/hp35/elmagii/
#
# Copyright (C) 2025 under GPL 3.0, Fredrik Jonsson
#
TEX = tex
DVIPS = dvips
MKIDX = makeindex
PS2PDF = ps2pdf
TAR = tar
srcs = $(wildcard *.tex)
dvis = $(patsubst %.tex,%.dvi,$(srcs))
pss = $(patsubst %.tex,%.ps ,$(srcs))
pdfs = $(patsubst %.tex,%.pdf,$(srcs))
TEXFILE := $(firstword $(wildcard *.tex))
PROJDIR := $(notdir $(CURDIR))
ARCHIVE := $(notdir $(CURDIR)).tar.gz
all: figures $(pdfs)
figures:
@make -C figs
$(pdfs): $(pss)
@$(eval BASE = $(shell basename $@ .pdf))
@echo "Converting PS file $< to PDF (target $@)."
@$(PS2PDF) $(BASE).ps $(BASE).pdf
@echo "PDF file for $(BASE).ps written to $(BASE).pdf."
$(pss): $(dvis)
@$(eval BASE = $(shell basename $@ .ps))
@echo "Converting DVI file $< to PostScript (target $@)."
@$(DVIPS) -D1200 -ta4 $(BASE).dvi -o $(BASE).ps
@echo "PostScript file for $< written to $@."
$(dvis): $(srcs)
@$(eval BASE = $(shell basename $@ .dvi))
@echo "Compiling source file $(BASE).tex to DVI (target $(BASE).dvi)."
@$(TEX) $(BASE).tex
@$(MKIDX) $(BASE).idx
@$(TEX) $(BASE).tex
@echo "DVI file for $(BASE).tex written to $(BASE).dvi."
texchars:
@echo "Converting Swedish Unicode chars in $(TEXFILE) to TeX codes."
@./macros/se-texchars.sh $(TEXFILE) > tmp.tex
@mv tmp.tex $(TEXFILE)
@echo "Reload $(TEXFILE) to incorporate the changes."
archive:
@make -ik clean
@echo $(PROJDIR)
@echo $(ARCHIVE)
@echo "Creating archive: $(ARCHIVE) of $(PROJDIR)"
@$(TAR) --exclude="$(ARCHIVE)" -czf $(ARCHIVE) -C .. $(PROJDIR)
clean:
@make -ik clean -C figs
@rm -Rf *~ *.aux *.toc *.idx *.ind *.log *.ilg *.dvi *.ps $(ARCHIVE)