2021-10-05 21:07:15 +02:00
|
|
|
#
|
|
|
|
# This is not a standalone makefile, it must be called from the toplevel
|
|
|
|
# makefile to inherit the correct environment
|
|
|
|
|
2023-05-01 02:44:38 +02:00
|
|
|
# The vars included here should be part of the environment.
|
|
|
|
# TODO - refactor this and debug why they need to be included for windows
|
|
|
|
include ../config.mak
|
|
|
|
|
2019-09-21 16:12:43 +02:00
|
|
|
DEBUG?=-g3
|
2019-09-21 16:26:18 +02:00
|
|
|
|
2020-06-21 22:26:27 +02:00
|
|
|
HEADERS=$(wildcard include/*.h)
|
2021-10-05 21:07:15 +02:00
|
|
|
CFLAGS+=-I../include
|
2023-05-01 02:36:06 +02:00
|
|
|
LDLIBS+=-ln2n
|
2023-05-01 02:44:38 +02:00
|
|
|
|
2021-10-05 21:07:15 +02:00
|
|
|
ifeq ($(CONFIG_TARGET),mingw)
|
|
|
|
CFLAGS+=-I../win32
|
2023-05-01 02:44:38 +02:00
|
|
|
LDLIBS+=$(abspath ../win32/n2n_win32.a)
|
|
|
|
LDLIBS+=-lnetapi32 -lws2_32 -liphlpapi
|
2021-10-05 21:07:15 +02:00
|
|
|
endif
|
|
|
|
CFLAGS+=$(DEBUG)
|
2019-09-21 16:12:43 +02:00
|
|
|
LDFLAGS+=-L..
|
|
|
|
|
|
|
|
N2N_LIB=../libn2n.a
|
|
|
|
|
2022-06-05 18:05:40 +02:00
|
|
|
TOOLS=n2n-benchmark n2n-keygen n2n-route n2n-portfwd
|
2023-05-01 01:07:40 +02:00
|
|
|
TOOLS+=$(TOOLS_ADDITIONAL)
|
2019-09-21 16:12:43 +02:00
|
|
|
|
2021-09-27 11:41:06 +02:00
|
|
|
TESTS=tests-compress tests-elliptic tests-hashing tests-transform
|
|
|
|
TESTS+=tests-wire
|
2021-11-10 07:02:05 +01:00
|
|
|
TESTS+=tests-auth
|
2019-09-21 16:12:43 +02:00
|
|
|
|
2021-09-27 11:41:06 +02:00
|
|
|
.PHONY: all clean install
|
|
|
|
all: $(TOOLS) $(TESTS)
|
2019-09-21 16:12:43 +02:00
|
|
|
|
2023-05-01 03:45:44 +02:00
|
|
|
n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
|
|
|
n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
|
|
|
n2n-route.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
|
|
|
n2n-portfwd.o: $(N2N_LIB) $(HEADERS) ../config.mak
|
2021-06-03 23:26:22 +02:00
|
|
|
|
2023-05-01 03:45:44 +02:00
|
|
|
n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../config.mak
|
2021-09-16 14:49:04 +02:00
|
|
|
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDLIBS) -lpcap -o $@
|
2019-09-21 16:12:43 +02:00
|
|
|
|
2021-09-27 11:41:06 +02:00
|
|
|
# See comments in the topdir Makefile about how to generate coverage
|
|
|
|
# data.
|
|
|
|
gcov:
|
|
|
|
gcov $(TOOLS) $(TESTS)
|
|
|
|
|
2019-09-21 16:12:43 +02:00
|
|
|
clean:
|
2020-06-21 22:33:28 +02:00
|
|
|
rm -rf $(TOOLS) *.o *.dSYM *~
|
2021-09-27 11:41:06 +02:00
|
|
|
rm -f $(TESTS) *.gcno *.gcda
|
2019-09-21 16:12:43 +02:00
|
|
|
|
|
|
|
install: $(TOOLS)
|
|
|
|
$(INSTALL_PROG) $(TOOLS) $(SBINDIR)/
|