| 1 | BUILD_LANGUAGE ?= en_US |
|---|
| 2 | BUILD_PACKAGE ?= MTOS |
|---|
| 3 | |
|---|
| 4 | -include build/mt-dists/default.mk |
|---|
| 5 | -include build/mt-dists/$(BUILD_PACKAGE).mk |
|---|
| 6 | -include build/mt-dists/$(BUILD_LANGUAGE).mk |
|---|
| 7 | |
|---|
| 8 | BUILD_VERSION_ID ?= $(PRODUCT_VERSION) |
|---|
| 9 | |
|---|
| 10 | latin1_modules = lib/MT/L10N/es-iso-8859-1.pm \ |
|---|
| 11 | lib/MT/L10N/fr-iso-8859-1.pm \ |
|---|
| 12 | lib/MT/L10N/de-iso-8859-1.pm \ |
|---|
| 13 | lib/MT/L10N/nl-iso-8859-1.pm |
|---|
| 14 | |
|---|
| 15 | local_js = mt-static/mt_de.js \ |
|---|
| 16 | mt-static/mt_fr.js \ |
|---|
| 17 | mt-static/mt_nl.js \ |
|---|
| 18 | mt-static/mt_ja.js \ |
|---|
| 19 | mt-static/mt_es.js |
|---|
| 20 | |
|---|
| 21 | core_js = mt-static/js/common/Core.js \ |
|---|
| 22 | mt-static/js/common/JSON.js \ |
|---|
| 23 | mt-static/js/common/Timer.js \ |
|---|
| 24 | mt-static/js/common/Cookie.js \ |
|---|
| 25 | mt-static/js/common/DOM.js \ |
|---|
| 26 | mt-static/js/common/Observable.js \ |
|---|
| 27 | mt-static/js/common/Autolayout.js \ |
|---|
| 28 | mt-static/js/common/Component.js \ |
|---|
| 29 | mt-static/js/common/List.js \ |
|---|
| 30 | mt-static/js/common/App.js \ |
|---|
| 31 | mt-static/js/common/Cache.js \ |
|---|
| 32 | mt-static/js/common/Client.js \ |
|---|
| 33 | mt-static/js/common/Template.js \ |
|---|
| 34 | mt-static/js/tc.js \ |
|---|
| 35 | mt-static/js/tc/tableselect.js |
|---|
| 36 | |
|---|
| 37 | main_css = mt-static/css/reset.css \ |
|---|
| 38 | mt-static/css/structure.css \ |
|---|
| 39 | mt-static/css/messaging.css \ |
|---|
| 40 | mt-static/css/utilities.css |
|---|
| 41 | |
|---|
| 42 | simple_css = mt-static/css/reset.css \ |
|---|
| 43 | mt-static/css/chromeless.css \ |
|---|
| 44 | mt-static/css/messaging.css \ |
|---|
| 45 | mt-static/css/utilities.css |
|---|
| 46 | |
|---|
| 47 | all: code |
|---|
| 48 | |
|---|
| 49 | mt-static/js/mt_core_compact.js: $(core_js) |
|---|
| 50 | cat $(core_js) > mt-static/js/mt_core_compact.js |
|---|
| 51 | ./build/minifier.pl mt-static/js/mt_core_compact.js |
|---|
| 52 | |
|---|
| 53 | mt-static/css/main.css: $(main_css) |
|---|
| 54 | cat $(main_css) > mt-static/css/main.css |
|---|
| 55 | ./build/minifier.pl mt-static/css/main.css |
|---|
| 56 | |
|---|
| 57 | mt-static/css/simple.css: $(simple_css) |
|---|
| 58 | cat $(simple_css) > mt-static/css/simple.css |
|---|
| 59 | ./build/minifier.pl mt-static/css/simple.css |
|---|
| 60 | |
|---|
| 61 | .PHONY: code-common code code-en_US code-de code-fr code-nl \ |
|---|
| 62 | code-es code-ja |
|---|
| 63 | code_common = lib/MT.pm php/mt.php mt-check.cgi \ |
|---|
| 64 | mt-static/js/mt_core_compact.js \ |
|---|
| 65 | mt-static/css/main.css \ |
|---|
| 66 | mt-static/css/simple.css \ |
|---|
| 67 | mt-config.cgi-original index.html readme.html |
|---|
| 68 | |
|---|
| 69 | code: check code-$(BUILD_LANGUAGE) |
|---|
| 70 | code-en_US code-de code-fr code-nl code-es: check $(code_common) \ |
|---|
| 71 | $(latin1_modules) $(local_js) |
|---|
| 72 | code-ja: check $(code_common) mt-static/mt_ja.js |
|---|
| 73 | |
|---|
| 74 | build-language-stamp: |
|---|
| 75 | |
|---|
| 76 | check: |
|---|
| 77 | @(test $(BUILD_LANGUAGE) || echo You must define BUILD_LANGUAGE) |
|---|
| 78 | @test $(BUILD_LANGUAGE) |
|---|
| 79 | @(test $(BUILD_PACKAGE) || echo You must define BUILD_PACKAGE) |
|---|
| 80 | @test $(BUILD_PACKAGE) |
|---|
| 81 | @(test $(BUILD_VERSION_ID) || echo You must define BUILD_VERSION_ID) |
|---|
| 82 | @test $(BUILD_VERSION_ID) |
|---|
| 83 | -@if [ "`cat build-language-stamp`" != ${BUILD_LANGUAGE} ] ; \ |
|---|
| 84 | then \ |
|---|
| 85 | echo ${BUILD_LANGUAGE} > build-language-stamp; \ |
|---|
| 86 | echo updated build-language-stamp; \ |
|---|
| 87 | fi |
|---|
| 88 | |
|---|
| 89 | lib/MT.pm: %: %.pre build-language-stamp build/mt-dists/$(BUILD_PACKAGE).mk build/mt-dists/default.mk |
|---|
| 90 | sed -e 's!__BUILD_LANGUAGE__!$(BUILD_LANGUAGE)!g' \ |
|---|
| 91 | -e 's!__PRODUCT_CODE__!$(PRODUCT_CODE)!g' \ |
|---|
| 92 | -e 's!__PRODUCT_NAME__!$(PRODUCT_NAME)!g' \ |
|---|
| 93 | -e 's!__PRODUCT_VERSION__!$(PRODUCT_VERSION)!g' \ |
|---|
| 94 | -e 's!__PRODUCT_VERSION_ID__!$(BUILD_VERSION_ID)!g' \ |
|---|
| 95 | -e 's!__SCHEMA_VERSION__!$(SCHEMA_VERSION)!g' \ |
|---|
| 96 | -e 's!__API_VERSION__!$(API_VERSION)!g' \ |
|---|
| 97 | -e 's!__NEWSBOX_URL__!$(NEWSBOX_URL)!g' \ |
|---|
| 98 | -e 's!__LEARNINGNEWS_URL__!$(LEARNINGNEWS_URL)!g' \ |
|---|
| 99 | -e 's!__SUPPORT_URL__!$(SUPPORT_URL)!g' \ |
|---|
| 100 | -e 's!__PORTAL_URL__!$(PORTAL_URL)!g' \ |
|---|
| 101 | -e 's!__NEWS_URL__!$(NEWS_URL)!g' \ |
|---|
| 102 | -e 's!__DEFAULT_TIMEZONE__!$(DEFAULT_TIMEZONE)!g' \ |
|---|
| 103 | -e 's!__MAIL_ENCODING__!$(MAIL_ENCODING)!g' \ |
|---|
| 104 | -e 's!__EXPORT_ENCODING__!$(EXPORT_ENCODING)!g' \ |
|---|
| 105 | -e 's!__LOG_EXPORT_ENCODING__!$(LOG_EXPORT_ENCODING)!g' \ |
|---|
| 106 | -e 's!__CATEGORY_NAME_NODASH__!$(CATEGORY_NAME_NODASH)!g' \ |
|---|
| 107 | -e 's!__PUBLISH_CHARSET__!$(PUBLISH_CHARSET)!g' \ |
|---|
| 108 | $< > $@ |
|---|
| 109 | |
|---|
| 110 | php/mt.php: %: %.pre build-language-stamp build/mt-dists/$(BUILD_PACKAGE).mk |
|---|
| 111 | sed -e 's!__BUILD_LANGUAGE__!$(BUILD_LANGUAGE)!g' \ |
|---|
| 112 | -e 's!__PUBLISH_CHARSET__!$(PUBLISH_CHARSET)!g' \ |
|---|
| 113 | -e 's!__PRODUCT_NAME__!$(PRODUCT_NAME)!g' \ |
|---|
| 114 | -e 's!__PRODUCT_VERSION__!$(PRODUCT_VERSION)!g' \ |
|---|
| 115 | -e 's!__PRODUCT_VERSION_ID__!$(BUILD_VERSION_ID)!g' \ |
|---|
| 116 | -e 's!__API_VERSION__!$(API_VERSION)!g' \ |
|---|
| 117 | $< > $@ |
|---|
| 118 | |
|---|
| 119 | mt-config.cgi-original: mt-config.cgi-original.pre build-language-stamp |
|---|
| 120 | sed -e 's!__BUILD_LANGUAGE__!$(BUILD_LANGUAGE)!g' \ |
|---|
| 121 | -e 's!__HELP_URL__!$(HELP_URL)!g' \ |
|---|
| 122 | -e 's!__PRODUCT_VERSION__!$(PRODUCT_VERSION)!g' \ |
|---|
| 123 | $< > $@ |
|---|
| 124 | |
|---|
| 125 | mt-check.cgi: %: %.pre build-language-stamp |
|---|
| 126 | sed -e 's!__BUILD_LANGUAGE__!$(BUILD_LANGUAGE)!g' \ |
|---|
| 127 | -e 's!__PRODUCT_VERSION_ID__!$(BUILD_VERSION_ID)!g' \ |
|---|
| 128 | $< > $@ |
|---|
| 129 | chmod +x $@ |
|---|
| 130 | |
|---|
| 131 | $(local_js): mt-static/mt_%.js: mt-static/mt.js lib/MT/L10N/%.pm |
|---|
| 132 | perl build/mt-dists/make-js |
|---|
| 133 | |
|---|
| 134 | $(latin1_modules): %-iso-8859-1.pm: %.pm |
|---|
| 135 | iconv -f utf-8 -t iso-8859-1 $< > $@ |
|---|
| 136 | |
|---|
| 137 | index.html: check build-language-stamp |
|---|
| 138 | cp index.html.en_US $@.pre |
|---|
| 139 | -cp index.html.$(BUILD_LANGUAGE) $@.pre |
|---|
| 140 | sed -e 's!__HELP_URL__!$(HELP_URL)!g' \ |
|---|
| 141 | -e 's!__PRODUCT_VERSION__!$(PRODUCT_VERSION)!g' \ |
|---|
| 142 | index.html.pre > index.html |
|---|
| 143 | rm $@.pre |
|---|
| 144 | |
|---|
| 145 | readme.html: check build-language-stamp |
|---|
| 146 | cp readme.html.en_US $@.pre |
|---|
| 147 | -cp readme.html.$(BUILD_LANGUAGE) $@.pre |
|---|
| 148 | sed -e 's!__HELP_URL__!$(HELP_URL)!g' \ |
|---|
| 149 | -e 's!__PRODUCT_VERSION__!$(PRODUCT_VERSION)!g' \ |
|---|
| 150 | readme.html.pre > readme.html |
|---|
| 151 | rm $@.pre |
|---|
| 152 | |
|---|
| 153 | ##### Other useful targets |
|---|
| 154 | |
|---|
| 155 | .PHONY: test cover clean all |
|---|
| 156 | |
|---|
| 157 | cover: |
|---|
| 158 | -cover -delete |
|---|
| 159 | HARNESS_PERL_SWITCHES=-MDevel::Cover \ |
|---|
| 160 | perl -Ilib -Iextlib -It/lib -MTest::Harness -e 'runtests @ARGV' t/*.t |
|---|
| 161 | |
|---|
| 162 | covertags: |
|---|
| 163 | -cover -delete |
|---|
| 164 | HARNESS_PERL_SWITCHES=-MDevel::Cover \ |
|---|
| 165 | perl -Ilib -Iextlib -It/lib -MTest::Harness -e 'runtests @ARGV' t/*tags*.t |
|---|
| 166 | -cover |
|---|
| 167 | |
|---|
| 168 | tags: |
|---|
| 169 | -rm -rf t/db/* |
|---|
| 170 | perl -Ilib -Iextlib -It/lib -MTest::Harness -e 'runtests @ARGV' t/*tags*.t |
|---|
| 171 | |
|---|
| 172 | test: code |
|---|
| 173 | MT_CONFIG=t/mt.cfg perl -Ilib -Iextlib -It/lib -MTest::Harness -e 'runtests @ARGV' t/*.t |
|---|
| 174 | |
|---|
| 175 | quick-test: code |
|---|
| 176 | MT_CONFIG=t/mt.cfg perl -Ilib -Iextlib -It/lib -MTest::Harness -e 'runtests @ARGV' \ |
|---|
| 177 | t/00-compile.t t/01-serialize.t t/04-config.t \ |
|---|
| 178 | t/05-errorhandler.t t/07-builder.t t/08-util.t \ |
|---|
| 179 | t/09-image.t t/10-filemgr.t t/11-sanitize.t t/12-dsa.t \ |
|---|
| 180 | t/13-dirify.t t/20-setup.t t/21-callbacks.t t/22-author.t\ |
|---|
| 181 | t/23-entry.t t/26-pings.t t/27-context.t t/28-xmlrpc.t \ |
|---|
| 182 | t/29-cleanup.t t/32-mysql.t t/33-postgres.t \ |
|---|
| 183 | t/34-sqlite.t t/35-tags.t t/45-datetime.t t/46-i18n-en.t \ |
|---|
| 184 | t/47-i18n-ja.t t/48-cache.t |
|---|
| 185 | |
|---|
| 186 | dist: |
|---|
| 187 | perl build/exportmt.pl --local |
|---|
| 188 | |
|---|
| 189 | me: |
|---|
| 190 | perl build/exportmt.pl --make |
|---|
| 191 | |
|---|
| 192 | clean: |
|---|
| 193 | -rm -rf lib/MT.pm mt-config.cgi-original mt-check.cgi $(latin1_modules) $(local_js) |
|---|
| 194 | -rm -rf php/mt.php |
|---|
| 195 | -rm -rf mt-static/js/mt_core_compact.js |
|---|
| 196 | -rm -rf mt-static/css/main.css mt-static/css/simple.css |
|---|
| 197 | -rm -rf index.html |
|---|
| 198 | -rm -rf readme.html |
|---|
| 199 | -rm -rf MANIFEST |
|---|
| 200 | -rm -rf build-language-stamp |
|---|
| 201 | |
|---|