prefix = /usr/local all: ./po2mo.sh clean: if [ -d $(srcdir)share/locale ]; then \ rm -r $(srcdir)share/locale; \ fi install: all install -Dm644 $(srcdir)COPYING $(prefix)/share/doc/shutter/COPYING install -Dm644 $(srcdir)README $(prefix)/share/doc/shutter/README install -Dm755 $(srcdir)bin/shutter $(prefix)/bin/shutter cp -r $(srcdir)share/ $(prefix)/ mkdir -p $(prefix)/share/shutter/lib cp -r $(srcdir)lib/. $(prefix)/share/shutter/lib/ # compat: third-party plugins load modules from resources/modules rm -rf $(prefix)/share/shutter/resources/modules ln -s ../lib $(prefix)/share/shutter/resources/modules uninstall: rm $(prefix)/bin/shutter rm $(prefix)/share/metainfo/shutter.metainfo.xml rm $(prefix)/share/applications/shutter.desktop rm -r $(prefix)/share/doc/shutter/ rm $(prefix)/share/man/man1/shutter.1 rm $(prefix)/share/pixmaps/shutter.png rm -r $(prefix)/share/shutter/ rm $(prefix)/share/icons/HighContrast/scalable/apps/shutter.svg rm $(prefix)/share/icons/HighContrast/scalable/apps/shutter-panel.svg for size in 128x128 16x16 192x192 22x22 24x24 256x256 32x32 36x36 48x48 64x64 72x72 96x96; do \ rm $(prefix)/share/icons/hicolor/$$size/apps/shutter.png; \ done for size in 16x16 22x22 24x24; do \ rm $(prefix)/share/icons/hicolor/$$size/apps/shutter-panel.png; \ done rm $(prefix)/share/icons/hicolor/scalable/apps/shutter-panel.svg rm $(prefix)/share/icons/hicolor/scalable/apps/shutter.svg for locale in $(prefix)/share/locale/*; do \ for mofile in shutter.mo shutter-plugins.mo shutter-upload-plugins.mo; do \ if [ -f $$locale/LC_MESSAGES/$$mofile ]; then \ rm $$locale/LC_MESSAGES/$$mofile; \ fi \ done \ done # --------------------------------------------------------------------------- # Quality gates # # make test full suite incl. end-to-end smoke test, in a private X11 # session (t/bin/with-x11: Xvfb + openbox + D-Bus, Wayland env # stripped). VISIBLE=1 uses Xephyr so you can watch it. # make boot start bin/shutter for 15s and fail on Perl runtime errors # make lint perltidy + perlcritic, enforced only on files added since the # fork point (ratchet: legacy code is not blocked, new code is) # make check lint + test; run before every commit # --------------------------------------------------------------------------- FORK_POINT ?= 43b5243 TEST_INC = -I lib -I t/lib WITH_X11 = t/bin/with-x11 BOOT_ERRORS = Undefined subroutine|Can't locate|Global symbol|Not a CODE|Can't call method|syntax error|died|Bareword NEW_PERL = $(sort $(shell git diff --name-only --diff-filter=A $(FORK_POINT) -- '*.pm' '*.pl' '*.t' 2>/dev/null) \ $(shell git ls-files --others --exclude-standard -- '*.pm' '*.pl' '*.t' 2>/dev/null)) .PHONY: test test-unit boot lint check test: SHUTTER_SMOKE_REQUIRED=1 $(WITH_X11) prove $(TEST_INC) -r t # Everything except the smoke test (faster inner loop) test-unit: $(WITH_X11) prove $(TEST_INC) -r t/Shutter t/syntax.t # No window manager here, so the app idles in its main loop until killed; # that is expected. We only care that startup produced no Perl errors. boot: @h=$$(mktemp -d); \ HOME=$$h XDG_CONFIG_HOME=$$h/.config XDG_CACHE_HOME=$$h/.cache \ $(WITH_X11) timeout -k 3 15 perl bin/shutter --debug -n --disable_systray > $$h/boot.log 2>&1; \ if grep -nE "$(BOOT_ERRORS)" $$h/boot.log; then echo "boot: FAILED (log: $$h/boot.log)"; exit 1; fi; \ echo "boot: OK (no Perl runtime errors in 15s of startup)"; rm -rf $$h lint: @if [ -z "$(NEW_PERL)" ]; then echo "lint: no files added since $(FORK_POINT)"; exit 0; fi; \ fail=0; \ for f in $(NEW_PERL); do \ perltidy --profile=.perltidyrc -st "$$f" | cmp -s - "$$f" || { echo "perltidy: $$f is not tidy (run: perltidy --profile=.perltidyrc -b -bext='/' $$f)"; fail=1; }; \ done; \ perlcritic --profile .perlcriticrc $(NEW_PERL) || fail=1; \ exit $$fail check: lint test