diff options
author | Mattias Andrée <maandree@kth.se> | 2020-10-21 17:22:38 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-10-21 17:22:38 +0200 |
commit | 0db712267007206d30f74e6b2e856acf8e5502b7 (patch) | |
tree | 6a0807871dd8e6c2df2b1fa7a46677e3095f1c40 /Makefile | |
parent | Update test for -z (diff) | |
download | sha3sum-0db712267007206d30f74e6b2e856acf8e5502b7.tar.gz sha3sum-0db712267007206d30f74e6b2e856acf8e5502b7.tar.bz2 sha3sum-0db712267007206d30f74e6b2e856acf8e5502b7.tar.xz |
Add multicall binary option
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 31 |
1 files changed, 29 insertions, 2 deletions
@@ -3,6 +3,7 @@ CONFIGFILE = config.mk include $(CONFIGFILE) +LIBEXECDIR = $(PREFIX)/$(LIBEXEC) BIN =\ keccaksum\ @@ -40,13 +41,20 @@ shake512sum = SHAKE512 all: $(BIN) $(MAN1) +mcb: sha3sum-mcb $(MAN1) + +sha3sum-mcb.c: commands.h %: %.o common.o - $(CC) -o $@ $^ $(LDFLAGS) + $(CC) -o $@ $< common.o $(LDFLAGS) %.o: %.c $(HDR) $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) +%.bo: %.c $(HDR) + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) \ + -Dmain="main_$$(printf '%s\n' $* | tr - _)(int, char *[]); int main_$$(printf '%s\n' $* | tr - _)" + %.1: xsum.man u=$$(printf '%s\n' $* | tr a-z A-Z); \ sed -e 's/xsum/$*/g' -e 's/XSUM/'"$$u"'/g' -e 's/Xsum/$($*)/g' < xsum.man > $@ @@ -56,6 +64,13 @@ all: $(BIN) $(MAN1) sed -i '/^\\# ONLY SHA3: /d' $@; \ fi +commands.h: Makefile + (printf '%s' '#define LIST_COMMANDS(_)' && printf '\\\n\t_(%s)' $(BIN) && printf '\n') \ + | sed 's/_(\(.*\))/_("\1", main_\1)/' | sed 's/\(main_.*\)-/\1_/' > $@ + +sha3sum-mcb: sha3sum-mcb.o common.o $(BIN:=.bo) + $(CC) -o $@ sha3sum-mcb.o common.o $(BIN:=.bo) $(LDFLAGS) + keccak-%sum.c: printf '%s\n' '#include "common.h"' 'KECCAK_MAIN($*)' > $@ @@ -79,13 +94,25 @@ install: $(BIN) $(MAN1) cp -- $(MAN1) "$(DESTDIR)$(MANPREFIX)/man1/" cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/sha3sum/" +install-mcb: sha3sum-mcb $(MAN1) + mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" + mkdir -p -- "$(DESTDIR)$(LIBEXECDIR)" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1" + mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/sha3sum" + set -e && cd "$(DESTDIR)$(PREFIX)/bin/" && \ + for f in $(BIN); do ln -sf -- ../$(LIBEXEC)/sha3sum "$$f"; done + cp -- sha3sum-mcb "$(DESTDIR)$(LIBEXECDIR)/sha3sum" + cp -- $(MAN1) "$(DESTDIR)$(MANPREFIX)/man1/" + cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/sha3sum/" + uninstall: -cd -- "$(DESTDIR)$(PREFIX)/bin" && rm -f -- $(BIN) -cd -- "$(DESTDIR)$(MANPREFIX)/man1" && rm -f -- $(MAN1) -rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/sha3sum" + -rm -f -- "$(DESTDIR)$(LIBEXECDIR)/sha3sum" clean: - -rm -rf -- $(MAN1) $(BIN) keccak-*sum.c sha3-*sum.c rawshake*sum.c shake*sum.c .testdir + -rm -rf -- $(MAN1) $(BIN) *.o *.bo *.su commands.h keccak-*sum.c sha3-*sum.c rawshake*sum.c shake*sum.c .testdir .SUFFIXES: |