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