report_options: Syntax fix
[ninja.git] / Makefile
blob7ba394fb63a3d0473d602918f51c8c0eb106f67b
1 GENERATE_PHP_MODS=
2 OP5LIBCFG=test/configs/all-host_service-states/op5lib
4 all: generate-css generate-php
6 help:
7 @echo
8 @echo Available make targets:
9 @echo -----------------------
10 @$(MAKE) --print-data-base --question | sed -n -e '/^Makefile/d' -e 's/^\([A-Za-z0-9_-]*\):.*/\1/p'
11 @echo
13 install-sass:
14 gem install compass
16 generate-css:
17 which compass || (echo "Run make install-sass to install the necessary prerequisites for generating CSS" && exit 1)
18 for skin in application/views/css/*; do \
19 compass compile --trace --boring $$skin; \
20 done
21 # Generate css for listviews
22 compass compile --trace --boring modules/lsfilter/views/css/
24 # making the *-php targets work in your checked out environment: add
25 # path/to/system-addons/op5lib/php to your global php.ini's include_path
26 regenerate-php:
27 $(MAKE) -C src/generators regenerate
29 generate-php:
30 $(MAKE) -C src/generators
32 clean-php:
33 $(MAKE) -C src/generators clean
35 test: test-reports test-unittest
37 test-reports:
38 make test-ci-prepare
39 export OP5LIBCFG="$(OP5LIBCFG)"; php index.php ninja_unit_test/reports test/unit_test/reports/*.tst; res=$$?; make test-ci-cleanup; exit $$res
41 test-unittest: generate-php
42 make test-ci-prepare
43 export OP5LIBCFG="$(OP5LIBCFG)"; phpunit --bootstrap test/unit_test/bootstrap.php test/unit_test/tests/; res=$$?; make test-ci-cleanup; exit $$res
45 test-ci-cleanup:
46 rm -f application/config/custom/config.php
47 rm -f application/config/custom/database.php
48 if [ -e /tmp/ninja-test/var/merlin.pid ]; then kill $$(cat /tmp/ninja-test/var/merlin.pid) || :; fi
49 if [ -e /tmp/ninja-test/nagios.cmd ]; then /bin/echo "[$$(date +%s)] SHUTDOWN_PROGRAM" >> /tmp/ninja-test/nagios.cmd; /bin/sleep 5; rm /tmp/ninja-test/nagios.cmd; fi
51 test-ci-prepare: test-ci-cleanup prepare-config
52 chmod -R 0777 /tmp/ninja-test/var
53 mkdir -m 0777 -p /tmp/ninja-test/var/spool/checkresults
54 /opt/monitor/op5/merlin/install-merlin.sh --batch --install=db --db-name=merlin_test
55 export OP5LIBCFG="$(OP5LIBCFG)"; install_scripts/ninja_db_init.sh --db-name=merlin_test
56 /usr/bin/merlind -c /tmp/ninja-test/merlin.conf
57 /usr/bin/monitor -d /tmp/ninja-test/nagios.cfg
59 test-php-lint:
60 for i in `find . -name "*.php"`; do php -l $$i > /dev/null || exit "Syntax error in $$i"; done
62 docs: Documentation
64 clean: clean-php
65 rm -rf Documentation
67 Documentation: clean ninja.doxy application/models/*.php application/helpers/*.php
68 a=$$(doxygen ninja.doxy 2>&1); \
69 if [[ -n $$a ]]; then \
70 echo "$$a"; \
71 exit 1; \
72 fi;
74 wipe:
75 php index.php ninja_unit_test/wipe_tables
77 prepare-config:
78 mkdir -m 0777 -p /tmp/ninja-test
79 mkdir -m 0777 -p /tmp/ninja-test/var
80 mkdir -m 0777 -p /tmp/ninja-test/var/archives
81 cp test/configs/all-host_service-states/etc/*.cfg /tmp/ninja-test/
82 sed -e "s|@@TESTDIR@@|/tmp/ninja-test|" -e "s|@@USER@@|$$(id -un)|" -e "s|@@GROUP@@|$$(id -gn)|" -e "s|@@LIBDIR@@|$$(rpm --eval %{_libdir})|" test/configs/all-host_service-states/etc/nagios.cfg.in > /tmp/ninja-test/nagios.cfg
83 sed -e "s|@@TESTDIR@@|/tmp/ninja-test|" -e "s|@@USER@@|$$(id -un)|" -e "s|@@GROUP@@|$$(id -gn)|" -e "s|@@LIBDIR@@|$$(rpm --eval %{_libdir})|" test/configs/all-host_service-states/etc/merlin.conf.in > /tmp/ninja-test/merlin.conf
84 cp test/configs/all-host_service-states/var/status.sav /tmp/ninja-test/var/status.sav
85 echo "<?php \$$config['nagios_pipe'] = '/tmp/ninja-test/nagios.cmd';\$$config['nagios_base_path'] = '/tmp/ninja-test';\$$config['nagios_etc_path'] = '/tmp/ninja-test';" > application/config/custom/config.php
86 echo "<?php \$$config['default']['connection']['database'] = 'merlin_test';" > application/config/custom/database.php
87 echo "path: /tmp/ninja-test/live" > $(OP5LIBCFG)/livestatus.yml
88 echo "socket_path: /tmp/ninja-test/nagios.qh" > $(OP5LIBCFG)/queryhandler.yml
90 i18n:
91 xgettext --debug --output=application/languages/en/en.po \
92 -j --package-name=ninja \
93 --from-code utf-8 -L php $$(find . -name '*.php')
95 .PHONY: test help test-reports clean