first shot at fold-in support for BPRMF
[mymedialite:mymedialite.git] / Makefile
1 PDF_VIEWER=evince
2 EDITOR=editor
3 GENDARME_OPTIONS=--quiet --severity critical+
4 SRC_DIR=src
5 PREFIX=/usr/local
6 VERSION=3.02
7 HTML_MDOC_DIR=website/public_html/documentation/mdoc
8 HTML_DOXYGEN_DIR=website/public_html/documentation/doxygen
9 MYMEDIA_ASSEMBLY_DIR=$(CURDIR)/src/MyMediaLite/bin/Debug
10 ITEM_REC_DIR=${SRC_DIR}/Programs/ItemRecommendation
11 RATING_PRED_DIR=${SRC_DIR}/Programs/RatingPrediction
12 RATING_RANK_DIR=${SRC_DIR}/Programs/RatingBasedRanking
13 export IRONPYTHONPATH := ${MYMEDIA_ASSEMBLY_DIR}
14
15 .PHONY: all clean veryclean mymedialite install uninstall todo gendarme monodoc mdoc-html view-mdoc-html doxygen view-doxygen flyer edit-flyer website copy-website test release download-movielens copy-packages-website example-python example-ruby check-for-unnecessary-type-declarations unittests
16
17 all: mymedialite
18
19 mymedialite:
20         cd ${SRC_DIR} && make all
21
22 clean:
23         cd ${SRC_DIR} && make clean
24         cd examples/csharp && make clean
25         rm -rf ${SRC_DIR}/Programs/*/bin/Debug/*
26         rm -rf ${SRC_DIR}/Programs/*/bin/Release/*
27         rm -rf ${SRC_DIR}/KDDCup2011/*/bin/Debug/*
28         rm -rf ${SRC_DIR}/KDDCup2011/*/bin/Release/*
29         rm -rf ${SRC_DIR}/Mapping/*/bin/Debug/*
30         rm -rf ${SRC_DIR}/Mapping/*/bin/Release/*
31         rm -rf ${SRC_DIR}/*/bin/Debug/*
32         rm -rf ${SRC_DIR}/*/bin/Release/*
33         rm -rf ${SRC_DIR}/RatingService/bin/*
34         rm -rf ${SRC_DIR}/test-results
35         rm -rf ${SRC_DIR}/*/*.tar.gz
36         rm -rf ${SRC_DIR}/*/*.pidb
37         rm -rf doc/monodoc/*
38         rm -rf lib/mymedialite/*
39         rm -rf MyMediaLite-*/
40
41 veryclean: clean
42         rm -f *.tar.gz
43         rm -rf doc/doxygen/*
44         rm -rf website/public_html/*
45
46 install:
47         cd ${SRC_DIR} && make install PREFIX=${PREFIX}
48
49 uninstall:
50         cd ${SRC_DIR} && make uninstall PREFIX=${PREFIX}
51
52 MyMediaLite-${VERSION}.tar.gz:
53         mkdir MyMediaLite-${VERSION}
54         mkdir MyMediaLite-${VERSION}/doc/
55         cp doc/Authors doc/Changes doc/ComponentLicenses doc/GPL-3 doc/Installation doc/TODO MyMediaLite-${VERSION}/doc
56         cp -r bin examples scripts MyMediaLite-${VERSION}
57         cp README MyMediaLite-${VERSION}
58         mkdir MyMediaLite-${VERSION}/lib/
59         mkdir MyMediaLite-${VERSION}/lib/mymedialite
60         cp ${ITEM_REC_DIR}/bin/Debug/*.exe MyMediaLite-${VERSION}/lib/mymedialite
61         cp ${ITEM_REC_DIR}/bin/Debug/*.dll MyMediaLite-${VERSION}/lib/mymedialite
62         cp ${ITEM_REC_DIR}/bin/Debug/*.mdb MyMediaLite-${VERSION}/lib/mymedialite
63         cp ${RATING_PRED_DIR}/bin/Debug/*.exe MyMediaLite-${VERSION}/lib/mymedialite
64         cp ${RATING_PRED_DIR}/bin/Debug/*.exe.mdb MyMediaLite-${VERSION}/lib/mymedialite
65         cp ${RATING_RANK_DIR}/bin/Debug/*.exe MyMediaLite-${VERSION}/lib/mymedialite
66         cp ${RATING_RANK_DIR}/bin/Debug/*.exe.mdb MyMediaLite-${VERSION}/lib/mymedialite
67         tar -cvzf MyMediaLite-${VERSION}.tar.gz MyMediaLite-${VERSION}
68         rm -rf MyMediaLite-${VERSION}
69
70 MyMediaLite-${VERSION}.doc.tar.gz: doxygen
71         mkdir MyMediaLite-${VERSION}.doc/
72         mkdir MyMediaLite-${VERSION}.doc/doc/
73         mkdir MyMediaLite-${VERSION}.doc/doc/api
74         cp -r doc/doxygen/html MyMediaLite-${VERSION}.doc/doc/api
75         tar -cvzf MyMediaLite-${VERSION}.doc.tar.gz MyMediaLite-${VERSION}.doc
76         rm -rf MyMediaLite-${VERSION}.doc
77
78 MyMediaLite-${VERSION}.src.tar.gz:
79         wget --output-document=MyMediaLite-${VERSION}.src.tar.gz https://github.com/zenogantner/MyMediaLite/tarball/master
80
81 test: data/ml-100k/u.data all unittests
82         time tests/test_rating_prediction.sh
83         time tests/test_item_recommendation.sh
84         time tests/test_load_save.sh
85         time tests/test_cv.sh
86         time tests/test_random_split.sh
87         time tests/test_rating_prediction_online.sh
88
89 unittests:
90         cd src && make test
91
92 release: mymedialite MyMediaLite-${VERSION}.doc.tar.gz MyMediaLite-${VERSION}.tar.gz MyMediaLite-${VERSION}.src.tar.gz
93         head doc/Changes
94         git status
95         cp doc/Changes website/src/download
96         bin/rating_prediction --help > website/lib/rating_prediction_usage
97         bin/item_recommendation --help > website/lib/item_recommendation_usage
98         cat doc/ReleaseChecklist
99
100 example-csharp: data/ml-100k/u.data
101         cd examples/csharp && make
102         cd examples/csharp && make run
103
104 example-fsharp: data/ml-100k/u.data
105         cd examples/fsharp && make
106         cd data/ml-100k && mono ../../examples/fsharp/rating_prediction.exe
107         cd data/ml-100k && mono ../../examples/fsharp/item_recommendation.exe
108
109
110 example-python: data/ml-100k/u.data
111         cd data/ml-100k && ipy ../../examples/python/rating_prediction.py
112         cd data/ml-100k && ipy ../../examples/python/item_recommendation.py
113
114 example-ruby: data/ml-100k/u.data
115         cd data/ml-100k && ir -I${MYMEDIA_ASSEMBLY_DIR} ../../examples/ruby/rating_prediction.rb
116         cd data/ml-100k && ir -I${MYMEDIA_ASSEMBLY_DIR} ../../examples/ruby/item_recommendation.rb
117
118 data:
119         mkdir data/
120
121 data/ml-100k/u.data:
122         scripts/download_movielens.sh
123
124 download-movielens: data
125         scripts/download_movielens.sh
126
127 download-imdb: data
128         scripts/download_imdb.sh
129
130 todo:
131         ack --type=csharp TODO                    ${SRC_DIR}; echo
132         ack --type=csharp FIXME                   ${SRC_DIR}; echo
133         ack --type=csharp HACK                    ${SRC_DIR}; echo
134         ack --type=csharp NotImplementedException ${SRC_DIR}; echo
135         ack --type=csharp TODO                    ${SRC_DIR} | wc -l
136         ack --type=csharp FIXME                   ${SRC_DIR} | wc -l
137         ack --type=csharp HACK                    ${SRC_DIR} | wc -l
138         ack --type=csharp NotImplementedException ${SRC_DIR} | wc -l
139
140 ## TODO create regex with less false positives
141 check-for-unnecessary-type-declarations:
142         ack --type=csharp "new" src/MyMediaLite | grep -v static | grep -v var | grep -v public | grep -v private | grep -v protected | grep -v return | grep -v throw | grep -v this | grep -v //
143
144 gendarme:
145         gendarme ${GENDARME_OPTIONS} $RATING_PRED_DIR//bin/Debug/*.exe
146         gendarme ${GENDARME_OPTIONS} $ITEM_REC_DIR/bin/Debug/*.exe
147         gendarme ${GENDARME_OPTIONS} ${SRC_DIR}/Mapping/MappingRatingPrediction/bin/Debug/*.exe
148         gendarme ${GENDARME_OPTIONS} ${SRC_DIR}/Mapping/MappingItemPrediction/bin/Debug/*.exe
149         gendarme ${GENDARME_OPTIONS} ${SRC_DIR}/MyMediaLite/bin/Debug/MyMediaLite.dll
150         gendarme ${GENDARME_OPTIONS} ${SRC_DIR}/MyMediaLiteExperimental/bin/Debug/MyMediaLiteExperimental.dll
151         gendarme ${GENDARME_OPTIONS} ${SRC_DIR}/MyMediaLiteExperimental/bin/Debug/SVM.dll
152
153 apidoc: doxygen
154
155 monodoc:
156         mdoc update --delete -i ${SRC_DIR}/MyMediaLite/bin/Debug/MyMediaLite.xml -o doc/monodoc/ ${SRC_DIR}/MyMediaLite/bin/Debug/MyMediaLite.dll
157
158 mdoc-html: monodoc
159         mdoc-export-html doc/monodoc/ -o ${HTML_MDOC_DIR} --template=doc/htmldoc-template.xsl
160         perl -e "use File::Slurp; \$$f = read_file '${HTML_MDOC_DIR}/index.html'; \$$f =~ s/\n.+?\n.+?experimental.+?\n.+?\n.+?\n.+?\n.+//; print \$$f;" > tmp.html && cat tmp.html > ${HTML_MDOC_DIR}/index.html && rm tmp.html
161
162 view-mdoc:
163         x-www-browser file://${HTML_MDOC_DIR}/index.html
164
165 doxygen:
166         cd doc/ && doxygen
167         mkdir -p ${HTML_DOXYGEN_DIR}
168         cp -r doc/doxygen/html/* ${HTML_DOXYGEN_DIR}
169
170 view-doxygen:
171         x-www-browser file://${HTML_DOXYGEN_DIR}/index.html
172
173 flyer:
174         cd doc/flyer; pdflatex mymedialite-flyer.tex
175
176 edit-flyer:
177         ${EDITOR} doc/flyer/mymedialite-flyer.tex
178
179 view-flyer:
180         ${PDF_VIEWER} doc/flyer/mymedialite-flyer.pdf &
181
182 website:
183         ttree -s website/src/ -d website/public_html/ -c website/lib/ -l website/lib/ -r -f config --post_chomp -a
184
185 copy-website: website
186         cp -r website/public_html/* ${HOME}/homepage/public_html/mymedialite/
187
188 copy-packages-website:
189         cp MyMediaLite-${VERSION}.tar.gz MyMediaLite-${VERSION}.src.tar.gz MyMediaLite-${VERSION}.doc.tar.gz ${HOME}/homepage/public_html/mymedialite/download