4 use ExtUtils::MakeMaker;
6 # Add a few more targets.
11 install:: extra_install
12 pure_install:: extra_install
14 VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
16 # Parameterized programs used by Makefile.
20 # Additional configurable path variables.
21 W3M_CGI_BIN?=$(PREFIX)/lib/w3m/cgi-bin
22 SYSCONFDIR?=/etc/ikiwiki
23 MANDIR?=$(PREFIX)/share/man
25 tflag=$(shell if [ -n "$$NOTAINT" ] && [ "$$NOTAINT" != 1 ]; then printf -- "-T"; fi)
26 extramodules=$(shell if [ "$$PROFILE" = 1 ]; then printf -- "-d:NYTProf"; fi)
27 outprogs=ikiwiki.out ikiwiki-transition.out ikiwiki-calendar.out ikiwiki-comment.out
28 scripts=ikiwiki-update-wikilist ikiwiki-makerepo
29 sysconfdir_scripts=ikiwiki-mass-rebuild ikiwiki-update-wikilist
30 shebang_scripts=$(shell $(FIND) . -type f \( -name '*.in' -o -name '*.cgi' -o -name '*.pm' -o -name '*.pm.example' -o -name '*.t' -o -name '*.setup' -o -name 'ikiwiki-comment' -o -name 'ikiwiki-mass-rebuild' -o -name 'ikiwiki-update-wikilist' -o -name 'gitremotes' -o -name 'mdwn2man' -o -name 'pm_filter' -o -name 'po2wiki' -o -name 'externaldemo' \))
32 PROBABLE_INST_LIB=$(shell \\
33 if [ "$(INSTALLDIRS)" = "perl" ]; then \\
34 echo $(INSTALLPRIVLIB); \\
35 elif [ "$(INSTALLDIRS)" = "site" ]; then \\
36 echo $(INSTALLSITELIB); \\
37 elif [ "$(INSTALLDIRS)" = "vendor" ]; then \\
38 echo $(INSTALLVENDORLIB); \\
43 ./pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB) < $< > $@
47 HOME=/home/me $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in --dumpsetup ikiwiki.setup
49 extra_build: perl_shebangs $(outprogs) ikiwiki.setup docwiki sysconfdir
50 ./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
51 ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
52 ./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
53 ./mdwn2man ikiwiki-transition 1 doc/ikiwiki-transition.mdwn > ikiwiki-transition.man
54 ./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
55 ./mdwn2man ikiwiki-calendar 1 doc/ikiwiki-calendar.mdwn > ikiwiki-calendar.man
56 ./mdwn2man ikiwiki-comment 1 doc/ikiwiki-comment.mdwn > ikiwiki-comment.man
58 $(PERL) -pi.bkp -e "s/Version:.*/Version: $(VER)/" ikiwiki.spec
59 rm -f ikiwiki.spec.bkp
62 $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in --setup docwiki.setup --refresh
64 perl_shebangs: pm_to_blib
65 ifneq "$(PERL)" "/usr/bin/perl"
67 for file in $(shebang_scripts); do \
68 $(PERL) -pe "s|^#!/usr/bin/perl\b|#!$(PERL)| if 1" < $$file > "$$file.new"; \
69 [ -x $$file ] && chmod +x "$$file.new"; \
70 mv -f "$$file.new" $$file; \
75 ifneq "$(PERL)" "/usr/bin/perl"
77 for file in $(shebang_scripts); do \
78 $(PERL) -pe "s|^#!$(PERL)\b|#!/usr/bin/perl| if 1" < $$file > "$$file.new"; \
79 [ -x $$file ] && chmod +x "$$file.new"; \
80 mv -f "$$file.new" $$file; \
85 $(PERL) -pi -e "s|\"/etc/ikiwiki|\"$(SYSCONFDIR)|g" $(sysconfdir_scripts)
87 extra_clean: perl_shebangs_clean
88 $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in --setup docwiki.setup --clean
89 rm -f *.man $(outprogs) ikiwiki.setup plugins/*.pyc
93 git checkout po ikiwiki.spec
95 # Joey uses this before committing.
96 myclean: clean reset-generated
99 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
101 for dir in `$(FIND) underlays -follow -mindepth 1 -type d | $(SED) -e 's|^underlays/||'`; do \
102 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
103 for file in `$(FIND) underlays/$$dir -follow -maxdepth 1 -type f ! -name jquery.js ! -name jquery-ui.css ! -name jquery-ui.js ! -name jquery.tmpl.js`; do \
104 if ! cp -pRL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir 2>/dev/null; then \
105 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
110 # The directive docs become their own special underlay.
111 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive
113 for file in doc/ikiwiki/directive/*; do \
114 if [ -f "$$file" ]; then \
115 if ! cp -pRL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive 2>/dev/null; then \
116 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
121 # Themes have their base.css (if present) and then
122 # style.css appended to the normal one.
124 for theme in themes/*; do \
125 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme; \
126 for file in $$theme/*; do \
127 if echo "$$file" | grep -q style.css; then \
128 (cat doc/style.css; cat $$theme/base.css 2>/dev/null || :; cat $$file) > $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
129 elif echo "$$file" | grep -q base.css; then \
131 elif [ -f "$$file" ]; then \
132 if ! cp -pRL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file 2>/dev/null; then \
133 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file; \
139 extra_install: underlay_install
140 # Install example sites.
142 for dir in `$(FIND) doc/examples -type d ! -regex '.*discussion.*' | $(SED) -e 's|^doc/examples/||'`; do \
143 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
146 for file in `$(FIND) doc/examples -type f ! -regex '.*discussion.*' | $(SED) -e 's|^doc/examples/||'`; do \
147 if ! cp -pRL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null; then \
148 install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
153 for dir in `$(FIND) templates -follow -type d`; do \
154 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
155 for file in `$(FIND) $$dir -follow -maxdepth 1 -type f`; do \
156 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
160 install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
162 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
163 install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
166 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
167 install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
170 install -d $(DESTDIR)$(MANDIR)/man1
171 install -m 644 ikiwiki.man $(DESTDIR)$(MANDIR)/man1/ikiwiki.1
172 install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(MANDIR)/man1/ikiwiki-makerepo.1
173 install -m 644 ikiwiki-transition.man $(DESTDIR)$(MANDIR)/man1/ikiwiki-transition.1
174 install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(MANDIR)/man1/ikiwiki-update-wikilist.1
175 install -m 644 ikiwiki-calendar.man $(DESTDIR)$(MANDIR)/man1/ikiwiki-calendar.1
176 install -m 644 ikiwiki-comment.man $(DESTDIR)$(MANDIR)/man1/ikiwiki-comment.1
178 install -d $(DESTDIR)$(MANDIR)/man8
179 install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(MANDIR)/man8/ikiwiki-mass-rebuild.8
181 install -d $(DESTDIR)$(PREFIX)/sbin
182 install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
184 install -d $(DESTDIR)$(W3M_CGI_BIN)
185 install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
187 install -d $(DESTDIR)$(PREFIX)/bin
189 for prog in $(outprogs) $(scripts); do \
190 install $$prog $(DESTDIR)$(PREFIX)/bin/$$(echo $$prog | $(SED) 's/\.out//'); \
193 $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
195 # These might fail if a regular user is installing into a home
197 -install -d $(DESTDIR)$(SYSCONFDIR)
198 -install -m 0644 wikilist $(DESTDIR)$(SYSCONFDIR)
199 -install -m 0644 auto.setup $(DESTDIR)$(SYSCONFDIR)
200 -install -m 0644 auto-blog.setup $(DESTDIR)$(SYSCONFDIR)
202 # The git/hg plugins want to chdir; so does Devel::Cover. Skip those tests
203 # to stop them hurting each other.
206 $(MAKE) test PERL5OPT=-MDevel::Cover PERL5LIB=. TEST_FILES="$(filter-out t/git.t t/mercurial.t,$(wildcard t/*.t))"
210 git archive --format=tar --prefix=IkiWiki-$(VER)/ HEAD | xz -c > IkiWiki-$(VER).tar.xz
216 PREFIX => "/usr/local",
217 PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
220 'XML::Simple' => "0",
221 'Text::Markdown' => "0",
222 'Date::Parse' => "0",
223 'HTML::Template' => "0",
224 'HTML::Scrubber' => "0",
225 'CGI::FormBuilder' => "3.02.02",
226 'CGI::Session' => "0",
227 'Mail::Sendmail' => "0",
228 'HTML::Parser' => "0",
230 'Data::Dumper' => "2.11",