2024-10-27 13:23:31 +01:00
|
|
|
CC?=gcc
|
|
|
|
CFLAGS:=-Wall -Werror -Wextra -I.
|
2024-11-16 07:34:11 +01:00
|
|
|
OBJ=build/femtotcp.o \
|
|
|
|
build/test/test_linux_eventloop.o build/port/posix/linux_tap.o
|
2024-10-27 13:23:31 +01:00
|
|
|
|
2024-11-16 07:34:11 +01:00
|
|
|
all: build/test-evloop
|
2024-10-27 13:23:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
#Static library
|
|
|
|
static: CFLAGS+=-static
|
|
|
|
static: libtcpip.a
|
|
|
|
|
|
|
|
libtcpip.a: $(OBJ)
|
|
|
|
@ar rcs $@ $^
|
|
|
|
|
|
|
|
clean:
|
2024-11-16 07:34:11 +01:00
|
|
|
@rm -rf build
|
|
|
|
@make -C src/test/unit clean
|
2024-10-27 13:23:31 +01:00
|
|
|
|
|
|
|
# Test
|
2024-11-16 07:34:11 +01:00
|
|
|
asan: build/test-evloop
|
2024-10-27 13:23:31 +01:00
|
|
|
asan:CFLAGS+=-fsanitize=address
|
|
|
|
asan:LDFLAGS+=-static-libasan
|
|
|
|
build/test:CFLAGS+=-g -ggdb -DTEST_MAIN -DETHERNET
|
|
|
|
build/test:LDFLAGS+=-pthread
|
|
|
|
|
|
|
|
|
2024-11-16 07:34:11 +01:00
|
|
|
build/test-evloop: $(OBJ)
|
|
|
|
@echo "[LD] $@"
|
2024-10-27 13:23:31 +01:00
|
|
|
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ)
|
|
|
|
|
|
|
|
build/%.o: src/%.c
|
2024-11-16 07:34:11 +01:00
|
|
|
@mkdir -p `dirname $@` || true
|
|
|
|
@echo "[CC] $<"
|
2024-10-27 13:23:31 +01:00
|
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
unit:
|
2024-11-16 07:34:11 +01:00
|
|
|
@make -C src/test/unit
|
|
|
|
@mkdir -p build/test/
|
|
|
|
@mv src/test/unit/unit build/test
|
2024-10-27 13:23:31 +01:00
|
|
|
|
|
|
|
.PHONY: clean all static
|