femtoTCP/Makefile

42 lines
747 B
Makefile

CC?=gcc
CFLAGS:=-Wall -Werror -Wextra -I.
OBJ=build/femtotcp.o build/test-linux.o build/port/linux.o
all: build/test
#Static library
static: CFLAGS+=-static
static: libtcpip.a
libtcpip.a: $(OBJ)
@ar rcs $@ $^
clean:
@rm -f build/*.o build/port/*.o
@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