Project

General

Profile

Statistics
| Branch: | Revision:

gdp-router-click / Makefile @ master

History | View | Annotate | Download (13.6 KB)

1 239fe014 Rick Pratt
# For a gdp-router-click installation from the source:
2
#
3
#   invoke "adm/install-gdp-router-click.sh", which will leverage this
4
#   Makefile to git the correct version of click, configure userlevel
5
#   click, compile, install, and set up gdp-router-click service on
6
#   the current host.
7
#
8 91aeb581 Rick Pratt
# For a gdp-router-click2 installation from the source: work in progress
9 239fe014 Rick Pratt
#
10 bdacc134 Nitesh Mor
11 537fe96d Rick Pratt
GDP_BLD=			build/gdp
12 870f095e Rick Pratt
GDP_REPO=			https://repoman@repo.eecs.berkeley.edu/git-anon/projects/swarmlab/gdp.git
13 cc06285b Rick Pratt
14
GDP_NET3_BRANCH=	net3-legacy
15
16 537fe96d Rick Pratt
CLICK_BLD=			build/click
17 239fe014 Rick Pratt
CLICK_REPO=			https://github.com/kohler/click.git
18 537fe96d Rick Pratt
CLICK_M=			${CLICK_BLD}/Makefile
19 239fe014 Rick Pratt
20 d672d917 Rick Pratt
# major version
21 6e640781 Rick Pratt
VERSION=			2
22 31c2a8d8 Rick Pratt
VERHH=				version_gdp_v4_router.hh
23 d672d917 Rick Pratt
S_VERHH=			src/${VERHH}
24
25 e2404776 Rick Pratt
# userlevel workspace
26 537fe96d Rick Pratt
CLICK_UL_M=			${CLICK_BLD}/userlevel/Makefile
27 239fe014 Rick Pratt
UL_M_O=				ul_m_orig
28 537fe96d Rick Pratt
CLICK_UL_M_O=		${CLICK_BLD}/userlevel/Makefile.$(UL_M_O)
29
CLICK_UL_BINARY=	$(CLICK_BLD)/userlevel/click
30
CLICK_ELEMS_LOCAL=	${CLICK_BLD}/elements/local
31 239fe014 Rick Pratt
32 e2404776 Rick Pratt
# linuxmodule workspace
33 537fe96d Rick Pratt
CLICK_LM_PATCH=		${CLICK_BLD}/click.git_apply_patch.linuxmodule_target
34 e2404776 Rick Pratt
UNAME_R=			$(shell /bin/uname -r)
35 00b517f3 Rick Pratt
GDP_LM_PATCH=		adm/click.git_apply_patch.linuxmodule_target
36 e2404776 Rick Pratt
37 239fe014 Rick Pratt
# builds with the latest Click, unless the next line is uncommented and updated
38
#CLICK_COMMIT=	f40363bb492188d44ba2f1251d2fe5dc553b97c9
39
40 e2404776 Rick Pratt
# default
41 d672d917 Rick Pratt
all: gdp-router-click2
42 bdacc134 Nitesh Mor
43 00b517f3 Rick Pratt
# no target should survive recipe errors
44
.DELETE_ON_ERROR:
45
46 cc06285b Rick Pratt
remove_gdp:
47 537fe96d Rick Pratt
	@if [ -d "${GDP_BLD}" ]; \
48 cc06285b Rick Pratt
	then \
49 537fe96d Rick Pratt
		echo "Removing ${GDP_BLD}" ; \
50
		rm -rf ${GDP_BLD} ; \
51 cc06285b Rick Pratt
	else \
52 537fe96d Rick Pratt
		echo "${GDP_BLD} not found" ; \
53 cc06285b Rick Pratt
	fi
54
55
remove_click:
56 537fe96d Rick Pratt
	@if [ -d "${CLICK_BLD}" ]; \
57 239fe014 Rick Pratt
	then \
58 537fe96d Rick Pratt
		echo "Removing ${CLICK_BLD}" ; \
59
		rm -rf ${CLICK_BLD} ; \
60 239fe014 Rick Pratt
	else \
61 537fe96d Rick Pratt
		echo "${CLICK_BLD} not found" ; \
62 239fe014 Rick Pratt
	fi
