nostril

A C cli tool for creating nostr events
git clone git://jb55.com/nostril
Log | Files | Refs | Submodules | README | LICENSE

Makefile (2022B)


      1 
      2 CFLAGS = -Wall -O2 -Ideps/secp256k1/include
      3 OBJS = sha256.o nostril.o aes.o base64.o
      4 HEADERS = hex.h random.h config.h sha256.h deps/secp256k1/include/secp256k1.h
      5 PREFIX ?= /usr/local
      6 ARS = libsecp256k1.a
      7 
      8 SUBMODULES = deps/secp256k1
      9 
     10 all: nostril docs
     11 
     12 docs: doc/nostril.1
     13 
     14 doc/nostril.1: README.md
     15 	scdoc < $^ > $@
     16 
     17 version: nostril.c
     18 	grep '^#define VERSION' $< | sed -En 's,.*"([^"]+)".*,\1,p' > $@
     19 
     20 dist: docs version
     21 	@mkdir -p dist
     22 	git ls-files --recurse-submodules | tar --transform 's/^/nostril-$(shell cat version)\//' -T- -caf dist/nostril-$(shell cat version).tar.gz
     23 	@ls -dt dist/* | head -n1 | xargs echo "tgz "
     24 	cd dist;\
     25 	sha256sum *.tar.gz > SHA256SUMS.txt;\
     26 	gpg -u 0x8A478B64FFE30F1095A8736BF5F27EFD1B38DABB --sign --armor --detach-sig --output SHA256SUMS.txt.asc SHA256SUMS.txt
     27 	cp CHANGELOG dist/CHANGELOG.txt
     28 	rsync -avzP dist/ charon:/www/cdn.jb55.com/tarballs/nostril/
     29 
     30 deps/secp256k1/.git:
     31 	@devtools/refresh-submodules.sh $(SUBMODULES)
     32 
     33 deps/secp256k1/include/secp256k1.h: deps/secp256k1/.git
     34 
     35 deps/secp256k1/configure: deps/secp256k1/.git
     36 	cd deps/secp256k1; \
     37 	./autogen.sh
     38 
     39 deps/secp256k1/config.log: deps/secp256k1/configure
     40 	cd deps/secp256k1; \
     41 	./configure --disable-shared --enable-module-ecdh --enable-module-schnorrsig --enable-module-extrakeys
     42 
     43 deps/secp256k1/.libs/libsecp256k1.a: deps/secp256k1/config.log
     44 	cd deps/secp256k1; \
     45 	make -j libsecp256k1.la
     46 
     47 libsecp256k1.a: deps/secp256k1/.libs/libsecp256k1.a
     48 	cp $< $@
     49 
     50 %.o: %.c $(HEADERS)
     51 	@echo "cc $<"
     52 	@$(CC) $(CFLAGS) -c $< -o $@
     53 
     54 nostril: $(HEADERS) $(OBJS) $(ARS)
     55 	$(CC) $(CFLAGS) $(OBJS) $(ARS) -o $@
     56 
     57 install: all
     58 	mkdir -p $(PREFIX)/share/man/man1
     59 	mkdir -p $(PREFIX)/bin
     60 	install -m644 doc/nostril.1 $(PREFIX)/share/man/man1/nostril.1
     61 	install -m755 nostril $(PREFIX)/bin/nostril
     62 	install -m755 nostril-query $(PREFIX)/bin/nostril-query
     63 
     64 config.h: configurator
     65 	./configurator > $@
     66 
     67 configurator: configurator.c
     68 	$(CC) $< -o $@
     69 
     70 clean:
     71 	rm -f nostril *.o *.a
     72 	rm -rf deps/secp256k1
     73 
     74 tags: fake
     75 	ctags *.c *.h
     76 
     77 .PHONY: fake