diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..852b6a9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.5) + +project(netem C) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99") + +add_executable(netem main.c + probe.c + emulate.c + timing.c + hist.c + utils.c + ts.c + tc.c + tcp.c + dist.c + dist-maketable.c +) + +target_link_libraries(netem PUBLIC "-lrt -lnl-3 -lnl-route-3 -lm") +target_include_directories(netem PUBLIC "/usr/include/libnl3") + +add_library(mark mark.c) diff --git a/Makefile b/Makefile deleted file mode 100644 index a4ccfb9..0000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -TARGETS = netem mark.so - -OBJS = main.o probe.o emulate.o timing.o hist.o utils.o ts.o tc.o tcp.o dist.o dist-maketable.o - -CC = gcc - -CFLAGS = -g -lrt -std=c99 -Wall - -CFLAGS += -I/usr/local/include/libnl3 -CFLAGS += -I/usr/include/libnl3 - -LDLIBS = -lnl-3 -lnl-route-3 -lm - -all: $(TARGETS) Makefile - -netem: $(OBJS) - $(CC) $(LDLIBS) -o $@ $^ - -mark.so: mark.c - $(CC) -g -fPIC -c -o mark.o mark.c - $(CC) -shared -o mark.so mark.o -ldl - -clean: - rm -f $(TARGETS) - rm -f *.o *~ - -.PHONY: all clean libnl