-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (101 loc) · 2.99 KB
/
Makefile
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
.PHONY: all
SRC_DIR := $(PWD)
DST_DIR := $(PWD)/page
TMP_DIR := $(shell mktemp -d)
LOCAL := n
CSS_REL = assets/styles/style.css
ifeq ($(LOCAL),y)
CSS = file://$(abspath $(DST_DIR)/..)/$(CSS_REL)
else
CSS = /study/courses/$(CSS_REL)
endif
LECTURES = \
lecture02
LABS = \
lab03 \
lab04 \
lab05 \
lab06 \
lab07 \
lab08
.PHONY: $(LECTURES) $(LABS)
all: $(DST_DIR)/index.html $(LECTURES) $(LABS) $(DST_DIR)/exam.html
$(DST_DIR)/index.html: $(TMP_DIR)/page.md.html
cp $< $@
LEC02_DIR = lecture/02-layer2
LEC02_SRC_DIR = $(SRC_DIR)/$(LEC02_DIR)
LEC02_SRC_DIR = $(DST_DIR)/$(LEC02_DIR)
LEC02_FIGURES = \
arch.png \
arp-packet.jpg \
ethernet-frame.svg \
mac-address.svg \
vlan-frame.svg \
vlan.gif
lecture02: \
$(DST_DIR)/$(LEC02_DIR)/index.html \
$(foreach file,$(LEC02_FIGURES),$(DST_DIR)/$(LEC02_DIR)/$(file))
$(DST_DIR)/$(LEC02_DIR)/index.html: $(TMP_DIR)/$(LEC02_DIR)/lecture02-layer2.md.html
mkdir -p $(dir $@) && cp $^ $@
LAB03_DIR = lab/03-udp
LAB03_FIGURES = \
linux.jpg
lab03: \
$(DST_DIR)/$(LAB03_DIR)/index.html \
$(foreach file,$(LAB03_FIGURES),$(DST_DIR)/$(LAB03_DIR)/$(file))
$(DST_DIR)/$(LAB03_DIR)/index.html: $(TMP_DIR)/$(LAB03_DIR)/lab03-udp.md.html
mkdir -p $(dir $@) && cp $^ $@
LAB04_DIR = lab/04-tcp-client
LAB04_FILES = \
lab05-tcp-server \
lab05-tcp-server.exe
lab04: \
$(DST_DIR)/$(LAB04_DIR)/index.html \
$(foreach file,$(LAB04_FILES),$(DST_DIR)/$(LAB04_DIR)/$(file))
$(DST_DIR)/$(LAB04_DIR)/index.html: $(TMP_DIR)/$(LAB04_DIR)/lab04-tcp-client.md.html
mkdir -p $(dir $@) && cp $^ $@
LAB05_DIR = lab/05-tcp-server
LAB05_FILES = \
listing.h \
listing_ex.h
lab05: \
$(DST_DIR)/$(LAB05_DIR)/index.html \
$(foreach file,$(LAB05_FILES),$(DST_DIR)/$(LAB05_DIR)/$(file))
$(DST_DIR)/$(LAB05_DIR)/index.html: $(TMP_DIR)/$(LAB05_DIR)/lab05-tcp-server.md.html
mkdir -p $(dir $@) && cp $^ $@
LAB06_DIR = lab/06-threaded-server
LAB06_FILES = \
lab06-threaded-server.exe \
sync.h
lab06: \
$(DST_DIR)/$(LAB06_DIR)/index.html \
$(foreach file,$(LAB06_FILES),$(DST_DIR)/$(LAB06_DIR)/$(file))
$(DST_DIR)/$(LAB06_DIR)/index.html: $(TMP_DIR)/$(LAB06_DIR)/lab06-threaded-server.md.html
mkdir -p $(dir $@) && cp $^ $@
LAB07_DIR = lab/07-nonblocking-server
lab07: \
$(DST_DIR)/$(LAB07_DIR)/index.html
$(DST_DIR)/$(LAB07_DIR)/index.html: $(TMP_DIR)/$(LAB07_DIR)/lab07-nonblocking-server.md.html
mkdir -p $(dir $@) && cp $^ $@
LAB08_DIR = lab/08-crypto
LAB08_FILES = \
openvpn-server.conf \
openvpn-client.conf
lab08: \
$(DST_DIR)/$(LAB08_DIR)/index.html \
$(foreach file,$(LAB08_FILES),$(DST_DIR)/$(LAB08_DIR)/$(file))
$(DST_DIR)/$(LAB08_DIR)/index.html: $(TMP_DIR)/$(LAB08_DIR)/lab08-crypto.md.html
mkdir -p $(dir $@) && cp $^ $@
$(DST_DIR)/exam.html: $(TMP_DIR)/exam.md.html
cp $< $@
$(TMP_DIR)/%.md.html: $(SRC_DIR)/%.md $(SRC_DIR)/footer.html
mkdir -p $(dir $@)
pandoc \
--filter pandoc-crossref \
--standalone \
--smart \
--css $(CSS) \
--include-after-body $(SRC_DIR)/footer.html \
$< --output $@
$(DST_DIR)/%: $(SRC_DIR)/%
mkdir -p $(dir $@) && cp "$^" "$@"