63 bdacc134 Nitesh Mor
64 e2404776 Rick Pratt
#
65 91aeb581 Rick Pratt
# (default) set up a userlevel workspace then build gdp-router-click
66 e2404776 Rick Pratt
#
67 bdacc134 Nitesh Mor
68 020e6fcf Rick Pratt
.PHONY: unconfigure_userlevel install stop start reinstall clean
69 239fe014 Rick Pratt
70 cc06285b Rick Pratt
configure_userlevel:
71 91aeb581 Rick Pratt
	@test ! -e configure_userlevel2 || \
72
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
73 e2404776 Rick Pratt
	@test ! -e configure_linuxmodule || \
74
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
75 537fe96d Rick Pratt
	@if [ -d ${GDP_BLD} ]; \
76 cc06285b Rick Pratt
	then \
77 537fe96d Rick Pratt
		echo "Error: pre-existing ${GDP_BLD} (make remove_gdp)" ; \
78 cc06285b Rick Pratt
		exit 1 ; \
79
	fi
80 537fe96d Rick Pratt
	@if [ -d ${CLICK_BLD} ]; \
81 cc06285b Rick Pratt
	then \
82 537fe96d Rick Pratt
		echo "Error: pre-existing ${CLICK_BLD} (make remove_click)" ; \
83 cc06285b Rick Pratt
		exit 1 ; \
84
	fi
85 537fe96d Rick Pratt
	@git clone ${GDP_REPO} ${GDP_BLD} && \
86
			( cd ${GDP_BLD} && git checkout ${GDP_NET3_BRANCH} && make && make )
87 cc06285b Rick Pratt
	@if [ -z "${CLICK_COMMIT}" ]; \
88
	then \
89 537fe96d Rick Pratt
		git clone --depth 1 ${CLICK_REPO} ${CLICK_BLD} ; \
90 cc06285b Rick Pratt
	else \
91 537fe96d Rick Pratt
		git clone -n ${CLICK_REPO} ${CLICK_BLD} && \
92
				( cd ${CLICK_BLD} && git checkout ${CLICK_COMMIT} ) ; \
93 cc06285b Rick Pratt
	fi
94 5dbdffae Rick Pratt
	ln src/gdp_router_nat.hh ${CLICK_ELEMS_LOCAL}/gdp_router_nat.hh
95
	ln src/gdp_router_nat.cc ${CLICK_ELEMS_LOCAL}/gdp_router_nat.cc
96 239fe014 Rick Pratt
	@test -r ${CLICK_UL_M_O} || \
97 537fe96d Rick Pratt
		( cd ${CLICK_BLD} ; \
98 e2404776 Rick Pratt
		  ./configure --disable-linuxmodule --enable-local ; \
99 239fe014 Rick Pratt
		  make elemlist ; \
100 bc484182 Rick Pratt
		  sed -i.${UL_M_O} \
101
			-e '/^OBJS = /s/$$/ \.\.\/\.\.\/gdp\/libs\/libgdp.a \.\.\/\.\.\/gdp\/libs\/libep.a /' \
102
			-e '/^LIBS = /s/$$/ -lpthread -levent -levent_pthreads -ljansson -luuid -lssl -lcrypto -lavahi-common -lavahi-client -lsystemd/' \
103 cc06285b Rick Pratt
			-e 's/-I\$$(top_srcdir) /-I\$$(top_srcdir) -I\.\.\/\.\.\/gdp\/ /' \
104 537fe96d Rick Pratt
			-e 's/CXXFLAGS = -g -O2 -W -Wall/CXXFLAGS = -g -O2 -W -Wall -fno-strict-aliasing/' \
105 239fe014 Rick Pratt
				userlevel/Makefile )
106 e2404776 Rick Pratt
	@touch configure_userlevel
107 5319478a Eric Allman
108 e2404776 Rick Pratt
unconfigure_userlevel:
109 91aeb581 Rick Pratt
	@test ! -e configure_userlevel2 || \
110
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
111 e2404776 Rick Pratt
	@test ! -e configure_linuxmodule || \
112
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
113 537fe96d Rick Pratt
	@if [ -d ${GDP_BLD} ]; \
114 cc06285b Rick Pratt
	then \
115 537fe96d Rick Pratt
		echo "Remove ${GDP_BLD}..." ; \
