Makefile 25.2 KB
Newer Older
Florian Lugou's avatar
Florian Lugou committed
1 2
export JAVAC  		= javac
export JAR    		= jar
3
JAVA			= java
Florian Lugou's avatar
Florian Lugou committed
4 5 6 7
JAVADOC			= javadoc
MAKE			= make -s
TAR			= tar
GZIP			= gzip
8 9
GRADLE_NO_TEST          = -x test 
GRADLE_OPTIONS          = --parallel
apvrille's avatar
apvrille committed
10
#GRADLE_OPTIONS          =
apvrille's avatar
apvrille committed
11
GRADLE			= $(shell which gradle)
12
GRADLE_VERSION_NEEDED	= 3.3
13
ERROR_MSG		= printf "$(COLOR)\nBuild with gradle failed. Falling back to regular javac command...\n$(RESET)"
14

15
ifeq "$(GRADLE)" ""
16
    ERROR_MSG	= echo "Gradle was not found. Falling back to regular javac command...\n"
17 18
    GRADLE 	= false && echo >/dev/null
else
19
    GRADLE_VERSION 	:= $(shell $(GRADLE) --version | grep "^Gradle" | awk '{print $$2}')
20
    GRADLE_VERSION_MIN 	:= $(shell printf "%s\n%s\n" "$(GRADLE_VERSION_NEEDED)" "$(GRADLE_VERSION)"|sort -n 2>/dev/null|head -n1)
21 22
    ifneq "$(GRADLE_VERSION_NEEDED)" "$(GRADLE_VERSION_MIN)"
	ERROR_MSG	= echo "$(COLOR)Gradle $(GRADLE_VERSION) is too old. Needs at least $(GRADLE_VERSION_NEEDED). Falling back to regular javac command...\n$(RESET)"
23 24 25
	GRADLE = false && echo >/dev/null
    endif
endif
26 27 28 29

export COLOR		= $(shell tput setaf 1)
export RESET		= $(shell tput sgr0)
PREFIX			= [$(COLOR)BASE$(RESET)]             
Ludovic Apvrille's avatar
Ludovic Apvrille committed
30

Florian Lugou's avatar
Florian Lugou committed
31
export TTOOL_PATH 	:= $(shell /bin/pwd)
32 33

define HELP_message
34 35 36
Compilation targets:
--------------------
make all                Build TTool and the jar of companion software.
37 38
make ttool		Build TTool only

39 40

Usual targets:
41 42 43 44 45 46 47 48
--------------
make (help)             Print this help.
make documentation      Generate the documentation of java classes using javadoc.
make release            Prepare a new release for the website.
			It produces the release.tgz and releaseWithSrc.tgz files.
make test               Run tests on TTool.
make publish_jar        Build TTool and upload the resulting archive.
			!!! Must have the right ssh key installed for this !!!
49 50 51
make install		Install TTool, the jar of companion software and the runtime
			dependencies to $$DESTDIR/bin. By default, install to
			$(TTOOL_PATH)/bin.
52 53
make clean              Clean the repository from compilation artifacts.
make ultraclean         Clean the repository from binaries and compilation artifacts.
54

55
make ttooljavac		Build TTool only with javac
56
make ttoolnotest	Build TTool with gradle, but do not execute test. Performs the install
57
make allnotest		Builld all apps, but do not execute tests. Performs the install
apvrille's avatar
apvrille committed
58
make internalhelp		Generate the help of TTool in HTML format
59 60


61 62
Other targets:
--------------
63
make preinstall		Generate a preinstall version of TTool for Linux, Windows and
64
			MacOS and publish them on the website of TTool (hidden link)
65 66
			!!! Must have the right ssh key installed for this !!!
make git		Update the build number.
67 68 69


Please report bugs or suggestions of improvements to:
apvrille's avatar
apvrille committed
70
  ttool.telecom-paristech.fr/support.html
71 72 73
endef
export HELP_message

74
.PHONY: ttool clean launcher graphminimize graphshow tiftranslator tmltranslator rundse remotesimulator webcrawler documentation help ultraclean publish_jar preinstall test git
75 76 77 78

help:
	@echo "$$HELP_message"

Florian Lugou's avatar
Florian Lugou committed
79
FORCE:
80

