File: Makefile.local

package info (click to toggle)
marionnet 0.90.6+bzr508-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,532 kB
  • sloc: ml: 18,130; sh: 5,384; xml: 1,152; makefile: 1,003; ansic: 275
file content (243 lines) | stat: -rw-r--r-- 8,355 bytes parent folder | download
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# This -*- makefile -*- is part of Marionnet, a virtual network laboratory
# Copyright (C) 2008, 2009  Luca Saiu
# Copyright (C) 2010, 2013  Jean-Vincent Loddo
# Copyright (C) 2008, 2009, 2010, 2013  Université Paris 13
# Updated in 2008 by Marco Stronati

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

OCAMLBUILD_OPTIONS= -quiet -X uml
COMPILE_OPTIONS += -g -w x
DIRECTORIES_TO_INCLUDE = camlp4 threads lablgtk2 lablglade lablgtksourceview2 ocamlbricks
LIBRARIES_TO_LINK = unix threads str lablgtk lablglade lablgtksourceview2 ocamlbricks
C_OBJECTS_TO_LINK +=
EXCLUDE_FROM_SOURCE_FINDING=uml

OCAMLBRICKS=$(OCAML_LIBRARYPREFIX)/ocamlbricks

# Transmit the information about the compiler version in order to activate conditional compilation:
# Empty for OCaml 3.x.y series, set to "-DOCAML4_02_OR_LATER" for 4.02.y or later:  
OCAML4_02_OR_LATER=$(shell if grep -q "^\([5-9]\)\|\(4[.]\([1-9]\|0[2-9]\)\)" <<<"$(OCAML_VERSION)"; then echo "-DOCAML4_02_OR_LATER"; fi)

# Empty for OCaml 3.x.y series, set to "-DOCAML4_04_OR_LATER" for 4.04.y or later:  
OCAML4_04_OR_LATER=$(shell if grep -q "^\([5-9]\)\|\(4[.]\([1-9]\|0[4-9]\)\)" <<<"$(OCAML_VERSION)"; then echo "-DOCAML4_04_OR_LATER"; fi)

PP_OPTION = camlp4of $(OCAML4_02_OR_LATER) $(OCAML4_04_OR_LATER) -I $(OCAMLBRICKS) gettext_extract_pot_p4.cmo option_extract_p4.cmo raise_p4.cmo log_module_loading_p4.cmo

OBJECTS_TO_LINK = gtkThread
BYTE_PROGRAMS = marionnet.byte
ROOT_BYTE_PROGRAMS = marionnet-daemon.byte

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
BYTE_LIBRARY_NAME = marionnet.cma

native: marionnet.native marionnet-daemon.native
byte: marionnet.byte marionnet-daemon.byte

# To do: these should be enabled for release, but they take too long to
# build every time...
NATIVE_PROGRAMS = marionnet.native
ROOT_NATIVE_PROGRAMS = marionnet-daemon.native

ROOT_PROGRAMS = marionnet-daemon.byte marionnet-daemon.native
OTHER_PROGRAMS_TO_INSTALL = scripts/marionnet_telnet.sh

# menu_factory.ml menu_factory.mli are not documented because they
# get ocamldoc (with -pp camlp4of) confused
UNDOCUMENTED=version.ml gui.ml

# Before building the main targets we have to create the machine-generated
# sources:
MANUALLY_PRE_COPY_IN_build =     \
  gettext_extract_pot_p4.conf    \
  scripts/can-directory-host-sparse-files.sh

MANUALLY_PRE_MAKE_IN_build =
MANUALLY_POST_MAKE_IN_build = 

marionnet.byte marionnet.native : manually_pre_actions version.ml gui.ml

compile_for_testing:
	@if grep -q "DDOCUMENTATION_OR_DEBUGGING" $(LOGFILE); then echo "Fine, already compiled for testing."; else make clean; fi; \
	make PP_OPTION="$(PP_OPTION) -DDOCUMENTATION_OR_DEBUGGING"

########## Manually generated targets (not through ocamlbuild)

run: marionnet.byte
	(export WORKING=`pwd`; OCAMLRUNPARAM="b" $$WORKING/_build/marionnet.byte) | tee /tmp/LOG

runexam: marionnet.byte
	(export WORKING=`pwd`; OCAMLRUNPARAM="b" $$WORKING/_build/marionnet.byte --exam) | tee /tmp/LOG

runopt: marionnet.native
	(export WORKING=`pwd`; $$WORKING/_build/marionnet.native) | tee /tmp/LOG

run-daemon: marionnet-daemon.byte
	sudo _build/marionnet-daemon.byte

# version.ml is automatically generated:
version.ml: VERSION BUILD-TIME
	@(echo -e "(* This file is automatically generated. Please don't edit it. *)" > $@; \
	echo -e "" >> $@; \
	echo -en "let version = \"" >> $@; \
	for x in `cat VERSION`; do echo -n "$$x" >> $@; done; \
	echo -e "\";;" >> $@; \
	echo -en "let build_time = \"" >> $@; \
	for x in `cat BUILD-TIME`; do echo -n "$$x " >> $@; done; \
	echo -e "\";;" >> $@)

VERSION: META
	@($(call READ_META, name, version); \
	echo "$$version" > $@)

