monocypher_dir := @srcdir@/vendor/monocypher/
argon2_dir := @srcdir@/vendor/argon2/
aes_dir := @srcdir@/vendor/aes/
aes_cppflags := -DAES256=1 -DCTR=1 -DCBC=0 -DECB=0
CC := @CC@
AR := @AR@
RANLIB := @RANLIB@
CFLAGS := @CFLAGS@ @SHOBJFLAGS@
CPPFLAGS := -I. -I@srcdir@ -I$(monocypher_dir) -I$(argon2_dir) -I$(aes_dir) $(aes_cppflags) @CPPFLAGS@ @SHOBJCPPFLAGS@ @DEFS@ @TCL_DEFS@
LDFLAGS := @LDFLAGS@
LIBS := @LIBS@
SHOBJLDFLAGS := @SHOBJLDFLAGS@
VPATH := @srcdir@
srcdir := @srcdir@
prefix := @prefix@
exec_prefix := @exec_prefix@
libdir := @libdir@
TCL_NANO_AMALGAMATION := @TCL_NANO_AMALGAMATION@
PACKAGE_VERSION := @PACKAGE_VERSION@
TCL_PACKAGE_PATH := @TCL_PACKAGE_PATH@
PACKAGE_INSTALL_DIR := $(TCL_PACKAGE_PATH)/tcl-nano$(PACKAGE_VERSION)
INSTALL := @INSTALL@
INSTALL_PROGRAM := @INSTALL_PROGRAM@
INSTALL_DATA := @INSTALL_DATA@
export CC CFLAGS CPPFLAGS
all: @EXTENSION_TARGET@ pkgIndex.tcl
ifneq ($(TCL_NANO_AMALGAMATION),1)
TCL_NANO_OBJECTS = monocypher.o argon2.o aes.o randombytes.o nano.o
else
TCL_NANO_OBJECTS = nano-amalgamation.o
endif
ifeq (@TCLEXT_BUILD@,shared)
@EXTENSION_TARGET@: $(TCL_NANO_OBJECTS) Makefile
rm -f @EXTENSION_TARGET@
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SHOBJLDFLAGS) -o @EXTENSION_TARGET@ $(TCL_NANO_OBJECTS) $(LIBS)
-@WEAKENSYMS@ @EXTENSION_TARGET@
-@REMOVESYMS@ @EXTENSION_TARGET@
else
@EXTENSION_TARGET@: $(TCL_NANO_OBJECTS) Makefile
rm -f @EXTENSION_TARGET@
$(AR) rc @EXTENSION_TARGET@ $(TCL_NANO_OBJECTS)
-$(RANLIB) @EXTENSION_TARGET@
endif
# The amalgamation is used when compiling statically so that the same ABI can be exposed
# to upstream projects rather than requiring them to filter out our symbols
nano-amalgamation.c: @srcdir@/nano.c @srcdir@/randombytes.c $(monocypher_dir)monocypher.c $(argon2_dir)argon2.c $(aes_dir)aes.c Makefile
rm -f nano-amalgamation.c
cat @srcdir@/nano.c @srcdir@/randombytes.c $(monocypher_dir)monocypher.c $(argon2_dir)argon2.c $(aes_dir)aes.c > nano-amalgamation.c
nano-amalgamation.o: nano-amalgamation.c $(monocypher_dir)monocypher.h $(argon2_dir)argon2.h $(aes_dir)aes.h @srcdir@/randombytes.h nano.tcl.h Makefile
$(CC) $(CPPFLAGS) -DTCL_NANO_AMALGAMATION=1 $(CFLAGS) -o nano-amalgamation.o -c nano-amalgamation.c
ifneq (@TCLEXT_BUILD@,shared)
-@WEAKENSYMS@ nano-amalgamation.o
-@REMOVESYMS@ nano-amalgamation.o
endif
nano.o: @srcdir@/nano.c $(monocypher_dir)monocypher.h $(argon2_dir)argon2.h $(aes_dir)aes.h @srcdir@/randombytes.h nano.tcl.h Makefile
$(CC) $(CPPFLAGS) $(CFLAGS) -o nano.o -c @srcdir@/nano.c
randombytes.o: @srcdir@/randombytes.c @srcdir@/randombytes.h
$(CC) $(CPPFLAGS) $(CFLAGS) -o randombytes.o -c @srcdir@/randombytes.c
monocypher.o: $(monocypher_dir)monocypher.c $(monocypher_dir)monocypher.h
$(CC) $(CPPFLAGS) $(CFLAGS) -o monocypher.o -c $(monocypher_dir)monocypher.c
argon2.o: $(argon2_dir)argon2.c $(argon2_dir)argon2.h $(monocypher_dir)monocypher.h
$(CC) $(CPPFLAGS) $(CFLAGS) -o argon2.o -c $(argon2_dir)argon2.c
aes.o: $(aes_dir)aes.c $(aes_dir)aes.h
$(CC) $(CPPFLAGS) $(CFLAGS) -o aes.o -c $(aes_dir)aes.c
pkgIndex.tcl: pkgIndex.tcl-@TCLEXT_BUILD@
cp pkgIndex.tcl-@TCLEXT_BUILD@ pkgIndex.tcl
nano.tcl.h: @srcdir@/nano.tcl Makefile
od -A n -v -t xC < '@srcdir@/nano.tcl' > nano.tcl.h.new.1
sed 's@ *@@g;s@..@0x&, @g' < nano.tcl.h.new.1 > nano.tcl.h.new.2
rm -f nano.tcl.h.new.1
mv nano.tcl.h.new.2 nano.tcl.h
test: @EXTENSION_TARGET@ pkgIndex.tcl
@srcdir@/test/test.tcl --libpath . --libpath @TCLLIB_PATH@ --libpath @srcdir@/vendor/tcl-packages
ifeq (@ENABLE_COVERAGE@,true)
coverage.dir: test
rm -f nano-coverage.info
lcov --capture --directory . --output-file nano-coverage.info
mkdir coverage.dir
genhtml nano-coverage.info --output-directory coverage.dir
rm -f nano-coverage.info
endif
install: @EXTENSION_TARGET@ @srcdir@/bin/node @srcdir@/bin/rpc-client pkgIndex.tcl @srcdir@/nano.man
$(INSTALL) -d '$(DESTDIR)$(PACKAGE_INSTALL_DIR)'
$(INSTALL) -d '$(DESTDIR)$(PACKAGE_INSTALL_DIR)/bin'
$(INSTALL) -d '$(DESTDIR)$(PACKAGE_INSTALL_DIR)/man'
$(INSTALL_PROGRAM) @EXTENSION_TARGET@ '$(DESTDIR)$(PACKAGE_INSTALL_DIR)'
$(INSTALL_PROGRAM) @srcdir@/bin/node '$(DESTDIR)$(PACKAGE_INSTALL_DIR)/bin'
$(INSTALL_PROGRAM) @srcdir@/bin/rpc-client '$(DESTDIR)$(PACKAGE_INSTALL_DIR)/bin'
$(INSTALL_DATA) pkgIndex.tcl '$(DESTDIR)$(PACKAGE_INSTALL_DIR)'
$(INSTALL_DATA) @srcdir@/nano.man '$(DESTDIR)$(PACKAGE_INSTALL_DIR)/man'
clean:
rm -f nano-amalgamation.c nano-amalgamation.o
rm -f @EXTENSION_TARGET@ nano.o nano.gcda nano.gcno
rm -f argon2.o monocypher.o aes.o randombytes.o
rm -f argon2.gcda monocypher.gcda aes.gcda randombytes.gcda nano-amalgamation.gcda
rm -f argon2.gcno monocypher.gcno aes.gcno randombytes.gcno nano-amalgamation.gcno
rm -f nano-coverage.info
distclean: clean
rm -f Makefile pkgIndex.tcl-shared pkgIndex.tcl-static nano.syms
rm -f pkgIndex.tcl
rm -f config.log config.status
rm -f nano.tcl.h nano.tcl.h.new.1 nano.tcl.h.new.2
rm -rf coverage.dir
mrproper: distclean
rm -f @srcdir@/configure @srcdir@/aclocal.m4 @srcdir@/config.guess @srcdir@/config.sub @srcdir@/install-sh
rm -f @srcdir@/nano.vers
rm -rf '$(argon2_dir)'
$(MAKE) -C @srcdir@/build/argon2 distclean
.PHONY: all test clean distclean mrproper