Florian Lugou's avatar
Florian Lugou committed
81 82 83 84
# ======================================== 
# ========== SUB-PROJECTS BUILD ========== 
# ======================================== 
export TTOOL_SRC 		= $(TTOOL_PATH)/src/main/java
Florian Lugou's avatar
Florian Lugou committed
85
export GLOBAL_JAVA		= $(shell cd $(TTOOL_SRC); find . -name "[^.]*.java")
Florian Lugou's avatar
Florian Lugou committed
86 87
export TTOOL_RESOURCES		= $(TTOOL_PATH)/src/main/resources
export TTOOL_WEBCRAWLER_SRC 	= $(TTOOL_PATH)/src/main/java/web/crawler
88
export TTOOL_BUILD		= $(TTOOL_PATH)/build
Florian Lugou's avatar
Florian Lugou committed
89 90 91
export TTOOL_LIBS		= $(TTOOL_PATH)/libs
export TTOOL_LIBRARIES		= $(wildcard $(TTOOL_LIBS)/*.jar)
export TTOOL_CLASSPATH		= $(subst $(eval) ,:,$(TTOOL_LIBRARIES))
92

93
export GLOBAL_CFLAGS		= -encoding "UTF8" -Xlint:unchecked -Xlint:deprecation -Xlint:cast -Xlint:divzero -Xlint:empty -Xlint:finally -Xlint:fallthrough
94

Florian Lugou's avatar
Florian Lugou committed
95
export TTOOL_DIR		= $(TTOOL_PATH)/ttool
96
export TTOOL_BINARY 		= $(TTOOL_BUILD)/ttool.jar
97

Florian Lugou's avatar
Florian Lugou committed
98
export LAUNCHER_DIR		= $(TTOOL_PATH)/launcher
99
export LAUNCHER_BINARY 		= $(TTOOL_BUILD)/launcher.jar
100

101 102 103
export TTOOLCLI_DIR	= $(TTOOL_PATH)/ttool-cli
export TTOOLCLI_BINARY 	= $(TTOOL_BUILD)/ttool-cli.jar

Florian Lugou's avatar
Florian Lugou committed
104
export GRAPHMINIMIZE_DIR	= $(TTOOL_PATH)/graphminimize
105
export GRAPHMINIMIZE_BINARY 	= $(TTOOL_BUILD)/graphminimize.jar
106

Florian Lugou's avatar
Florian Lugou committed
107
export GRAPHSHOW_DIR		= $(TTOOL_PATH)/graphshow
108
export GRAPHSHOW_BINARY 	= $(TTOOL_BUILD)/graphshow.jar
109

Florian Lugou's avatar
Florian Lugou committed
110
export TIFTRANSLATOR_DIR	= $(TTOOL_PATH)/tiftranslator
111
export TIFTRANSLATOR_BINARY 	= $(TTOOL_BUILD)/tiftranslator.jar
112

Florian Lugou's avatar
Florian Lugou committed
113
export TMLTRANSLATOR_DIR	= $(TTOOL_PATH)/tmltranslator
114
export TMLTRANSLATOR_BINARY 	= $(TTOOL_BUILD)/tmltranslator.jar
Ludovic Apvrille's avatar
Ludovic Apvrille committed
115

Florian Lugou's avatar
Florian Lugou committed
116
export RUNDSE_DIR		= $(TTOOL_PATH)/rundse
117
export RUNDSE_BINARY 		= $(TTOOL_BUILD)/rundse.jar
118

Florian Lugou's avatar
Florian Lugou committed
119
export REMOTESIMULATOR_DIR	= $(TTOOL_PATH)/simulationcontrol
120
export REMOTESIMULATOR_BINARY 	= $(TTOOL_BUILD)/simulationcontrol.jar
121

Florian Lugou's avatar
Florian Lugou committed
122
export WEBCRAWLER_CLIENT_DIR	= $(TTOOL_PATH)/webcrawler/client
123
export WEBCRAWLER_CLIENT_BINARY	= $(TTOOL_BUILD)/webcrawler-client.jar
124

Florian Lugou's avatar
Florian Lugou committed
125
export WEBCRAWLER_SERVER_DIR	= $(TTOOL_PATH)/webcrawler/server
126
export WEBCRAWLER_SERVER_BINARY	= $(TTOOL_BUILD)/webcrawler-server.jar
127

Florian Lugou's avatar
Florian Lugou committed
128
export JTTOOL_DIR		= $(TTOOL_PATH)/jttool
129
export JTTOOL_BINARY		= $(TTOOL_BUILD)/jttool.jar
130

131 132 133 134
export TTOOL_HELP_DIR	= $(TTOOL_PATH)/src/main/resources/help
MD_FILES=$(wildcard src/main/resources/help/*.md)	
MD2HTML=$(MD_FILES:.md=.html)

135 136 137 138
all: ttool launcher ttool-cli graphminimize graphshow tiftranslator tmltranslator rundse remotesimulator webcrawler install

allnotest: GRADLE_OPTIONS += $(GRADLE_NO_TEST)
allnotest: ttool launcher ttool-cli graphminimize graphshow tiftranslator tmltranslator rundse remotesimulator webcrawler install
139

140 141 142
ttoolnotest: GRADLE_OPTIONS += $(GRADLE_NO_TEST)
ttoolnotest: ttool install

Florian Lugou's avatar
Florian Lugou committed
143
ttool: $(TTOOL_BINARY)
144
ttoolnotest: 
145

Florian Lugou's avatar
Florian Lugou committed
146
$(TTOOL_BINARY): FORCE
147
	@($(GRADLE) :ttool:build $(GRADLE_OPTIONS)) || ($(ERROR_MSG) $(GRADLE_VERSION) $(GRADLE_VERSION_NEEDED)&& $(MAKE) -C $(TTOOL_DIR) -e $@)
148

149
ttooljavac: 
150
	$(MAKE) -C $(TTOOL_DIR)
Ludovic Apvrille's avatar
Ludovic Apvrille committed
151
	$(MAKE) -C $(TTOOLCLI_DIR)
152

Florian Lugou's avatar
Florian Lugou committed
153
launcher: $(LAUNCHER_BINARY)
154

Florian Lugou's avatar
Florian Lugou committed
155
$(LAUNCHER_BINARY): FORCE
156
	@($(GRADLE) :launcher:build) || ($(ERROR_MSG) && $(MAKE) -C $(LAUNCHER_DIR) -e $@)
157

158 159 160
ttool-cli: $(TTOOLCLI_BINARY)

$(TTOOLCLI_BINARY): FORCE
161
	@($(GRADLE) :ttool-cli:build $(GRADLE_OPTIONS)) || ($(ERROR_MSG) && $(MAKE) -C $(TTOOLCLI_DIR) -e $@)
162

Florian Lugou's avatar
Florian Lugou committed
163
graphminimize: $(GRAPHMINIMIZE_BINARY)
164

Florian Lugou's avatar
Florian Lugou committed
165
$(GRAPHMINIMIZE_BINARY): FORCE
166
	@($(GRADLE) :graphminimize:build) || ($(ERROR_MSG) && $(MAKE) -C $(GRAPHMINIMIZE_DIR) -e $@)
167

Florian Lugou's avatar
Florian Lugou committed
168
graphshow: $(GRAPHSHOW_BINARY)
169

Florian Lugou's avatar
Florian Lugou committed
170
$(GRAPHSHOW_BINARY): FORCE
171
	@($(GRADLE) :graphshow:build) || ($(ERROR_MSG) && $(MAKE) -C $(GRAPHSHOW_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
172 173 174 175

tiftranslator: $(TIFTRANSLATOR_BINARY)

$(TIFTRANSLATOR_BINARY): FORCE
176
	@($(GRADLE) :tiftranslator:build) || ($(ERROR_MSG) && $(MAKE) -C $(TIFTRANSLATOR_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
177 178 179 180

tmltranslator: $(TMLTRANSLATOR_BINARY)

$(TMLTRANSLATOR_BINARY): FORCE
181
	@($(GRADLE) :tmltranslator:build) || ($(ERROR_MSG) && $(MAKE) -C $(TMLTRANSLATOR_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
182 183 184 185

rundse: $(RUNDSE_BINARY)

$(RUNDSE_BINARY): FORCE
186
	@($(GRADLE) :rundse:build) || ($(ERROR_MSG) && $(MAKE) -C $(RUNDSE_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
187 188 189 190

remotesimulator: $(REMOTESIMULATOR_BINARY)

$(REMOTESIMULATOR_BINARY): FORCE
191
	@($(GRADLE) :simulationcontrol:build) || ($(ERROR_MSG) && $(MAKE) -C $(REMOTESIMULATOR_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
192 193 194 195

webcrawler: $(WEBCRAWLER_CLIENT_BINARY) $(WEBCRAWLER_SERVER_BINARY)

$(WEBCRAWLER_CLIENT_BINARY): FORCE
196
	@($(GRADLE) :webcrawler-client:build) || ($(ERROR_MSG) && $(MAKE) -C $(WEBCRAWLER_CLIENT_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
197 198

$(WEBCRAWLER_SERVER_BINARY): FORCE
199
	@($(GRADLE) :webcrawler-server:build) || ($(ERROR_MSG) && $(MAKE) -C $(WEBCRAWLER_SERVER_DIR) -e $@)
Florian Lugou's avatar
Florian Lugou committed
200 201 202 203

$(JTTOOL_BINARY): FORCE
	@$(MAKE) -C $(JTTOOL_DIR) -e $@

apvrille's avatar
apvrille committed
204
internalhelp: html
205 206 207 208

html: $(MD2HTML)

%.html: %.md
209
	pandoc $< -f markdown -t html -s -o  $@ --lua-filter=doc/ttoolfilter.lua --metadata pagetitle="TTool help"
210

Florian Lugou's avatar
Florian Lugou committed
211 212 213 214 215 216
# ======================================== 
# ==========    DOCUMENTATION   ========== 
# ======================================== 
TTOOL_DOC			= $(TTOOL_PATH)/doc
export TTOOL_DOC_HTML 		= $(TTOOL_DOC)/html

217
DOCFLAGS			= -encoding "UTF8" -quiet -J-Xmx256m -classpath $(TTOOL_CLASSPATH) -d $(TTOOL_DOC_HTML)
Florian Lugou's avatar
Florian Lugou committed
218 219 220 221 222 223 224 225 226

documentation: $(patsubst %,$(TTOOL_SRC)/%,$(GLOBAL_JAVA))
	@echo "$(PREFIX) Generating Javadoc"
	@$(JAVADOC) $(DOCFLAGS) $^

# ======================================== 
# ==========      RELEASES      ========== 
# ======================================== 
TTOOL_PRIVATE 			?= $(TTOOL_PATH)/../TTool-Private
227 228
TTOOL_PRIVATE_RELEASES 			?= $(TTOOL_PRIVATE)/website/ttool/releases

Florian Lugou's avatar
Florian Lugou committed
229 230 231 232 233

PROD_USERNAME			= apvrille
PROD_ADDRESS			= ssh.enst.fr
PROD_PATH			= public_html/docs

234
TTOOL_DOC_SYSMLSEC_DIR		 	= $(TTOOL_DOC)/SysMLSec
235
TTOOL_DOC_AVATARCODEGENERATION_DIR 	= $(TTOOL_DOC)/codegeneration
236
TTOOL_DOC_SOCLIB_USERGUIDE_DIR 		= $(TTOOL_DOC)/documents_soclib/USER_GUIDE
237
TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR 	= $(TTOOL_DOC)/documents_soclib/INSTALLATION_GUIDE
238

Florian Lugou's avatar
Florian Lugou committed
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
TTOOL_MODELING			= $(TTOOL_PATH)/modeling
TTOOL_SIMULATORS 		= $(TTOOL_PATH)/simulators
TTOOL_FIGURES 			= $(TTOOL_PATH)/figures
TTOOL_EXECUTABLECODE 		= $(TTOOL_PATH)/executablecode
TTOOL_MPSOC 			= $(TTOOL_PATH)/MPSoC
TTOOL_STD_RELEASE 		= $(TTOOL_PATH)/release
TTOOL_TARGET_RELEASE 		= $(TTOOL_PATH)/TTool_install
TTOOL_TARGET 			= $(TTOOL_TARGET_RELEASE)/TTool
TTOOL_TARGET_WINDOWS		= $(TTOOL_TARGET_RELEASE)/Windows
TTOOL_TARGET_MACOS		= $(TTOOL_TARGET_RELEASE)/MacOS
TTOOL_TARGET_LINUX		= $(TTOOL_TARGET_RELEASE)/Linux

BASERELEASE			= $(TTOOL_STD_RELEASE)/baseRelease.tar
STDRELEASE			= $(TTOOL_STD_RELEASE)/release.tgz
ADVANCED_RELEASE		= $(TTOOL_STD_RELEASE)/releaseWithSrc.tgz
TTOOL_PREINSTALL_LINUX 		= $(TTOOL_STD_RELEASE)/ttoollinux.tgz
TTOOL_PREINSTALL_WINDOWS 	= $(TTOOL_STD_RELEASE)/ttoolwindows.tgz
TTOOL_PREINSTALL_MACOS 		= $(TTOOL_STD_RELEASE)/ttoolmacos.tgz

258 259 260 261
BUILDER			= $(TTOOL_PATH)/builder.jar
BUILD_INFO		= build.txt
BUILD_TO_MODIFY		= $(TTOOL_SRC)/ui/util/DefaultText.java

262
TTOOL_LOTOS_H		= $(patsubst $(TTOOL_DIR)/runtime/%,$(TTOOL_BUILD)/%,$(wildcard $(TTOOL_DIR)/runtime/spec*))
Florian Lugou's avatar
Florian Lugou committed
263 264 265 266 267 268 269 270 271 272 273 274 275

RELEASE_STD_FILES_XML 	= $(patsubst %,$(TTOOL_MODELING)/%,\
			  TURTLE/manual-HW.xml \
			  TURTLE/WebV01.xml \
			  TURTLE/Protocol_example1.xml \
			  TURTLE/BasicExchange.xml \
			  DIPLODOCUS/SmartCardProtocol.xml \
			  TURTLE/ProtocolPatterns.xml \
			  AVATAR/CoffeeMachine_Avatar.xml \
			  AVATAR/Network_Avatar.xml \
			  AVATAR/MicroWaveOven_SafetySecurity_fullMethodo.xml)
RELEASE_STD_FILES_LIB 	= $(patsubst %,$(TTOOL_MODELING)/%,\
			  TURTLE/TClock1.lib \
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
                          DIPLODOCUS/CPlibrary/ConfigPollingDMA_SD.lib\
                          DIPLODOCUS/CPlibrary/ConfigureDMA_SD.lib\
                          DIPLODOCUS/CPlibrary/DMACycle_SD.lib\
                          DIPLODOCUS/CPlibrary/DMAPollingCycleP_AD.lib\
                          DIPLODOCUS/CPlibrary/DMATransfer_NoPolling_MainCP.lib\
                          DIPLODOCUS/CPlibrary/DMATransfer_Polling_MainCP.lib\
                          DIPLODOCUS/CPlibrary/DMATransferCycleP_AD.lib\
                          DIPLODOCUS/CPlibrary/DMATransferCycleP_SD.lib\
                          DIPLODOCUS/CPlibrary/EnableFlag_SD.lib\
                          DIPLODOCUS/CPlibrary/LoadCPU_LoadConfigureSD.lib\
                          DIPLODOCUS/CPlibrary/LoadCPU_LoadTransferCycleSD.lib\
                          DIPLODOCUS/CPlibrary/LoadCPU_mainCP.lib\
                          DIPLODOCUS/CPlibrary/PollingCycle_SD.lib\
                          DIPLODOCUS/CPlibrary/StoreCPU_mainCP.lib\
                          DIPLODOCUS/CPlibrary/StoreCPU_StoreConfigureSD.lib\
                          DIPLODOCUS/CPlibrary/StoreCPU_StoreTransferCycleSD.lib\
                          DIPLODOCUS/CPlibrary/TerminateDMA_SD.lib\
                          DIPLODOCUS/StoreCPU_StoreConfigureCycleSD.lib\
			  TURTLE/TTimerv01.lib) 
Florian Lugou's avatar
Florian Lugou committed
295 296 297 298 299 300 301 302 303 304 305 306 307
RELEASE_STD_FILES_LICENSES 	= $(patsubst %,$(TTOOL_DOC)/%,\
			     	  LICENSE \
				  LICENSE_CECILL_ENG \
				  LICENSE_CECILL_FR)
TTOOL_EXE 		= $(patsubst %,$(TTOOL_DOC)/%,\
			  ttool_linux.exe \
			  ttool_macosx.exe \
			  ttool_windows.bat)
TTOOL_CONFIG_SRC 	= $(patsubst %,$(TTOOL_DOC)/%,\
			  config_linux.xml \
			  config_macosx.xml \
			  config_windows.xml)

308 309
release: $(STDRELEASE)
#$(ADVANCED_RELEASE)
Florian Lugou's avatar
Florian Lugou committed
310 311 312 313 314 315 316

$(TTOOL_STD_RELEASE)/%.tgz: $(TTOOL_STD_RELEASE)/%.tar
	@$(GZIP) -c $< > $@

$(STDRELEASE:.tgz=.tar): $(BASERELEASE:.tgz=.tar)
	@echo "$(PREFIX) Generating standard release"
	@cp $< $@
Ludovic Apvrille's avatar
Ludovic Apvrille committed
317
# LOTOS
Florian Lugou's avatar
Florian Lugou committed
318 319
	@mkdir -p $(TTOOL_TARGET)/lotos
	@cp $(TTOOL_DOC)/README_lotos $(TTOOL_TARGET)/lotos
Ludovic Apvrille's avatar
Ludovic Apvrille committed
320
#NC
Florian Lugou's avatar
Florian Lugou committed
321 322 323 324 325 326 327 328 329
	@mkdir -p $(TTOOL_TARGET)/nc
	@cp $(TTOOL_DOC)/README_nc $(TTOOL_TARGET)/nc
# Figures
	@cp $(TTOOL_FIGURES)/Makefile $(TTOOL_TARGET)/figures
	@cp $(TTOOL_FIGURES)/mli.mk $(TTOOL_TARGET)/figures
# JTTool
	@mkdir -p $(TTOOL_TARGET)/java
	@cp $(JTTOOL_BINARY) $(TTOOL_TARGET)/java
	@cp $(TTOOL_DOC)/README_java $(TTOOL_TARGET)/java
Ludovic Apvrille's avatar
Ludovic Apvrille committed
330
# Basic bin
Florian Lugou's avatar
Florian Lugou committed
331
	@cp $(TTOOL_EXE) $(TTOOL_TARGET)/
332
	@cp $(TTOOL_CONFIG_SRC) $(TTOOL_TARGET)/bin
Florian Lugou's avatar
Florian Lugou committed
333
	@cp $(TTOOL_LOTOS_H) $(TTOOL_TARGET)/bin
334
	@$(TAR) uf $@ -C $(TTOOL_TARGET_RELEASE) TTool/lotos TTool/nc TTool/bin TTool/java TTool/figures TTool/doc/prototyping_with_soclib_installation_guide.pdf TTool/doc/prototyping_with_soclib_user_guide.pdf  $(patsubst $(TTOOL_DOC)/%,TTool/%,$(TTOOL_EXE))
Florian Lugou's avatar
Florian Lugou committed
335 336 337 338 339 340 341 342 343

$(ADVANCED_RELEASE:.tgz=.tar): $(STDRELEASE:.tgz=.tar) documentation
	@echo "$(PREFIX) Generating advanced release"
	@cp $< $@
	@cp -r $(TTOOL_DOC_HTML) $(TTOOL_TARGET)/doc/srcdoc
	@mkdir -p $(TTOOL_TARGET)/src
	@cp -R $(TTOOL_SRC)/* $(TTOOL_TARGET)/src
	@cp -r $(TTOOL_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(LAUNCHER_DIR)/src/main/java/* $(TTOOL_TARGET)/src
344
	@cp -r $(TTOOLCLI_DIR)/src/main/java/* $(TTOOL_TARGET)/src
Florian Lugou's avatar
Florian Lugou committed
345 346 347 348 349 350 351 352 353
	@cp -r $(GRAPHMINIMIZE_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(GRAPHSHOW_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(TIFTRANSLATOR_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(TMLTRANSLATOR_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(RUNDSE_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(REMOTESIMULATOR_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(WEBCRAWLER_CLIENT_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@cp -r $(WEBCRAWLER_SERVER_DIR)/src/main/java/* $(TTOOL_TARGET)/src
	@find $(TTOOL_TARGET)/src -type f -not \( -name '*.java' -o -name '*.gif' -o -name '*.jjt' -o -name '*.txt' \) -a -exec rm -f {} \;
354
	@cp $(TTOOL_DOC)/README_src $(TTOOL_TARGET)/src
Florian Lugou's avatar
Florian Lugou committed
355 356 357 358 359 360 361 362
	@$(TAR) uf $@ -C $(TTOOL_TARGET_RELEASE) TTool/doc/srcdoc TTool/src

$(TTOOL_PREINSTALL_WINDOWS:.tgz=.tar): $(BASERELEASE:.tgz=.tar)
	@echo "$(PREFIX) Generating preinstall for Windows"
	@cp $< $@
	@mkdir -p $(TTOOL_TARGET_WINDOWS)/TTool/bin
	@$(TAR) xzvf $(TTOOL_PRIVATE)/stocks/proverif_windows.tar.gz -C $(TTOOL_TARGET_WINDOWS)
	@$(TAR) xzvf $(TTOOL_PRIVATE)/stocks/uppaal.tar.gz -C $(TTOOL_TARGET_WINDOWS)
363 364
	@cp $(TTOOL_DOC)/config_windows.xml $(TTOOL_TARGET_WINDOWS)/TTool/bin/
	@sed 's#chdir .*#chdir TTool/bin#' $(TTOOL_DOC)/ttool_windows.bat > $(TTOOL_TARGET_WINDOWS)/ttool.bat
365
	@cp $(TTOOL_PATH)/build/*.jar $(TTOOL_TARGET_WINDOWS)/TTool/bin/
366
	@$(TAR) uf $@ -C $(TTOOL_TARGET_WINDOWS) proverif uppaal TTool/bin/config_windows.xml ttool.bat
Florian Lugou's avatar
Florian Lugou committed
367 368 369 370 371 372 373 374

$(TTOOL_PREINSTALL_MACOS:.tgz=.tar): $(BASERELEASE:.tgz=.tar)
	@echo "$(PREFIX) Generating preinstall for MacOS"
	@cp $< $@
	@mkdir -p $(TTOOL_TARGET_MACOS)/TTool/bin
	@$(TAR) xzf $(TTOOL_PRIVATE)/stocks/proverif_macos.tar.gz -C $(TTOOL_TARGET_MACOS)
	@$(TAR) xzf $(TTOOL_PRIVATE)/stocks/uppaal_macos.tar.gz -C $(TTOOL_TARGET_MACOS)
	@mv $(TTOOL_TARGET_MACOS)/uppaal* $(TTOOL_TARGET_MACOS)/uppaal
375 376
	@cp $(TTOOL_DOC)/config_macosx.xml $(TTOOL_TARGET_MACOS)/TTool/bin/config_macosx.xml
	@sed 's#cd [^;]*#cd TTool/bin#' $(TTOOL_DOC)/ttool_macosx.exe > $(TTOOL_TARGET_MACOS)/ttool.exe
377
	@chmod u+x $(TTOOL_TARGET_MACOS)/ttool.exe
378
	@cp $(TTOOL_PATH)/build/*.jar $(TTOOL_TARGET_MACOS)/TTool/bin/
379
	@$(TAR) uf $@ -C $(TTOOL_TARGET_MACOS) proverif uppaal TTool/bin/config_macosx.xml ttool.exe
Florian Lugou's avatar
Florian Lugou committed
380 381 382 383 384 385 386

$(TTOOL_PREINSTALL_LINUX:.tgz=.tar): $(BASERELEASE:.tgz=.tar)
	@echo "$(PREFIX) Generating preinstall for Linux"
	@cp $< $@
	@mkdir -p $(TTOOL_TARGET_LINUX)/TTool/bin
	@$(TAR) xzvf $(TTOOL_PRIVATE)/stocks/proverif_linux.tar.gz -C $(TTOOL_TARGET_LINUX)
	@$(TAR) xzvf $(TTOOL_PRIVATE)/stocks/uppaal.tar.gz -C $(TTOOL_TARGET_LINUX)
387 388
	@cp $(TTOOL_DOC)/config_linux.xml $(TTOOL_TARGET_LINUX)/TTool/bin/config_linux.xml
	@sed 's#cd [^;]*#cd TTool/bin#' $(TTOOL_DOC)/ttool_linux.exe > $(TTOOL_TARGET_LINUX)/ttool.exe
389
	@chmod u+x $(TTOOL_TARGET_LINUX)/ttool.exe
390
	@cp $(TTOOL_PATH)/build/*.jar $(TTOOL_TARGET_LINUX)/TTool/bin/
391
	@$(TAR) uf $@ -C $(TTOOL_TARGET_LINUX) proverif uppaal TTool/bin/config_linux.xml ttool.exe
Florian Lugou's avatar
Florian Lugou committed
392

393
$(BASERELEASE:.tgz=.tar): $(JTTOOL_BINARY) $(TTOOL_BINARY) $(LAUNCHER_BINARY) $(TIFTRANSLATOR_BINARY) $(TMLTRANSLATOR_BINARY) $(RUNDSE_BINARY) FORCE
Florian Lugou's avatar
Florian Lugou committed
394
	@echo "$(PREFIX) Preparing base release"
395
	@rm -rf $(TTOOL_TARGET_RELEASE)
Florian Lugou's avatar
Florian Lugou committed
396 397 398 399 400
	@mkdir -p $(TTOOL_TARGET)
# modeling
	@mkdir -p $(TTOOL_TARGET)/modeling
	@cp $(RELEASE_STD_FILES_XML) $(TTOOL_TARGET)/modeling
	@cp $(TTOOL_DOC)/README_modeling $(TTOOL_TARGET)/modeling
401
# lib
Florian Lugou's avatar
Florian Lugou committed
402 403 404
	@mkdir -p $(TTOOL_TARGET)/lib
	@cp $(RELEASE_STD_FILES_LIB) $(TTOOL_TARGET)/lib
	@cp $(TTOOL_DOC)/README_lib $(TTOOL_TARGET)/lib
405
# DIPLODOCUS simulators
Florian Lugou's avatar
Florian Lugou committed
406 407 408 409 410 411 412 413 414 415 416 417
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/src_simulator/app
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/src_simulator/arch
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/src_simulator/ebrdd
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/src_simulator/evt
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/src_simulator/sim
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/src_simulator/TEPE
	@mkdir -p $(TTOOL_TARGET)/simulators/c++2/lib
	@cp  $(TTOOL_SIMULATORS)/c++2/lib/README $(TTOOL_TARGET)/simulators/c++2/lib/
	@cp  $(TTOOL_SIMULATORS)/c++2/Makefile $(TTOOL_TARGET)/simulators/c++2
	@cp  $(TTOOL_SIMULATORS)/c++2/Makefile.defs $(TTOOL_TARGET)/simulators/c++2
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator
418
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/*.js $(TTOOL_TARGET)/simulators/c++2/src_simulator
Florian Lugou's avatar
Florian Lugou committed
419 420 421 422 423 424 425 426 427 428 429 430
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/app/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator/app
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/app/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator/app
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/arch/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator/arch
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/arch/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator/arch
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/ebrdd/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator/ebrdd
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/ebrdd/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator/ebrdd
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/evt/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator/evt
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/evt/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator/evt
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/sim/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator/sim
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/sim/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator/sim
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/TEPE/*.cpp $(TTOOL_TARGET)/simulators/c++2/src_simulator/TEPE
	@cp  $(TTOOL_SIMULATORS)/c++2/src_simulator/TEPE/*.h $(TTOOL_TARGET)/simulators/c++2/src_simulator/TEPE
431
# Licenses
Florian Lugou's avatar
Florian Lugou committed
432
	@cp $(RELEASE_STD_FILES_LICENSES) $(TTOOL_TARGET)
433
# Main readme
Florian Lugou's avatar
Florian Lugou committed
434
	@cp $(TTOOL_DOC)/README $(TTOOL_TARGET)
435
#TML
Florian Lugou's avatar
Florian Lugou committed
436 437
	@mkdir -p $(TTOOL_TARGET)/tmlcode
	@cp $(TTOOL_DOC)/README_tml $(TTOOL_TARGET)/tmlcode
438
#UPPAAL
Florian Lugou's avatar
Florian Lugou committed
439 440
	@mkdir -p $(TTOOL_TARGET)/uppaal
	@cp $(TTOOL_DOC)/README_uppaal $(TTOOL_TARGET)/uppaal
441
# Proverif
Florian Lugou's avatar
Florian Lugou committed
442 443 444 445 446
	@mkdir -p $(TTOOL_TARGET)/proverif
	@cp $(TTOOL_DOC)/README_proverif $(TTOOL_TARGET)/proverif
# Graphs
	@mkdir -p $(TTOOL_TARGET)/graphs
	@cp $(TTOOL_DOC)/README_graph $(TTOOL_TARGET)/graphs/
447
# Figure
Florian Lugou's avatar
Florian Lugou committed
448 449
	@mkdir -p $(TTOOL_TARGET)/figures
	@cp $(TTOOL_DOC)/README_figure $(TTOOL_TARGET)/figures
450
# VCD
Florian Lugou's avatar
Florian Lugou committed
451 452
	@mkdir -p $(TTOOL_TARGET)/vcd
	@cp $(TTOOL_DOC)/README_vcd $(TTOOL_TARGET)/vcd
453
# Basic doc
Florian Lugou's avatar
Florian Lugou committed
454 455
	@mkdir -p $(TTOOL_TARGET)/doc
	@cp $(TTOOL_DOC)/README_doc $(TTOOL_TARGET)/doc
456
# AVATAR executable code
457
	@mkdir -p $(TTOOL_TARGET)/executablecode
Florian Lugou's avatar
Florian Lugou committed
458 459
	@mkdir -p $(TTOOL_TARGET)/executablecode/src
	@mkdir -p $(TTOOL_TARGET)/executablecode/generated_src
460
	@mkdir -p $(TTOOL_TARGET)/executablecode/example
461
	@cp $(TTOOL_EXECUTABLECODE)/LICENSE* $(TTOOL_TARGET)/executablecode/
Florian Lugou's avatar
Florian Lugou committed
462 463 464 465 466 467
	@cp $(TTOOL_EXECUTABLECODE)/Makefile $(TTOOL_TARGET)/executablecode/
	@cp $(TTOOL_EXECUTABLECODE)/Makefile.defs $(TTOOL_TARGET)/executablecode/
	@cp $(TTOOL_EXECUTABLECODE)/Makefile.forsoclib $(TTOOL_TARGET)/executablecode/
	@cp $(TTOOL_EXECUTABLECODE)/src/*.c $(TTOOL_TARGET)/executablecode/src/
	@cp $(TTOOL_EXECUTABLECODE)/src/*.h $(TTOOL_TARGET)/executablecode/src/
	@cp $(TTOOL_EXECUTABLECODE)/generated_src/README $(TTOOL_TARGET)/executablecode/generated_src/
Ludovic Apvrille's avatar
Ludovic Apvrille committed
468 469
	@cp $(TTOOL_EXECUTABLECODE)/example/*.java $(TTOOL_TARGET)/executablecode/example/
	@cp $(TTOOL_EXECUTABLECODE)/example/README $(TTOOL_TARGET)/executablecode/example/
Ludovic Apvrille's avatar
Ludovic Apvrille committed
470
# MPSOC
471 472 473 474 475 476 477 478 479 480 481 482
#	@mkdir -p $(TTOOL_TARGET)/MPSoC
#	@mkdir -p $(TTOOL_TARGET)/MPSoC/generated_topcell
#	@mkdir -p $(TTOOL_TARGET)/MPSoC/generated_src
#	@mkdir -p $(TTOOL_TARGET)/MPSoC/src
#	@cp $(TTOOL_MPSOC)/Makefile $(TTOOL_TARGET)/MPSoC/
#	@cp $(TTOOL_MPSOC)/Makefile.defs $(TTOOL_TARGET)/MPSoC/
#	@cp $(TTOOL_MPSOC)/Makefile.forsoclib $(TTOOL_TARGET)/MPSoC/
#	@cp $(TTOOL_MPSOC)/src/*.c $(TTOOL_TARGET)/MPSoC/src/
#	@cp $(TTOOL_MPSOC)/src/*.h $(TTOOL_TARGET)/MPSoC/src/
#	@cp $(TTOOL_MPSOC)/generated_src/README $(TTOOL_TARGET)/MPSoC/generated_src/
#	@cp $(TTOOL_MPSOC)/generated_topcell/nbproc $(TTOOL_TARGET)/MPSoC/generated_topcell/
#	@cp $(TTOOL_MPSOC)/generated_topcell/config_noproc $(TTOOL_TARGET)/MPSoC/generated_topcell/
483
#DOC
484 485 486
	@$(MAKE) -C $(TTOOL_DOC_SYSMLSEC_DIR) sysmlsec_documentation
	@cp $(TTOOL_DOC_SYSMLSEC_DIR)/build/sysmlsec_documentation.pdf  $(TTOOL_TARGET)/doc/sysmlsec_documentation.pdf
	@cp $(TTOOL_DOC_SYSMLSEC_DIR)/build/sysmlsec_documentation.pdf  $(TTOOL_PRIVATE)/website/ttool/docs/
487 488
	@$(MAKE) -C $(TTOOL_DOC_AVATARCODEGENERATION_DIR) codegeneration_documentation
	@cp $(TTOOL_DOC_AVATARCODEGENERATION_DIR)/codegeneration_documentation.pdf  $(TTOOL_TARGET)/doc/avatarcodegeneration_documentation.pdf
489
	@cp $(TTOOL_DOC_AVATARCODEGENERATION_DIR)/codegeneration_documentation.pdf  $(TTOOL_PRIVATE)/website/ttool/docs/
490 491 492 493
	@$(MAKE) -C $(TTOOL_DOC_SOCLIB_USERGUIDE_DIR) user_guide
	@cp $(TTOOL_DOC_SOCLIB_USERGUIDE_DIR)/build/user_guide.pdf  $(TTOOL_TARGET)/doc/prototyping_with_soclib_user_guide.pdf
	@$(MAKE) -C $(TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR) installation_guide
	@cp $(TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR)/build/installation_guide.pdf  $(TTOOL_TARGET)/doc/prototyping_with_soclib_installation_guide.pdf
494
# Basic bin
Florian Lugou's avatar
Florian Lugou committed
495 496
	@mkdir -p $(TTOOL_TARGET)/bin
	@cp $(TTOOL_DOC)/README_bin $(TTOOL_TARGET)/bin
497
	@cp $(TTOOL_BUILD)/*.jar $(TTOOL_TARGET)/bin
Florian Lugou's avatar
Florian Lugou committed
498 499 500 501 502
	@mkdir -p $(TTOOL_STD_RELEASE)
	@$(TAR) cf $(BASERELEASE) -C $(TTOOL_TARGET_RELEASE) .

publish_jar: $(TTOOL_BINARY)
	@echo "$(PREFIX) Publishing standard and advanced releases"
503 504 505
#	scp $< $(PROD_USERNAME)@$(PROD_ADDRESS):$(PROD_PATH)/
#	ssh $(PROD_USERNAME)@$(PROD_ADDRESS) "chmod a+r $(PROD_PATH)/$(notdir $<)"
	cp $< $(TTOOL_PRIVATE_RELEASES)/
Florian Lugou's avatar
Florian Lugou committed
506 507 508

preinstall: $(TTOOL_PREINSTALL_WINDOWS) $(TTOOL_PREINSTALL_LINUX) $(TTOOL_PREINSTALL_MACOS)
	@echo "$(PREFIX) Publishing preinstall versions"
509 510 511
#	scp $^ $(PROD_USERNAME)@$(PROD_ADDRESS):$(PROD_PATH)/
	cp $^ $(TTOOL_PRIVATE_RELEASES)/
	cd $(TTOOL_PRIVATE)/website&&make ttool
Florian Lugou's avatar
Florian Lugou committed
512

513 514 515 516 517 518 519 520
git:
	@echo "$(PREFIX) Updating build number"
	@date
	git pull
	@$(JAVA) -jar $(BUILDER) $(BUILD_INFO) $(BUILD_TO_MODIFY)
	git commit -m 'update on build version: $(BUILD_INFO)' $(BUILD_INFO) $(BUILD_TO_MODIFY)
	git push

521 522 523 524 525 526
# ======================================== 
# ==========      INSTALL       ========== 
# ======================================== 

DESTDIR ?= $(TTOOL_PATH)

527 528
install:
#ttool launcher graphminimize graphshow tiftranslator tmltranslator rundse remotesimulator webcrawler
529
	mkdir -p $(DESTDIR)/bin
530
	@cp $(TTOOL_BUILD)/*.jar $(TTOOL_BUILD)/*.xml $(TTOOL_BUILD)/*.h $(TTOOL_BUILD)/*.f  $(TTOOL_BUILD)/*.t $(TTOOL_BUILD)/*.exe  $(DESTDIR)/bin
531

Florian Lugou's avatar
Florian Lugou committed
532 533 534 535
# ======================================== 
# ==========       TESTS        ========== 
# ======================================== 
test:
536
	@$(GRADLE) test
Florian Lugou's avatar
Florian Lugou committed
537 538 539 540

# ======================================== 
# ==========       CLEAN        ========== 
# ======================================== 
541
clean:
Florian Lugou's avatar
Florian Lugou committed
542 543
	@$(MAKE) -C $(TTOOL_DIR) -e clean
	@$(MAKE) -C $(LAUNCHER_DIR) -e clean
544
	@$(MAKE) -C $(TTOOLCLI_DIR) -e clean
Florian Lugou's avatar
Florian Lugou committed
545 546 547 548 549 550 551 552 553
	@$(MAKE) -C $(GRAPHMINIMIZE_DIR) -e clean
	@$(MAKE) -C $(GRAPHSHOW_DIR) -e clean
	@$(MAKE) -C $(TIFTRANSLATOR_DIR) -e clean
	@$(MAKE) -C $(TMLTRANSLATOR_DIR) -e clean
	@$(MAKE) -C $(RUNDSE_DIR) -e clean
	@$(MAKE) -C $(REMOTESIMULATOR_DIR) -e clean
	@$(MAKE) -C $(WEBCRAWLER_CLIENT_DIR) -e clean
	@$(MAKE) -C $(WEBCRAWLER_SERVER_DIR) -e clean
	@$(MAKE) -C $(JTTOOL_DIR) -e clean
554
	@$(MAKE) -C $(TTOOL_DOC_SYSMLSEC_DIR) clean	
555 556 557
	@$(MAKE) -C $(TTOOL_DOC_AVATARCODEGENERATION_DIR) clean
	@$(MAKE) -C $(TTOOL_DOC_SOCLIB_USERGUIDE_DIR) clean
	@$(MAKE) -C $(TTOOL_DOC_SOCLIB_INSTALLATIONGUIDE_DIR) clean
Florian Lugou's avatar
Florian Lugou committed
558 559
	@rm -rf $(TTOOL_TARGET_RELEASE)
	@rm -f $(TTOOL_STD_RELEASE)/*.tar
560
	@rm -rf $(TTOOL_BUILD)	
Ludovic Apvrille's avatar
Ludovic Apvrille committed
561

562
ultraclean: clean
Florian Lugou's avatar
Florian Lugou committed
563 564
	@rm -rf $(TTOOL_DOC_HTML)
	@rm -rf $(TTOOL_STD_RELEASE)