femtoTCP/Makefile
Daniele Lacamera 40a756ec8e Initial import
2024-10-27 13:24:44 +01:00

42 lines
712 B
Makefile

CC?=gcc
CFLAGS:=-Wall -Werror -Wextra -I.
OBJ=build/femtotcp.o build/test-linux.o
all: build/test
#Static library
static: CFLAGS+=-static
static: libtcpip.a
libtcpip.a: $(OBJ)
@ar rcs $@ $^
clean:
@rm -f build/*
@make -C test/unit clean
# Test
asan: build/test
asan:CFLAGS+=-fsanitize=address
asan:LDFLAGS+=-static-libasan
build/test:CFLAGS+=-g -ggdb -DTEST_MAIN -DETHERNET
build/test:LDFLAGS+=-pthread
build/test: $(OBJ)
@echo "Linking $@"
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ)
build/test-linux.o: test/test-linux.c
@echo "Compiling $<"
@$(CC) $(CFLAGS) -c $< -o $@
build/%.o: src/%.c
@echo "Compiling $<"
@$(CC) $(CFLAGS) -c $< -o $@
unit:
@make -C test/unit
.PHONY: clean all static