Makefile.in (n2n-2.8) | : | Makefile.in (n2n-3.0) | ||
---|---|---|---|---|
# NOTE: these are needed by the configure.in inside the packages folder | # NOTE: these are needed by the configure.in inside the packages folder | |||
N2N_VERSION_SHORT=@N2N_VERSION_SHORT@ | N2N_VERSION_SHORT=@N2N_VERSION_SHORT@ | |||
GIT_COMMITS=@GIT_COMMITS@ | GIT_COMMITS=@GIT_COMMITS@ | |||
GIT_DESCRIBE=$(shell git describe --always --dirty) | ||||
######## | ######## | |||
export CC | ||||
export AR | ||||
CC=@CC@ | CC=@CC@ | |||
AR=@AR@ | ||||
#Ultrasparc64 users experiencing SIGBUS should try the following gcc options | #Ultrasparc64 users experiencing SIGBUS should try the following gcc options | |||
#(thanks to Robert Gibbon) | #(thanks to Robert Gibbon) | |||
PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finlin e-functions -fweb -frename-registers -mapp-regs | PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finlin e-functions -fweb -frename-registers -mapp-regs | |||
N2N_OBJS_OPT= | export CFLAGS | |||
LIBS_EDGE_OPT=@N2N_LIBS@ | export LDFLAGS | |||
CFLAGS=@CFLAGS@ -I ./include | CFLAGS=@CFLAGS@ -I ./include | |||
LDFLAGS=@LDFLAGS@ | LDFLAGS=@LDFLAGS@ -L . | |||
OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?) | OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?) | |||
ifeq ($(OPENSSL_CFLAGS), 0) | ifeq ($(OPENSSL_CFLAGS), 0) | |||
CFLAGS+=$(shell pkg-config --cflags-only-I openssl) | CFLAGS+=$(shell pkg-config --cflags-only-I openssl) | |||
endif | endif | |||
WARN=-Wall | ||||
CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN) $(OPTIONS) $(PLATOPTS) | CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN) $(OPTIONS) $(PLATOPTS) | |||
INSTALL=install | # Quick sanity check on our build environment | |||
MKDIR=mkdir -p | UNAME_S := $(shell uname -s) | |||
OS := $(shell uname -s) | ifndef UNAME_S | |||
# This could happen if the Makefile is unable to run "uname", which can | ||||
# happen if the shell has a bad path (or is the wrong shell) | ||||
$(error Could not run uname command, cannot continue) | ||||
endif | ||||
# Any compile environment that needs different flags, libraries, includes or | ||||
# other settings will get its own CONFIG_TARGET value. For cross compiling, | ||||
# this might be set externally to the Makefile, but if not set we try to | ||||
# set a reasonable default. | ||||
export CONFIG_TARGET | ||||
ifndef CONFIG_TARGET | ||||
ifeq ($(shell uname -o),Msys) | ||||
CONFIG_TARGET=mingw | ||||
else ifeq ($(shell uname -s),Darwin) | ||||
CONFIG_TARGET=darwin | ||||
else ifeq ($(shell uname), SunOS) | ||||
CONFIG_TARGET=sunos | ||||
else | ||||
CONFIG_TARGET=generic | ||||
endif | ||||
endif | ||||
export MKDIR | ||||
export INSTALL | ||||
export INSTALL_PROG | ||||
export INSTALL_DOC | ||||
export SBINDIR | ||||
MKDIR=mkdir -p | ||||
INSTALL=install | ||||
INSTALL_PROG=$(INSTALL) -m755 | INSTALL_PROG=$(INSTALL) -m755 | |||
INSTALL_DOC=$(INSTALL) -m644 | INSTALL_DOC=$(INSTALL) -m644 | |||
# DESTDIR set in debian make system | # DESTDIR set in debian make system | |||
PREFIX?=$(DESTDIR)/usr | PREFIX?=$(DESTDIR)/usr | |||
#BINDIR=$(PREFIX)/bin | ifeq ($(CONFIG_TARGET),darwin) | |||
ifeq ($(OS),Darwin) | ||||
SBINDIR=$(PREFIX)/local/sbin | SBINDIR=$(PREFIX)/local/sbin | |||
else | else | |||
SBINDIR=$(PREFIX)/sbin | SBINDIR=$(PREFIX)/sbin | |||
endif | endif | |||
MANDIR?=$(PREFIX)/share/man | MANDIR?=$(PREFIX)/share/man | |||
MAN1DIR=$(MANDIR)/man1 | MAN1DIR=$(MANDIR)/man1 | |||
MAN7DIR=$(MANDIR)/man7 | MAN7DIR=$(MANDIR)/man7 | |||
MAN8DIR=$(MANDIR)/man8 | MAN8DIR=$(MANDIR)/man8 | |||
N2N_LIB=libn2n.a | N2N_LIB=libn2n.a | |||
N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c)) | N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c)) | |||
N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile $(N2N_LIB) | N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile | |||
# As source files pass the linter, they can be added here (If all the source | ||||
# is passing the linter tests, this can be refactored) | ||||
LINT_CCODE=\ | ||||
include/edge_utils_win32.h \ | ||||
include/n2n_define.h \ | ||||
include/pearson.h \ | ||||
include/speck.h \ | ||||
src/edge_utils_win32.c \ | ||||
src/example_edge_embed_quick_edge_init.c \ | ||||
src/header_encryption.c \ | ||||
src/sn_selection.c \ | ||||
src/transform_cc20.c \ | ||||
src/tuntap_linux.c \ | ||||
src/wire.c \ | ||||
tools/tests-compress.c \ | ||||
tools/tests-elliptic.c \ | ||||
tools/tests-hashing.c \ | ||||
tools/tests-transform.c \ | ||||
tools/tests-wire.c \ | ||||
export LDLIBS | ||||
LIBS_EDGE+=$(LIBS_EDGE_OPT) | LDLIBS+=-ln2n | |||
LIBS_SN= | LDLIBS+=@N2N_LIBS@ | |||
#For OpenSolaris (Solaris too?) | #For OpenSolaris (Solaris too?) | |||
ifeq ($(shell uname), SunOS) | ifeq ($(CONFIG_TARGET), sunos) | |||
LIBS_EDGE+=-lsocket -lnsl | LDLIBS+=-lsocket -lnsl | |||
LIBS_SN+=-lsocket -lnsl | endif | |||
ifeq ($(CONFIG_TARGET),mingw) | ||||
CFLAGS+=-I. -I./win32 -DWIN32 | ||||
LDLIBS+=$(abspath win32/n2n_win32.a) | ||||
LDLIBS+=-lws2_32 -liphlpapi | ||||
N2N_DEPS+=win32/n2n_win32.a | ||||
SUBDIRS+=win32 | ||||
endif | endif | |||
APPS=edge | APPS=edge | |||
APPS+=supernode | APPS+=supernode | |||
APPS+=example_edge_embed_quick_edge_init | APPS+=example_edge_embed_quick_edge_init | |||
APPS+=example_edge_embed | APPS+=example_edge_embed | |||
APPS+=example_sn_embed | APPS+=example_sn_embed | |||
DOCS=edge.8.gz supernode.1.gz n2n.7.gz | DOCS=edge.8.gz supernode.1.gz n2n.7.gz | |||
.PHONY: steps build push all clean install tools | # This is the superset of all packages that might be needed during the build. | |||
all: $(APPS) $(DOCS) tools | # Mostly of use in automated build systems. | |||
BUILD_DEP:=\ | ||||
autoconf \ | ||||
build-essential \ | ||||
flake8 \ | ||||
gcovr \ | ||||
libcap-dev \ | ||||
libzstd-dev \ | ||||
shellcheck \ | ||||
uncrustify \ | ||||
yamllint \ | ||||
SUBDIRS+=tools | ||||
COVERAGEDIR?=coverage | ||||
.PHONY: $(SUBDIRS) | ||||
.PHONY: steps build push all clean distclean install test cover gcov build-dep | ||||
.PHONY: lint lint.python lint.ccode lint.shell lint.yaml | ||||
all: $(APPS) $(DOCS) $(SUBDIRS) | ||||
tools: $(N2N_LIB) | tools: $(N2N_LIB) | |||
$(MAKE) -C $@ | $(MAKE) -C $@ | |||
edge: src/edge.c $(N2N_LIB) $(N2N_DEPS) | win32: | |||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ | $(MAKE) -C $@ | |||
supernode: src/sn.c $(N2N_LIB) $(N2N_DEPS) | ||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_SN) -o $@ | ||||
example_edge_embed_quick_edge_init: src/example_edge_embed_quick_edge_init.c $(N | ||||
2N_DEPS) | ||||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ | ||||
example_sn_embed: src/example_sn_embed.c $(N2N_DEPS) | src/edge.o: $(N2N_DEPS) | |||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ | src/supernode.o: $(N2N_DEPS) | |||
src/example_edge_embed_quick_edge_init.o: $(N2N_DEPS) | ||||
src/example_sn_embed.o: $(N2N_DEPS) | ||||
src/example_edge_embed.o: $(N2N_DEPS) | ||||
src/edge: $(N2N_LIB) | ||||
src/supernode: $(N2N_LIB) | ||||
src/example_edge_embed_quick_edge_init: $(N2N_LIB) | ||||
src/example_sn_embed: $(N2N_LIB) | ||||
src/example_edge_embed: $(N2N_LIB) | ||||
example_edge_embed: src/example_edge_embed.c $(N2N_DEPS) | %: src/% | |||
$(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ | cp $< $@ | |||
%.gz : % | %.gz : % | |||
gzip -c $< > $@ | gzip -c $< > $@ | |||
$(N2N_LIB): $(N2N_OBJS) | $(N2N_LIB): $(N2N_OBJS) | |||
ar rcs $(N2N_LIB) $(N2N_OBJS) | $(AR) rcs $(N2N_LIB) $(N2N_OBJS) | |||
# $(RANLIB) $@ | # $(RANLIB) $@ | |||
win32/n2n_win32.a: win32 | ||||
test: tools | ||||
scripts/test_harness.sh | ||||
lint: lint.python lint.ccode lint.shell lint.yaml | ||||
lint.python: | ||||
flake8 scripts/n2n-ctl scripts/n2n-httpd | ||||
lint.ccode: | ||||
scripts/indent.sh $(LINT_CCODE) | ||||
lint.shell: | ||||
shellcheck scripts/*.sh | ||||
lint.yaml: | ||||
yamllint . | ||||
# To generate coverage information, run configure with | ||||
# CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" | ||||
# and run the desired tests. Ensure that package gcovr is installed | ||||
# and then run "make cover" | ||||
cover: | ||||
mkdir -p $(COVERAGEDIR) | ||||
gcovr -s --html --html-details --output=$(COVERAGEDIR)/index.html | ||||
# Use coverage data to generate gcov text report files. | ||||
# Unfortunately, these end up in the wrong directory due to the | ||||
# makefile layout | ||||
# The steps to use this are similar to the "make cover" above | ||||
gcov: | ||||
gcov $(N2N_OBJS) | ||||
$(MAKE) -C tools gcov | ||||
# This is a convinent target to use during development or from a CI/CD system | ||||
build-dep: | ||||
ifeq ($(CONFIG_TARGET),generic) | ||||
sudo apt install $(BUILD_DEP) | ||||
else ifeq ($(CONFIG_TARGET),darwin) | ||||
brew install automake gcovr | ||||
else | ||||
echo Not attempting to install dependancies for system $(CONFIG_TARGET) | ||||
endif | ||||
clean: | clean: | |||
rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) test n2n-decode *.dSYM *~ | rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~ | |||
$(MAKE) -C tools clean | rm -f tests/*.out src/*.gcno src/*.gcda | |||
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done | ||||
distclean: | ||||
rm -f tests/*.out src/*.gcno src/*.gcda src/*.indent src/*.unc-backup* | ||||
rm -rf autom4te.cache/ | ||||
rm -f config.log config.status configure configure.ac Makefile tools/Make | ||||
file include/config.h include/config.h.in | ||||
rm -f doc/edge.8.gz doc/n2n.7.gz doc/supernode.1.gz | ||||
rm -f $(addprefix src/,$(APPS)) | ||||
install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz | install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz | |||
echo "MANDIR=$(MANDIR)" | echo "MANDIR=$(MANDIR)" | |||
$(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) | $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) | |||
$(INSTALL_PROG) supernode $(SBINDIR)/ | $(INSTALL_PROG) supernode $(SBINDIR)/ | |||
$(INSTALL_PROG) edge $(SBINDIR)/ | $(INSTALL_PROG) edge $(SBINDIR)/ | |||
$(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ | $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ | |||
$(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ | $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ | |||
$(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ | $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ | |||
$(MAKE) -C tools install | $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) | |||
# Docker builder section | # Docker builder section | |||
DOCKER_IMAGE_NAME=ntop/supernode | DOCKER_IMAGE_NAME=ntop/supernode | |||
DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT | DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT | |||
N2N_COMMIT_HASH=@GIT_REVISION@ | N2N_COMMIT_HASH=@GIT_REVISION@ | |||
default: steps | default: steps | |||
steps: | steps: | |||
if [ "$(TARGET_ARCHITECTURE)" = "arm32v7" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm32v7" DOCKER_IMAGE_TAGNAME=$( DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm32v7 make build; fi | if [ "$(TARGET_ARCHITECTURE)" = "arm32v7" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm32v7" DOCKER_IMAGE_TAGNAME=$( DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm32v7 make build; fi | |||
End of changes. 20 change blocks. | ||||
33 lines changed or deleted | 173 lines changed or added |