blind

suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log | Files | Refs | README | LICENSE

commit 3320a90812c519d28452822879be4472276d129e
parent 5b619b9a28ce719bedf3e4a951a196bfa9c7af8c
Author: Mattias Andrée <maandree@kth.se>
Date:   Sun, 22 Jan 2017 21:09:53 +0100

Makefile: add install, uninstall, and dist

Signed-off-by: Mattias Andrée <maandree@kth.se>

Diffstat:
MMakefile | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mconfig.mk | 8+++++++-
2 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -43,6 +43,35 @@ SCRIPTS =\ MAN1 = $(BIN:=.1) $(SCRIPTS:=.1) MAN7 = blind.7 +SRC = $(BIN:=.c) util.c stream.c + +HDR =\ + arg.h\ + stream.h\ + util.h\ + util/to.h\ + util/jobs.h\ + util/emalloc.h\ + util/eopen.h\ + util/endian.h\ + util/colour.h\ + util/io.h\ + util/efflush.h\ + util/eprintf.h\ + util/fshut.h + +MISCFILES = Makefile config.mk LICENSE README TODO + +EXAMPLEDIRS =\ + inplace-flop\ + reverse\ + split + +EXAMPLEFILES =\ + inplace-flop/Makefile\ + reverse/Makefile\ + split/Makefile + all: $(BIN) %: %.o util.o stream.o @@ -51,8 +80,46 @@ all: $(BIN) %.o: src/%.c src/*.h src/*/*.h $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +install: all + mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" + cp -f -- $(BIN) "$(DESTDIR)$(PREFIX)/bin" + cd -- "$(DESTDIR)$(PREFIX)/bin" && chmod 755 $(BIN) + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1" + set -e && for m in $(MAN1); do \ + sed '1s/ blind$$/ " blind $(VERSION)"/g' \ + < "man/$$m" > "$(DESTDIR)$(MANPREFIX)/man1/$$m"; \ + done + cd -- "$(DESTDIR)$(MANPREFIX)/man1" && chmod 644 $(MAN1) + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7" + set -e && for m in $(MAN7); do \ + sed '1s/ blind$$/ " blind $(VERSION)"/g' \ + < "man/$$m" > "$(DESTDIR)$(MANPREFIX)/man7/$$m"; \ + done + cd -- "$(DESTDIR)$(MANPREFIX)/man7" && chmod 644 $(MAN7) + +uninstall: + cd -- "$(DESTDIR)$(PREFIX)/bin" && rm -f $(BIN) + cd -- "$(DESTDIR)$(MANPREFIX)/man1" && rm -f $(MAN1) + cd -- "$(DESTDIR)$(MANPREFIX)/man7" && rm -f $(MAN7) + +dist: + -rm -rf "blind-$(VERSION)" + mkdir -p "blind-$(VERSION)/src/util" "blind-$(VERSION)/man" + cp $(MISCFILES) $(SCRIPTS) "blind-$(VERSION)" + cd man && cp $(MAN1) $(MAN7) "../blind-$(VERSION)/man" + set -e && cd src && for s in $(SRC) $(HDR); do \ + cp "$$s" "../blind-$(VERSION)/src/$$s"; done + set -e && for e in $(EXAMPLEDIRS); do \ + mkdir -p "blind-$(VERSION)/examples/$$e"; done + set -e && cd examples && for e in $(EXAMPLEFILES); \ + do cp "$$e" "../blind-$(VERSION)/examples/$$e"; done + tar -cf "blind-$(VERSION).tar" "blind-$(VERSION)" + gzip -9 "blind-$(VERSION).tar" + rm -rf "blind-$(VERSION)" + clean: - -rm $(BIN) *.o + -rm -f $(BIN) *.o blind-$(VERSION).tar.gz + -rm -rf "blind-$(VERSION)" -.PHONY: all clean +.PHONY: all install uninstall dist clean .PRECIOUS: util.o stream.o diff --git a/config.mk b/config.mk @@ -1,5 +1,11 @@ -# You may want to remove -DHAVE_PRCTL and -DHAVE_EPOLL from CPPFLAGS if you are not using Linux. +# blind version +VERSION = 1.0 + +# Paths +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man +# You may want to remove -DHAVE_PRCTL and -DHAVE_EPOLL from CPPFLAGS if you are not using Linux. CFLAGS = -std=c99 -Wall -pedantic -O2 CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_FILE_OFFSET_BITS=64 -DHAVE_PRCTL -DHAVE_EPOLL LDFLAGS = -lm -s