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
23 tflag=$(shell if [ -n "$$NOTAINT" ] && [ "$$NOTAINT" != 1 ]; then printf -- "-T"; fi)
24 extramodules=$(shell if [ "$$PROFILE" = 1 ]; then printf -- "-d:NYTProf"; fi)
25 outprogs=ikiwiki.out ikiwiki-transition.out ikiwiki-calendar.out
26 scripts=ikiwiki-update-wikilist ikiwiki-makerepo
28 PROBABLE_INST_LIB=$(shell \\
29 if [ "$(INSTALLDIRS)" = "perl" ]; then \\
30 echo $(INSTALLPRIVLIB); \\
31 elif [ "$(INSTALLDIRS)" = "site" ]; then \\
32 echo $(INSTALLSITELIB); \\
33 elif [ "$(INSTALLDIRS)" = "vendor" ]; then \\
34 echo $(INSTALLVENDORLIB); \\
39 ./pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB) < $< > $@
43 HOME=/home/me $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -dumpsetup ikiwiki.setup
45 extra_build: $(outprogs) ikiwiki.setup docwiki
46 ./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
47 ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
48 ./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
49 ./mdwn2man ikiwiki-transition 1 doc/ikiwiki-transition.mdwn > ikiwiki-transition.man
50 ./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
51 ./mdwn2man ikiwiki-calendar 1 doc/ikiwiki-calendar.mdwn > ikiwiki-calendar.man
53 $(SED) -i.bkp "s/Version:.*/Version: $(VER)/" ikiwiki.spec
54 rm -f ikiwiki.spec.bkp
57 $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -setup docwiki.setup -refresh
60 $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -setup docwiki.setup -clean
61 rm -f *.man $(outprogs) ikiwiki.setup plugins/*.pyc
64 # Joey uses this before committing.
66 git checkout po ikiwiki.spec
69 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
70 for dir in `cd underlays && $(FIND) . -follow -type d ! -regex '.*\.svn.*'`; do \
71 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
72 for file in `$(FIND) underlays/$$dir -follow -maxdepth 1 -type f`; do \
73 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir 2>/dev/null || \
74 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
78 # The directive docs become their own special underlay.
79 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive
80 for file in doc/ikiwiki/directive/*; do \
81 if [ -f "$$file" ]; then \
82 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive 2>/dev/null || \
83 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
87 # Themes have their base.css (if present) and then
88 # style.css appended to the normal one.
89 for theme in themes/*; do \
90 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme; \
91 for file in $$theme/*; do \
92 if echo "$$file" | grep -q style.css; then \
93 (cat doc/style.css; cat $$theme/base.css 2>/dev/null; cat $$file) >> $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
94 elif echo "$$file" | grep -q base.css; then \
96 elif [ -f "$$file" ]; then \
97 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file 2>/dev/null || \
98 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file; \
103 extra_install: underlay_install
104 # Install example sites.
105 for dir in `cd doc/examples; $(FIND) . -type d ! -regex '.*\.svn.*'`; do \
106 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
108 for file in `cd doc/examples; $(FIND) . -type f ! -regex '.*\.svn.*'`; do \
109 cp -aL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null || \
110 install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
113 for dir in `$(FIND) templates -follow -type d ! -regex '.*\.svn.*'`; do \
114 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
115 for file in `$(FIND) $$dir -follow -maxdepth 1 -type f`; do \
116 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
120 install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
121 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
122 install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
124 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
125 install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
128 install -d $(DESTDIR)$(PREFIX)/share/man/man1
129 install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
130 install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
131 install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
132 install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
133 install -m 644 ikiwiki-calendar.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-calendar.1
135 install -d $(DESTDIR)$(PREFIX)/share/man/man8
136 install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
138 install -d $(DESTDIR)$(PREFIX)/sbin
139 install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
141 install -d $(DESTDIR)$(W3M_CGI_BIN)
142 install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
144 install -d $(DESTDIR)$(PREFIX)/bin
145 for prog in $(outprogs) $(scripts); do \
146 install $$prog $(DESTDIR)$(PREFIX)/bin/$$(echo $$prog | $(SED) 's/\.out//'); \
149 $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
151 # These might fail if a regular user is installing into a home
153 -install -d $(DESTDIR)/etc/ikiwiki
154 -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
155 -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
156 -install -m 0644 auto-blog.setup $(DESTDIR)/etc/ikiwiki
162 PREFIX => "/usr/local",
163 PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
166 'XML::Simple' => "0",
167 'Text::Markdown' => "0",
168 'Date::Parse' => "0",
169 'HTML::Template' => "0",
170 'HTML::Scrubber' => "0",
171 'CGI::FormBuilder' => "3.02.02",
172 'CGI::Session' => "0",
173 'Mail::Sendmail' => "0",
174 'HTML::Parser' => "0",
176 'Data::Dumper' => "2.11",