diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile | 67 |
1 files changed, 66 insertions, 1 deletions
@@ -1,3 +1,12 @@ +PREFIX = /usr +BINDIR = $(PREFIX)/bin +DATADIR = $(PREFIX)/share +MANDIR = $(DATADIR)/man +MAN1DIR = $(MANDIR)/man1 +MAN7DIR = $(MANDIR)/man7 +LICENSEDIR = $(DATADIR)/licenses + + PKGNAME = cg-tools @@ -12,6 +21,20 @@ BIN = bin/cg-brilliance \ bin/cg-remove \ bin/cg-sleepmode +MAN1 = man/cg-brilliance.1 \ + man/cg-darkroom.1 \ + man/cg-gamma.1 \ + man/cg-icc.1 \ + man/cg-limits.1 \ + man/cg-negative.1 \ + man/cg-query.1 \ + man/cg-rainbow.1 \ + man/cg-remove.1 \ + man/cg-sleepmode.1 + +MAN7 = man/cg-tools.7 + + OPTIMISE = -O2 WARN = -Wall -Wextra @@ -37,7 +60,49 @@ obj/%.o: src/%.c src/*.h @mkdir -p -- "$$(dirname -- "$@")" $(CC) -std=c99 $(OPTIMISE) $(WARN) $(DEF) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) + +install: install-base install-doc + +install-base: install-cmd install-copyright + +install-copyright: install-license install-copying + +install-doc: install-man + +install-man: install-man1 install-man7 + +install-cmd: $(BIN) + mkdir -p -- "$(DESTDIR)$(BINDIR)" + install -m755 -- $(BIN) "$(DESTDIR)$(BINDIR)" + +install-license: + mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -m644 -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + +install-copying: + mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -m644 -- COPYING "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + +install-man1: + mkdir -p -- "$(DESTDIR)$(MAN1DIR)" + install -m644 -- $(MAN1) "$(DESTDIR)$(MAN1DIR)" + +install-man7: + mkdir -p -- "$(DESTDIR)$(MAN7DIR)" + install -m644 -- $(MAN7) "$(DESTDIR)$(MAN7DIR)" + + +uninstall: + -cd "$(DESTDIR)$(BINDIR)" && rm -- $$(printf -- '%s\n' $(BIN) | cut -d / -f 2-) + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + -cd "$(DESTDIR)$(MAN1DIR)" && rm -- $$(printf -- '%s\n' $(MAN1) | cut -d / -f 2-) + -cd "$(DESTDIR)$(MAN7DIR)" && rm -- $$(printf -- '%s\n' $(MAN7) | cut -d / -f 2-) + + clean: -rm -r -- bin obj -.PHONY: all clean +.PHONY: all clean install install-base install-doc install-cmd install-copyright \ + install-license install-copying install-man install-man1 install-man7 uninstall |