| 1 | .PHONY: config-stamp | 
|---|
| 2 |  | 
|---|
| 3 | SHELL=/bin/sh | 
|---|
| 4 | DIST=_dist | 
|---|
| 5 | DC=$(DIST)/dotclear | 
|---|
| 6 |  | 
|---|
| 7 | default: | 
|---|
| 8 |      @echo "make config or make dist" | 
|---|
| 9 |  | 
|---|
| 10 | config: clean config-stamp | 
|---|
| 11 |      mkdir -p ./$(DC) | 
|---|
| 12 |  | 
|---|
| 13 |      ## Copy needed folders and files | 
|---|
| 14 |      cp -pRf ./admin ./inc ./index.php ./CHANGELOG ./CREDITS ./LICENSE ./README.md ./CONTRIBUTING.md ./$(DC)/ | 
|---|
| 15 |  | 
|---|
| 16 |      ## Locales directory | 
|---|
| 17 |      mkdir -p ./$(DC)/locales | 
|---|
| 18 |      cp -pRf ./locales/README ./locales/en ./locales/fr ./$(DC)/locales/ | 
|---|
| 19 |  | 
|---|
| 20 |      ## Remove tests directories and test stuff | 
|---|
| 21 |      rm -fr ./$(DC)/inc/libs/clearbricks/tests ./$(DC)/inc/libs/clearbricks/composer.* \ | 
|---|
| 22 |             ./$(DC)/inc/libs/clearbricks/.atoum.* ./$(DC)/inc/libs/clearbricks/vendor \ | 
|---|
| 23 |             ./$(DC)/inc/libs/clearbricks/bin ./$(DC)/inc/libs/clearbricks/_dist | 
|---|
| 24 |  | 
|---|
| 25 |      ## Create cache, db, plugins and public folders | 
|---|
| 26 |      mkdir ./$(DC)/cache ./$(DC)/db ./$(DC)/plugins ./$(DC)/public ./$(DC)/themes | 
|---|
| 27 |      cp -p inc/.htaccess ./$(DC)/cache/ | 
|---|
| 28 |      cp -p inc/.htaccess ./$(DC)/db/ | 
|---|
| 29 |      cp -p inc/.htaccess ./$(DC)/plugins/ | 
|---|
| 30 |  | 
|---|
| 31 |      ## Remove config file if any | 
|---|
| 32 |      rm -f ./$(DC)/inc/config.php | 
|---|
| 33 |  | 
|---|
| 34 |      ## Copy built-in themes | 
|---|
| 35 |      cp -pRf \ | 
|---|
| 36 |      ./themes/default \ | 
|---|
| 37 |      ./themes/blueSilence \ | 
|---|
| 38 |      ./themes/customCSS \ | 
|---|
| 39 |      ./themes/ductile \ | 
|---|
| 40 |      ./themes/berlin \ | 
|---|
| 41 |      ./$(DC)/themes/ | 
|---|
| 42 |  | 
|---|
| 43 |      ## Copy built-in plugins based on DC_DISTRIB_PLUGINS constant | 
|---|
| 44 |      cp -pRf $$(grep DC_DISTRIB_PLUGINS inc/prepend.php | \ | 
|---|
| 45 |           sed -e "s/.*,'//" -e "s/'.*//" | \ | 
|---|
| 46 |           sed -e  's/\(^\|,\)/ .\/plugins\//g') \ | 
|---|
| 47 |      ./$(DC)/plugins/ | 
|---|
| 48 |  | 
|---|
| 49 |      ## "Compile" .po files | 
|---|
| 50 |      ./build-tools/make-l10n.php ./$(DC)/ | 
|---|
| 51 |  | 
|---|
| 52 |      ## Pack javascript files | 
|---|
| 53 |      find $(DC)/admin/js/*.js -exec ./build-tools/min-js.php \{\} \; | 
|---|
| 54 |      find $(DC)/admin/js/ie7/*.js -exec ./build-tools/min-js.php \{\} \; | 
|---|
| 55 |      find $(DC)/admin/js/jquery/*.js -exec ./build-tools/min-js.php \{\} \; | 
|---|
| 56 |      find $(DC)/admin/js/jsUpload/*.js -exec ./build-tools/min-js.php \{\} \; | 
|---|
| 57 |      find $(DC)/plugins -name '*.js' -exec ./build-tools/min-js.php \{\} \; | 
|---|
| 58 |      find $(DC)/themes/default/js/*.js -exec ./build-tools/min-js.php \{\} \; | 
|---|
| 59 |  | 
|---|
| 60 |      ## Debug off | 
|---|
| 61 |      perl -pi -e "s|^//\*== DC_DEBUG|/*== DC_DEBUG|sgi;" $(DC)/inc/prepend.php $(DC)/inc/prepend.php | 
|---|
| 62 |  | 
|---|
| 63 |      ## Remove scm files and folders from DC and CB | 
|---|
| 64 |      find ./$(DIST)/ -type d -name '.svn' | xargs -r rm -rf | 
|---|
| 65 |      find ./$(DIST)/ -type d -name '.hg'  | xargs -r rm -rf | 
|---|
| 66 |      find ./$(DIST)/ -type d -name '.git' | xargs -r rm -rf | 
|---|
| 67 |      find ./$(DIST)/ -type f -name '.*ignore' | xargs -r rm -rf | 
|---|
| 68 |  | 
|---|
| 69 |      ## Create digest | 
|---|
| 70 |      cd $(DC) && ( \ | 
|---|
| 71 |           md5sum `find . -type f -not -path "./inc/digest" -not -path "./cache/*" -not -path "./db/*" -not -path ./CHANGELOG` \ | 
|---|
| 72 |           > inc/digests \ | 
|---|
| 73 |      ) | 
|---|
| 74 |  | 
|---|
| 75 |      touch config-stamp | 
|---|
| 76 |  | 
|---|
| 77 | dist: config dist-tgz dist-zip dist-l10n | 
|---|
| 78 |  | 
|---|
| 79 | deb: | 
|---|
| 80 |      cp ./README.md debian/README | 
|---|
| 81 |      dpkg-buildpackage -rfakeroot | 
|---|
| 82 |  | 
|---|
| 83 | dist-tgz: | 
|---|
| 84 |      [ -f config-stamp ] | 
|---|
| 85 |      cd $(DIST) && tar cfz dotclear-$$(grep DC_VERSION dotclear/inc/prepend.php | cut -d"'" -f4).tar.gz ./dotclear | 
|---|
| 86 |  | 
|---|
| 87 | dist-zip: | 
|---|
| 88 |      [ -f config-stamp ] | 
|---|
| 89 |      cd $(DIST) && zip -r9 dotclear-$$(grep DC_VERSION dotclear/inc/prepend.php | cut -d"'" -f4).zip ./dotclear | 
|---|
| 90 |  | 
|---|
| 91 | dist-l10n: | 
|---|
| 92 |      [ -f config-stamp ] | 
|---|
| 93 |  | 
|---|
| 94 |      rm -rf ./$(DIST)/l10n | 
|---|
| 95 |      mkdir -p ./$(DIST)/l10n | 
|---|
| 96 |  | 
|---|
| 97 |      find ./locales/ -maxdepth 1 -mindepth 1 -type d -not -name '.svn' -not -name '_pot' -not -name 'en' \ | 
|---|
| 98 |      -exec cp -pRf \{\} ./$(DIST)/l10n/ \; | 
|---|
| 99 |  | 
|---|
| 100 |      find ./$(DIST)/l10n -type d -name '.svn' | xargs rm -rf | 
|---|
| 101 |      ./build-tools/make-l10n.php ./$(DIST)/l10n/ | 
|---|
| 102 |  | 
|---|
| 103 |      cd ./$(DIST)/l10n && for i in *; do \ | 
|---|
| 104 |           zip -r9 "$$i-$$(grep DC_VERSION ../dotclear/inc/prepend.php | cut -d"'" -f4).zip" "$$i"; \ | 
|---|
| 105 |           rm -rf "$$i"; \ | 
|---|
| 106 |      done | 
|---|
| 107 |  | 
|---|
| 108 |  | 
|---|
| 109 | clean: | 
|---|
| 110 |      rm -rf $(DIST) config-stamp | 
|---|
| 111 |  | 
|---|
| 112 |  | 
|---|
| 113 | ## Modules (Themes and Plugins) ############################################### | 
|---|
| 114 | pack-tool: | 
|---|
| 115 |      [ "$(ipath)" != '' ] | 
|---|
| 116 |      [ "$(iname)" != '' ] | 
|---|
| 117 |      [ "$(iname)" != '' ] | 
|---|
| 118 |      [ -d $(ipath)/$(iname) ] | 
|---|
| 119 |  | 
|---|
| 120 |  | 
|---|
| 121 | copy-plugins: clean | 
|---|