116
		rm -rf ${GDP_BLD} ; \
117 cc06285b Rick Pratt
	else \
118 537fe96d Rick Pratt
		echo "${GDP_BLD} not found" ; \
119 cc06285b Rick Pratt
	fi
120 537fe96d Rick Pratt
	@if [ -d ${CLICK_BLD} ]; \
121 cc06285b Rick Pratt
	then \
122 537fe96d Rick Pratt
		echo "Remove ${CLICK_BLD}..." ; \
123
		rm -rf ${CLICK_BLD} ; \
124 cc06285b Rick Pratt
	else \
125 537fe96d Rick Pratt
		echo "${CLICK_BLD} not found" ; \
126 cc06285b Rick Pratt
	fi
127 e2404776 Rick Pratt
	@rm -f configure_userlevel
128 5319478a Eric Allman
129 8d7a1a17 Rick Pratt
gdp-router-click: configure_userlevel src/*.hh src/*.cc
130 91aeb581 Rick Pratt
	@test ! -e configure_userlevel2 || \
131
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
132 e2404776 Rick Pratt
	@test ! -e configure_linuxmodule || \
133
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
134 537fe96d Rick Pratt
	@echo "Refresh source hardlinks in ${CLICK_BLD} (required post git pull)"
135 5dbdffae Rick Pratt
	@ln -f src/gdp_router_nat.hh ${CLICK_ELEMS_LOCAL}/gdp_router_nat.hh
136
	@ln -f src/gdp_router_nat.cc ${CLICK_ELEMS_LOCAL}/gdp_router_nat.cc
137 537fe96d Rick Pratt
	@( cd $(CLICK_BLD) && make )
138 cc06285b Rick Pratt
	@cp -p ${CLICK_UL_BINARY} $@
139 239fe014 Rick Pratt
140 020e6fcf Rick Pratt
install: gdp-router-click
141 91aeb581 Rick Pratt
	@test ! -e configure_userlevel2 || \
142
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
143 020e6fcf Rick Pratt
	@test ! -e configure_linuxmodule || \
144 534c81a9 Rick Pratt
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
145 65f704ba Rick Pratt
	cp -p ./gdp-router-click /usr/sbin/gdp-router-click
146
	chmod 755 /usr/sbin/gdp-router-click
147
	chown gdp:gdp /usr/sbin/gdp-router-click
148 020e6fcf Rick Pratt
149
stop:
150 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
151
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
152
	@test ! -e configure_linuxmodule || \
153
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
154 65f704ba Rick Pratt
	systemctl stop gdplogd
155
	systemctl stop gdp-router-click
156 020e6fcf Rick Pratt
157
start:
158 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
159
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
160
	@test ! -e configure_linuxmodule || \
161
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
162 65f704ba Rick Pratt
	systemctl start gdp-router-click
163
	systemctl start gdplogd
164 020e6fcf Rick Pratt
165 cc06285b Rick Pratt
reinstall: gdp-router-click
166 91aeb581 Rick Pratt
	@test ! -e configure_userlevel2 || \
167
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
168 e2404776 Rick Pratt
	@test ! -e configure_linuxmodule || \
169 534c81a9 Rick Pratt
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
170 65f704ba Rick Pratt
	systemctl stop gdplogd
171
	systemctl stop gdp-router-click
172
	cp -p ./gdp-router-click /usr/sbin/gdp-router-click
173
	chmod 755 /usr/sbin/gdp-router-click
174
	chown gdp:gdp /usr/sbin/gdp-router-click
175
	systemctl start gdp-router-click
176
	systemctl start gdplogd
177 239fe014 Rick Pratt
178 e2404776 Rick Pratt
clean:
179 91aeb581 Rick Pratt
	@test ! -e configure_userlevel2 || \
180
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
181 e2404776 Rick Pratt
	@test ! -e configure_linuxmodule || \
182
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
183 537fe96d Rick Pratt
	@test ! -r ${CLICK_M} || ( cd $(CLICK_BLD) && make clean )
184 e2404776 Rick Pratt
	@rm -f ${CLICK_UL_BINARY} gdp-router-click gdp-router-click*.deb README.html
185 239fe014 Rick Pratt
186 e2404776 Rick Pratt
#
187 91aeb581 Rick Pratt
# (non-default) set up a userlevel2 workspace then build gdp-router-click2
188 62a58ed2 Rick Pratt
#
189
190 cb04269b Rick Pratt
.PHONY: unconfigure_userlevel2 install2 install-gdp-router-click2
191
.PHONY: stop2 start2 reinstall2
192 62a58ed2 Rick Pratt
193 91aeb581 Rick Pratt
configure_userlevel2:
194 62a58ed2 Rick Pratt
	@test ! -e configure_userlevel || \
195
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
196
	@test ! -e configure_linuxmodule || \
197
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
198 1e57c114 Rick Pratt
	@if [ ! -d ${GDP_BLD} ]; \
199
	then \
200
		git clone ${GDP_REPO} ${GDP_BLD} ; \
201
	fi
202
	@( cd ${GDP_BLD}/util && make )
203 537fe96d Rick Pratt
	@if [ -d ${CLICK_BLD} ]; \
204 e2a8d6d7 Rick Pratt
	then \
205 537fe96d Rick Pratt
		echo "Error: pre-existing ${CLICK_BLD} (make remove_click)" ; \
206 e2a8d6d7 Rick Pratt
		exit 1 ; \
207
	fi
208
	@if [ -z "${CLICK_COMMIT}" ]; \
209
	then \
210 537fe96d Rick Pratt
		git clone --depth 1 ${CLICK_REPO} ${CLICK_BLD} ; \
211 e2a8d6d7 Rick Pratt
	else \
212 537fe96d Rick Pratt
		git clone -n ${CLICK_REPO} ${CLICK_BLD} && \
213
				( cd ${CLICK_BLD} && git checkout ${CLICK_COMMIT} ) ; \
214 e2a8d6d7 Rick Pratt
	fi
215 5dbdffae Rick Pratt
	ln src/gdp_v4_router.hh ${CLICK_ELEMS_LOCAL}/gdp_v4_router.hh
216
	ln src/gdp_v4_router.cc ${CLICK_ELEMS_LOCAL}/gdp_v4_router.cc
217 62a58ed2 Rick Pratt
	@test -r ${CLICK_UL_M_O} || \
218 537fe96d Rick Pratt
		( cd ${CLICK_BLD} ; \
219 62a58ed2 Rick Pratt
		  ./configure --disable-linuxmodule --enable-local ; \
220
		  make elemlist ; \
221
		  sed -i.${UL_M_O} \
222 0a4d4011 Rick Pratt
			-e '/^LIBS = /s/$$/ -lssl -lcrypto -lsystemd -lresolv /' \
223 870f095e Rick Pratt
			-e 's/CXXFLAGS = -g -O2 -W -Wall/CXXFLAGS = -g -O2 -W -Wall -fno-strict-aliasing/' \
224 62a58ed2 Rick Pratt
				userlevel/Makefile )
225 91aeb581 Rick Pratt
	@touch configure_userlevel2
226 62a58ed2 Rick Pratt
227 91aeb581 Rick Pratt
unconfigure_userlevel2:
228 62a58ed2 Rick Pratt
	@test ! -e configure_userlevel || \
229
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
230
	@test ! -e configure_linuxmodule || \
231
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
232 1e57c114 Rick Pratt
	@if [ -d ${GDP_BLD} ]; \
233
	then \
234
		echo "Remove ${GDP_BLD}..." ; \
235
		rm -rf ${GDP_BLD} ; \
236
	else \
237
		echo "${GDP_BLD} not found" ; \
238
	fi
239 537fe96d Rick Pratt
	@if [ -d ${CLICK_BLD} ]; \
240 e2a8d6d7 Rick Pratt
	then \
241 537fe96d Rick Pratt
		echo "Remove ${CLICK_BLD}..." ; \
242
		rm -rf ${CLICK_BLD} ; \
243 e2a8d6d7 Rick Pratt
	else \
244 537fe96d Rick Pratt
		echo "${CLICK_BLD} not found" ; \
245 e2a8d6d7 Rick Pratt
	fi
246 91aeb581 Rick Pratt
	@rm -f configure_userlevel2
247 62a58ed2 Rick Pratt
248 91aeb581 Rick Pratt
gdp-router-click2: configure_userlevel2 src/*.hh src/*.cc
249 62a58ed2 Rick Pratt
	@test ! -e configure_userlevel || \
250
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
251
	@test ! -e configure_linuxmodule || \
252
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
253 537fe96d Rick Pratt
	@echo "Refresh source hardlinks in ${CLICK_BLD} (required post git pull)"
254 5dbdffae Rick Pratt
	@ln -f src/gdp_v4_router.hh ${CLICK_ELEMS_LOCAL}/gdp_v4_router.hh
255
	@ln -f src/gdp_v4_router.cc ${CLICK_ELEMS_LOCAL}/gdp_v4_router.cc
256 d672d917 Rick Pratt
	@echo "/* autogenerated for gdp-router-click2 - do not edit */" > ${S_VERHH}
