commit 3320a90812c519d28452822879be4472276d129e
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Sun Jan 22 21:09:53 2017 +0100
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Sun Jan 22 21:09:53 2017 +0100
Makefile: add install, uninstall, and dist
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/Makefile b/Makefile
index d114f51..f773790 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -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
_AT_@ -51,8 +80,46 @@ all: $(BIN)
%.o: src/%.c src/*.h src/*/*.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $_AT_ $<
+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
index db66e28..783ac96 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -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
Received on Sun Jan 22 2017 - 21:11:46 CET
This archive was generated by hypermail 2.3.0
: Sun Jan 22 2017 - 21:12:24 CET