1#
2# Copyright (C) 2013
3# Matthieu Moy <Matthieu.Moy@imag.fr>
4#
5# To build and test:
6#
7# make
8# bin-wrapper/git mw preview Some_page.mw
9# bin-wrapper/git clone mediawiki::http://example.com/wiki/
10#
11# To install, run Git's toplevel 'make install' then run:
12#
13# make install
14
15GIT_MEDIAWIKI_PM=Git/Mediawiki.pm
16SCRIPT_PERL=git-remote-mediawiki.perl
17SCRIPT_PERL+=git-mw.perl
18GIT_ROOT_DIR=../..
19HERE=contrib/mw-to-git/
20
21INSTALL = install
22
23SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL))
24INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \
25 -s --no-print-directory instlibdir)
26DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
27INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
28
29all: build
30
31test: all
32 $(MAKE) -C t
33
34check: perlcritic test
35
36install_pm:
37 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(INSTLIBDIR_SQ)/Git'
38 $(INSTALL) -m 644 $(GIT_MEDIAWIKI_PM) \
39 '$(DESTDIR_SQ)$(INSTLIBDIR_SQ)/$(GIT_MEDIAWIKI_PM)'
40
41build:
42 $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL="$(SCRIPT_PERL_FULL)" \
43 build-perl-script
44
45install: install_pm
46 $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL="$(SCRIPT_PERL_FULL)" \
47 install-perl-script
48
49clean:
50 $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL="$(SCRIPT_PERL_FULL)" \
51 clean-perl-script
52
53perlcritic:
54 perlcritic -5 $(SCRIPT_PERL)
55 -perlcritic -2 $(SCRIPT_PERL)
56
57.PHONY: all test check install_pm install clean perlcritic