257
	@echo "#define STRINGIFY(_vs_) # _vs_" >> ${S_VERHH}
258
	@echo "const char *ver_major = { STRINGIFY(${VERSION}) };" >> ${S_VERHH}
259
	@echo ${VER_MAJOR}
260
	@echo -n "const char *git_branch = {\n\t STRINGIFY(" >> ${S_VERHH}
261
	@git rev-parse --abbrev-ref HEAD >> ${S_VERHH}
262
	@echo -n ")};\nconst char *git_hash = {\n\t STRINGIFY(" >> ${S_VERHH}
263
	@git log -n 1 --oneline --pretty=format:'%H%n' >> ${S_VERHH}
264
	@echo ")};" >> ${S_VERHH}
265
	@ln -f ${S_VERHH} ${CLICK_ELEMS_LOCAL}/${VERHH}
266 537fe96d Rick Pratt
	@( cd $(CLICK_BLD) && make )
267 62a58ed2 Rick Pratt
	@cp ${CLICK_UL_BINARY} $@
268
269 91aeb581 Rick Pratt
install2: gdp-router-click2
270
	@test ! -e configure_userlevel || \
271
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
272
	@test ! -e configure_linuxmodule || \
273 534c81a9 Rick Pratt
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
274 65f704ba Rick Pratt
	cp -p ./gdp-router-click2 /usr/sbin/gdp-router-click2
