2006-07-31 18:17:43 +04:00
|
|
|
# This makefile is here to simplify the automatic releases (and tests!!!)
|
|
|
|
# of the scripts
|
|
|
|
|
2006-08-01 00:13:25 +04:00
|
|
|
|
2006-07-31 18:17:43 +04:00
|
|
|
TS?=$(shell date '+%Y%m%d-%H%M')
|
2006-08-01 00:13:25 +04:00
|
|
|
DS?=$(shell date '+%Y%m%d')
|
|
|
|
|
2006-08-01 05:18:13 +04:00
|
|
|
# to simplify redirect to custom releases
|
|
|
|
DEFAULTTARGETDIR?=/export/ws06osmt/bin
|
|
|
|
|
|
|
|
MAIN_SCRIPTS_TARGET_DIR=$(TARGETDIR)
|
2006-08-01 01:01:07 +04:00
|
|
|
# MAIN_SCRIPTS_TARGET_DIR=$(shell echo `pwd`/temp)
|
2006-08-01 00:13:25 +04:00
|
|
|
|
2006-08-01 05:18:13 +04:00
|
|
|
RELEASEDIR=$(TARGETDIR)/scripts-$(TS)
|
2006-08-01 01:01:07 +04:00
|
|
|
# RELEASEDIR=$(shell echo `pwd`/temp)
|
2006-07-31 18:17:43 +04:00
|
|
|
|
|
|
|
|
2006-08-01 00:13:25 +04:00
|
|
|
|
2006-08-08 23:22:53 +04:00
|
|
|
## Rules to compile parts that need compilation
|
|
|
|
|
|
|
|
|
2006-08-04 08:45:48 +04:00
|
|
|
all: compile
|
|
|
|
|
|
|
|
compile:
|
|
|
|
cd training/cmert-0.5/ && make
|
2006-08-08 23:22:53 +04:00
|
|
|
## Compiled mert
|
|
|
|
cd training/phrase-extract/ && make
|
|
|
|
## Compiled phrase_extract
|
2006-08-14 19:18:58 +04:00
|
|
|
cd training/symal/ && make
|
|
|
|
## Compiled symal
|
2006-08-08 23:22:53 +04:00
|
|
|
## All files that need compilation were compiled
|
|
|
|
|
2006-08-04 08:45:48 +04:00
|
|
|
|
2006-08-08 23:22:53 +04:00
|
|
|
### "MAIN" scripts are scripts that have a Philipp-like name, too
|
|
|
|
## That is for each script (listed below in MAIN_SCRIPTS),
|
|
|
|
## we create a date-stamped version in MAIN_SCRIPTS_TARGET_DIR
|
2006-08-01 00:13:25 +04:00
|
|
|
|
2006-08-03 21:55:56 +04:00
|
|
|
MAIN_TRAINING_SCRIPTS_NAMES=filter-model-given-input.pl mert-moses.pl train-factored-phrase-model.perl clean-corpus-n.perl
|
2006-07-31 18:17:43 +04:00
|
|
|
# Make trick to add directory name to all of them:
|
2006-08-01 00:13:25 +04:00
|
|
|
MAIN_TRAINING_SCRIPTS=$(MAIN_TRAINING_SCRIPTS_NAMES:%=training/%)
|
2006-07-31 18:17:43 +04:00
|
|
|
|
2006-08-01 05:18:13 +04:00
|
|
|
MAIN_GENERIC_SCRIPTS_NAMES= moses-parallel.pl
|
|
|
|
# Make trick to add directory name to all of them:
|
|
|
|
MAIN_GENERIC_SCRIPTS=$(MAIN_GENERIC_SCRIPTS_NAMES:%=generic/%)
|
|
|
|
|
2006-07-31 18:17:43 +04:00
|
|
|
# the list of all scripts that should be released
|
2006-08-01 05:18:13 +04:00
|
|
|
MAIN_SCRIPTS= $(MAIN_TRAINING_SCRIPTS) $(MAIN_GENERIC_SCRIPTS)
|
2006-07-31 18:17:43 +04:00
|
|
|
|
2006-08-04 08:45:48 +04:00
|
|
|
|
2006-07-31 18:17:43 +04:00
|
|
|
release:
|
2006-08-08 23:22:53 +04:00
|
|
|
# Compile the parts
|
|
|
|
make all
|
2006-08-04 08:45:48 +04:00
|
|
|
if [ -z "$(TARGETDIR)" ]; then \
|
|
|
|
echo "Please specify a TARGETDIR." ; \
|
|
|
|
echo " For custom releases issue: "; \
|
|
|
|
echo " TARGETDIR=$(HOME)/releases make release"; \
|
|
|
|
echo " For official releases (that include generation of helper scripts directly in /bin issue: "; \
|
|
|
|
echo " TARGETDIR=/export/ws06osmt make jhu_release"; \
|
|
|
|
exit 1; fi
|
2006-07-31 18:17:43 +04:00
|
|
|
if [ -e $(RELEASEDIR) ]; then echo "Targetdir exists! Not touching it! $(RELEASEDIR)"; exit 1; fi
|
|
|
|
mkdir -p $(RELEASEDIR)
|
2006-08-01 00:13:25 +04:00
|
|
|
rsync -r --files-from ./released-files . $(RELEASEDIR)/
|
2006-08-01 05:18:13 +04:00
|
|
|
echo "####### Do not forget to:" >> $(RELEASEDIR)/README
|
|
|
|
echo " export SCRIPTS_ROOTDIR=$(RELEASEDIR)" >> $(RELEASEDIR)/README
|
|
|
|
## Remember, only files listed in released-files are released!!
|
|
|
|
## URGE yourself to:
|
|
|
|
@echo " export SCRIPTS_ROOTDIR=$(RELEASEDIR)"
|
|
|
|
|
|
|
|
jhu_release:
|
|
|
|
TS=$(TS) DS=$(DS) TARGETDIR=$(DEFAULTTARGETDIR) make release
|
|
|
|
TS=$(TS) DS=$(DS) TARGETDIR=$(DEFAULTTARGETDIR) make generate_wrappers
|
|
|
|
## Remember, only files listed in released-files are released!!
|
|
|
|
### Release succeeded, tagging the CVS
|
|
|
|
cvs tag SCRIPTS-RELEASE-$(TS)
|
|
|
|
|
|
|
|
generate_wrappers:
|
2006-08-01 00:13:25 +04:00
|
|
|
## And for each script, create/rewrite the daily release
|
2006-08-01 05:18:13 +04:00
|
|
|
export TARGET
|
2006-08-01 00:13:25 +04:00
|
|
|
for s in $(MAIN_SCRIPTS); do \
|
|
|
|
bn=`basename $$s`; \
|
2006-08-01 05:18:13 +04:00
|
|
|
echo '#!/bin/bash' > $(MAIN_SCRIPTS_TARGET_DIR)/$$bn-$(DS) || exit 1; \
|
|
|
|
echo "export SCRIPTS_ROOTDIR=$(RELEASEDIR); $(RELEASEDIR)/$$s "'"$$@"; exit $$?' >> $(MAIN_SCRIPTS_TARGET_DIR)/$$bn-$(DS) || exit 1; \
|
2006-08-01 00:13:25 +04:00
|
|
|
chmod 775 $(MAIN_SCRIPTS_TARGET_DIR)/$$bn-$(DS); \
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2006-08-05 02:25:38 +04:00
|
|
|
MOSESRELEASE=$(TARGETDIR)/moses.$(DS)
|
|
|
|
## This is a handy goal to release moses binary, too
|
|
|
|
releasemoses:
|
|
|
|
if [ -z "$(TARGETDIR)" ]; then \
|
|
|
|
echo "Please specify a TARGETDIR." ; \
|
|
|
|
echo " For custom releases issue: "; \
|
|
|
|
echo " TARGETDIR=$(HOME)/releases make releasemoses"; \
|
|
|
|
echo " For official releases: "; \
|
|
|
|
echo " TARGETDIR=/export/ws06osmt make releasemoses"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
if [ -e $(MOSESRELEASE) ]; then echo "Moses release exists! Not touching it! $(MOSESRELEASE)"; exit 1; fi
|
|
|
|
if [ ! -e ../moses-cmd/src/moses ]; then echo "Moses (../moses-cmd/src/moses) does not exist, nothing to release"; ecit 1; fi
|
|
|
|
if file ../moses-cmd/src/moses | grep -q 'dynamicall' ; then echo "Moses (../moses-cmd/src/moses) is dynamically linked, not releasing."; ecit 1; fi
|
|
|
|
cp ../moses-cmd/src/moses $(MOSESRELEASE)
|
|
|
|
## Your current version of moses:
|
|
|
|
@echo " $(MOSESRELEASE)"
|
|
|
|
|
2006-08-01 05:18:13 +04:00
|
|
|
|
|
|
|
## This goal lists all files you might have wanted to release
|
|
|
|
# but forgot to mention in released-files
|
|
|
|
missed:
|
|
|
|
### These might be intended for release
|
|
|
|
find . -type f \
|
|
|
|
| grep -v '/CVS/' \
|
2006-08-05 02:25:38 +04:00
|
|
|
| grep -v /tests/ \
|
2006-08-01 05:18:13 +04:00
|
|
|
| sed 's/^\.\///' \
|
|
|
|
| grep -F -x -v -f released-files
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-08-04 08:45:48 +04:00
|
|
|
### Tests, applicable only at JHU environment due to data dependencies
|
|
|
|
export WORKSPACE=$(shell pwd)/../
|
|
|
|
|
2006-08-01 05:18:13 +04:00
|
|
|
.PHONY: tests
|
|
|
|
tests:
|
|
|
|
export SCRIPTS_ROOTDIR=`pwd`; \
|
|
|
|
cd tests; \
|
|
|
|
ts=`date '+%Y%m%d-%H%M%N'`; \
|
|
|
|
for test in *.test; do \
|
|
|
|
mkdir $$test.$$ts; \
|
|
|
|
cd $$test.$$ts; \
|
|
|
|
echo "Running $$test in tests/$$test.$$ts"; \
|
|
|
|
../$$test > log 2>&1 || exit 1; \
|
|
|
|
cd ..; \
|
|
|
|
done
|
|
|
|
## All tests passed
|
|
|
|
|
2006-08-04 08:45:48 +04:00
|
|
|
## Run just one test
|
|
|
|
tests/%.test.run: tests/%.test
|
|
|
|
export SCRIPTS_ROOTDIR=`pwd`; \
|
|
|
|
ts=`date '+%Y%m%d-%H%M%N'`; \
|
|
|
|
cd tests; \
|
|
|
|
test=$*.test; \
|
|
|
|
mkdir $$test.$$ts; \
|
|
|
|
cd $$test.$$ts; \
|
|
|
|
echo "Running $$test in tests/$$test.$$ts"; \
|
|
|
|
( nohup ../$$test > log 2>&1 & ) || exit 1; \
|
|
|
|
echo "Observe tests/$$test.$$ts/log"; \
|
|
|
|
cd ..
|
|
|
|
|