A simple application to send CSP violation reports to an email address
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.5 KiB

  1. SHELL = /bin/bash
  2. # use bash strict mode
  3. .SHELLFLAGS := -eu -o pipefail -c
  4. .ONESHELL:
  5. .DELETE_ON_ERROR:
  6. # check if recipeprefix is supported
  7. ifeq ($(origin .RECIPEPREFIX), undefined)
  8. $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
  9. endif
  10. .RECIPEPREFIX = >
  11. .SUFFIXES: # delete the default suffixe
  12. .SUFFIXES: .go # add .go as suffix
  13. PREFIX?=/usr/local
  14. _INSTDIR=$(DESTDIR)$(PREFIX)
  15. BINDIR?=$(_INSTDIR)/bin
  16. GO?=go
  17. GOFLAGS?=
  18. RM?=rm -f # Exists in GNUMake but not in NetBSD make and others.
  19. build:
  20. > $(GO) build $(GOFLAGS) -o csp-handler .
  21. run: build
  22. > ./csp-handler
  23. install: build
  24. > useradd -MUr csp-handler
  25. > install -m755 -gcsp-handler -ocsp-handler csp-handler $(BINDIR)/csp-handler
  26. > mkdir -p /etc/csp-handler
  27. > chown -R csp-handler:csp-handler /etc/csp-handler
  28. > if [ ! -f "/etc/csp-handler/config.toml" ]; then
  29. > install -m600 -gcsp-handler -ocsp-handler configs/config.example.toml /etc/csp-handler/config.toml
  30. > fi
  31. install-systemd:
  32. > install -m644 -groot -oroot init/csp-handler.service /etc/systemd/system/csp-handler.service
  33. > systemctl daemon-reload
  34. clean:
  35. > $(RM) csp-handler
  36. RMDIR_IF_EMPTY:=sh -c '\
  37. if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
  38. rmdir $$0; \
  39. fi'
  40. uninstall:
  41. > $(RM) $(BINDIR)/csp-handler
  42. > $(RMDIR_IF_EMPTY) /etc/csp-handler
  43. uninstall-systemd:
  44. > $(RM) /etc/systemd/system/csp-handler.service
  45. > systemctl daemon-reload
  46. .DEFAULT_GOAL = build
  47. .PHONY: all build install uninstall clean install-systemd