275
	chmod 755 /usr/sbin/gdp-router-click2
276
	chown gdp:gdp /usr/sbin/gdp-router-click2
277 91aeb581 Rick Pratt
278 65f704ba Rick Pratt
install-gdp-router-click2: gdp-router-click2
279
	@test ! -e configure_userlevel || \
280
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
281
	@test ! -e configure_linuxmodule || \
282
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
283
	./adm/setup-gdp-router-click2.sh
284
	cp -p ./gdp-router-click2 /usr/sbin/gdp-router-click2
285
	chmod 755 /usr/sbin/gdp-router-click2
286
	chown gdp:gdp /usr/sbin/gdp-router-click2
287 cb04269b Rick Pratt
288 f687a636 Rick Pratt
docker2: gdp-router-click2
289
	@cp -p ./gdp-router-click2 ./docker.gdp_router_click2/
290
	@( cd ./docker.gdp_router_click2/ && docker build -t gdp_router_click2 . )
291
292 91aeb581 Rick Pratt
stop2:
293 534c81a9 Rick Pratt
	@test ! -e configure_userlevel || \
294
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
295
	@test ! -e configure_linuxmodule || \
296
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
297 65f704ba Rick Pratt
	systemctl stop gdplogd2
298
	systemctl stop gdp-router-click2
299 91aeb581 Rick Pratt
300
start2:
301 534c81a9 Rick Pratt
	@test ! -e configure_userlevel || \
302
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
303
	@test ! -e configure_linuxmodule || \
304
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
305 65f704ba Rick Pratt
	systemctl start gdp-router-click2
306
	systemctl start gdplogd2
307 91aeb581 Rick Pratt
308
reinstall2: gdp-router-click2
309
	@test ! -e configure_userlevel || \
310
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
311
	@test ! -e configure_linuxmodule || \
312 534c81a9 Rick Pratt
		{ echo "WARN: detected linuxmodule config, command ignored."; exit 1; }
313 65f704ba Rick Pratt
	systemctl stop gdplogd2
314
	systemctl stop gdp-router-click2
315
	cp -p ./gdp-router-click2 /usr/sbin/gdp-router-click2
316
	chmod 755 /usr/sbin/gdp-router-click2