BUILD-TIME:
	@(echo 'built in '`date +"%B %Y"` > $@)

# We need to patch the file generated by Glade, so that image pathnames
# follow our conventions:
share/gui.glade.patched: gui/gui.xml
	@(cat gui/gui.xml | \
	sed s/name=\"pixbuf\"\>/name=\"pixbuf\"\>images\\//g | \
	sed s/name=\"icon\"\>/name=\"icon\"\>images\\//g > $@)

# This is the name of the Glade->OCaml code generator:
GLADE2ML = lablgladecc2

# gui.ml is automatically generated from the patched Glade file:
gui.ml: share/gui.glade.patched
	@(cd share; $(GLADE2ML) gui.glade.patched > ../$@)

gui-help: gui.ml
	ocamlc -i -I +lablgtk2 lablgtk.cma gui.ml | grep -v "val" | grep -v "[0-9]"

# Clean all the automatically-generated sources:
clean-local: clean-mo clean-doc
	@(rm -f VERSION BUILD-TIME version.ml; \
	rm -f share/gui.glade.patched gui.ml)

# ==============gettext stuff=============

install-data-local: copy-failsafe-marionnet.conf
install-local: install-mo
uninstall-local: uninstall-mo

copy-failsafe-marionnet.conf:
	cp etc/marionnet.conf share/

_build/marionnet.pot: marionnet.byte
	@msgcat -s --use-first $(shell find _build/ -name "*.ml.pot") > $@

pot: _build/marionnet.pot
	cp _build/marionnet.pot po/messages.pot

main-local: pot

# Useful to discover widgets containing translatable strings
gui.po: gui/gui.xml
	xml2po $< > /tmp/$@
	@echo "Generated file: /tmp/$@"

# We can take the list of supported languages from po/LINGUAS.
# Notice that this macro is always invoked from the po/ subdirectory:
LANGUAGES = $$( grep -v ^\#.*$$ LINGUAS )

compile-mo:
	@(cd po/; \
	for i in $(call LANGUAGES); \
	do (msgfmt $$i.po && mv messages.mo $$i.mo || exit -1) && \
	echo "Compiled "$$i.mo; \
	done;)

update-po: pot
	@(cd po/; \
	for i in $(call LANGUAGES); \
	do (msgmerge --no-fuzzy-matching -s --update $$i.po messages.pot || exit -1) && \
	echo "Updated "$$i.po; \
	done;)

install-mo: CONFIGME compile-mo
	@($(call READ_CONFIG,localeprefix); \
	cd po/; \
	for i in $(call LANGUAGES); \
	do ((mkdir -p $$localeprefix/$$i/LC_MESSAGES && cp $$i.mo $$localeprefix/$$i/LC_MESSAGES/marionnet.mo) || exit -1) && \
	echo "Installed "$$i; \
	done;)

clean-mo:
	@(cd po/; \
	rm -rf *.mo *~ ;)

uninstall-mo: CONFIGME
	@($(call READ_CONFIG,localeprefix); \
	for i in $(call LANGUAGES); \
	do rm -f $$localeprefix/$$i/LC_MESSAGES/marionnet.mo; \
	echo "Uninstalled "$$i; \
	done;)

######### documentation ##############

#build texinfo developer documentation in one default format
documentation-local: documentation-html-no-split

#build texinfo developer documentation in one all formats
documentation-all: documentation-pdf documentation-html-split documentation-html-no-split

#multi page html output
#the makeinfo command need to be executed in the same directory as img, otherwise it doesn't find any image
documentation-html-split:
	@(cd doc-src; \
	  makeinfo --html --force --no-validate \
	   documentation.texi -o ../doc/documentation/; \
	  cp -r img/ ../doc/documentation/; \
	  cd ..;)

#one page html output
documentation-html-no-split:
	@(cd doc-src; \
	  makeinfo --html --force --no-validate --no-split \
           documentation.texi -o ../doc/documentation.html; \
	  cp -r img/ ../doc/; \
	  cd ..;)

#pdf output
documentation-pdf:
	@(cd doc-src; \
	  texi2dvi --pdf -E --build=local \
	   documentation.texi -o ../doc/documentation.pdf; \
	  rm -f documentation.aux documentation.cp documentation.cps \
	        documentation.fn documentation.ky documentation.log  \
		documentation.pg documentation.toc documentation.tp  \
		documentation.vr;)

clean-doc:
	@(rm -rf doc/* )

#convert and resize images from ps and eps to png
images: dot
	@(mkdir doc/img; \
	  cp doc-src/img/*.png doc/img/; \
	  for i in $$(ls doc-src/img-src/*{ps,eps}); \
          do convert $$i doc/img/$$(basename $${i%.*}.png); \
          done)


# #compile dot sources
dot:
	@(for i in $$(ls doc-src/img-src/*.dot); \
	do dot -Tsvg $$i -o doc-src/img-src/$$(basename $$i .dot).svg; \
           convert -geometry 300x300 -density 150 -antialias doc-src/img-src/$$(basename $$i .dot).svg \
           doc-src/img/$$(basename $$i .dot).png; \
        done; \
        #rm doc-src/img-src/*.svg \
        )