summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8c10c7f08fe4effd8e8a3603f9d0286fb5a28630 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
NAME=photoalbum
#DESTDIR=/
all: version build
version:
	cut -d' ' -f2 changelog | head -n 1 | sed 's/(//;s/)//' > .version
build:
	test ! -d ./bin && mkdir ./bin || exit 0
	sed "s/PHOTOALBUMVERSION/$$(cat .version)/" src/$(NAME).sh > ./bin/$(NAME)
	chmod 0755 ./bin/$(NAME)
install:
	test ! -d $(DESTDIR)/usr/bin && mkdir -p $(DESTDIR)/usr/bin || exit 0
	cp ./bin/* $(DESTDIR)/usr/bin
	test ! -d $(DESTDIR)/usr/share/photoalbum/templates && mkdir -p $(DESTDIR)/usr/share/photoalbum/templates || exit 0
	cp -R ./share/templates $(DESTDIR)/usr/share/photoalbum/
	test ! -d $(DESTDIR)/etc/default && mkdir -p $(DESTDIR)/etc/default || exit 0
	cp ./src/photoalbum.default.conf $(DESTDIR)/etc/default/photoalbum
deinstall:
	test ! -z "$(DESTDIR)" && test -f $(DESTDIR)/usr/bin/$(NAME) && rm $(DESTDIR)/usr/bin/$(NAME) || exit 0
	test ! -z "$(DESTDIR)" && test -d $(DESTDIR)/usr/share/$(NAME) && rm -r $(DESTDIR)/usr/share/$(NAME) || exit 0
	test ! -z "$(DESTDIR)" && test -f $(DESTDIR)/etc/default/photoalbum && rm $(DESTDIR)/etc/default/photoalbum || exit 0
clean:
	test -d ./bin && rm -Rf ./bin || exit 0
	test -d ./debian/photoalbum && rm -Rf ./debian/photoalbum || exit 0
# Builds the documentation into a manpage
shellcheck:
	# SC1090: ShellCheck can't follow non-constant source. Use a directive to specify location.
  # SC2012: Use find instead of ls to better handle non-alphanumeric filenames.
  # SC2155: Declare and assign separately to avoid masking return values.
  # SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
  # SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
	shellcheck \
		--exclude SC1090 \
    --exclude SC2012 \
  	--exclude SC2155 \
    --exclude SC2164 \
    --exclude SC2207 \
		./src/photoalbum.sh