317
	chown gdp:gdp /usr/sbin/gdp-router-click2
318
	systemctl start gdp-router-click2
319
	systemctl start gdplogd2
320 91aeb581 Rick Pratt
321 62a58ed2 Rick Pratt
#
322 e2404776 Rick Pratt
# (non-default) set up a linuxmodule workspace
323
#
324
325 00b517f3 Rick Pratt
.PHONY: unconfigure_linuxmodule lm_install lm_clean
326 e2404776 Rick Pratt
327
/usr/src/linux-headers-${UNAME_R}:
328
	@echo "Installing linux-headers-${UNAME_R}"
329 65f704ba Rick Pratt
	@apt install linux-headers-${UNAME_R}
330 e2404776 Rick Pratt
331
${CLICK_LM_PATCH}: ${GDP_LM_PATCH}
332
	@echo "Applying ${GDP_LM_PATCH}"
333
	@cp -pf ${GDP_LM_PATCH} ${CLICK_LM_PATCH}
334 537fe96d Rick Pratt
	@( cd ${CLICK_BLD} ; git apply ${CLICK_LM_PATCH} )
335 e2404776 Rick Pratt
336 537fe96d Rick Pratt
configure_linuxmodule: ${CLICK_BLD} \
337 e2404776 Rick Pratt
						/usr/src/linux-headers-${UNAME_R} \
338
						${CLICK_LM_PATCH}
339
	@test ! -e configure_userlevel || \
340
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
341 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
342
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
343 e2404776 Rick Pratt
	@echo "Configuring linuxmodule workspace"
344 537fe96d Rick Pratt
	@( cd ${CLICK_BLD} ; \
345 65f704ba Rick Pratt
		  ./configure --disable-userlevel \
346 e2404776 Rick Pratt
				--enable-linuxmodule --enable-multithread \
347
				--with-linux=/usr/src/linux-headers-${UNAME_R} \
348
				--with-linux-map=/boot/System.map-${UNAME_R} ; \
349 65f704ba Rick Pratt
		  make elemlist ; )
350 e2404776 Rick Pratt
	@touch configure_linuxmodule
351
352
unconfigure_linuxmodule: lm_clean
353
	@test ! -e configure_userlevel || \
354
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
355 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
356
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
357 e2404776 Rick Pratt
	@echo "Unconfiguring linuxmodule workspace"
358
	@test ! -r ${CLICK_LM_PATCH} || \
359 537fe96d Rick Pratt
		( cd ${CLICK_BLD} && git apply --reverse ${CLICK_LM_PATCH} )
360 65f704ba Rick Pratt
	@rm -f ${CLICK_LM_PATCH}
361
	@test ! -r ${CLICK_M} || rm -f ${CLICK_M}
362 e2404776 Rick Pratt
	@rm -f configure_linuxmodule
363
364 00b517f3 Rick Pratt
lm: configure_linuxmodule src/*.hh src/*.cc
365 e2404776 Rick Pratt
	@test ! -e configure_userlevel || \
366
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
367 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
368
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
369 e2404776 Rick Pratt
	@echo "Updating Click kernel loadable modules"
370 537fe96d Rick Pratt
	@( cd $(CLICK_BLD) && make )
371 00b517f3 Rick Pratt
	@touch lm
372 e2404776 Rick Pratt
373
lm_install: lm
374
	@test ! -e configure_userlevel || \
375
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
376 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
377
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
378 537fe96d Rick Pratt
	@( cd $(CLICK_BLD) && make install )
379 e2404776 Rick Pratt
380
lm_clean:
381
	@test ! -e configure_userlevel || \
382
		{ echo "WARN: detected userlevel config, command ignored."; exit 1; }
383 534c81a9 Rick Pratt
	@test ! -e configure_userlevel2 || \
384
		{ echo "WARN: detected userlevel2 config, command ignored."; exit 1; }
385 537fe96d Rick Pratt
	@test ! -r ${CLICK_M} || ( cd $(CLICK_BLD) && make clean )
386 00b517f3 Rick Pratt
	@rm -f lm
387 e2404776 Rick Pratt
388
#
389
# manual targets
390
#
391
392
# if desired, run manually after ensuring pandoc is available
393 239fe014 Rick Pratt
README.html: README.md
394
	pandoc -sS -o $@ $<