From 2bbe855662ee7b3aecf318d5016dcf2622b5f70b Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Thu, 21 Sep 2023 15:03:40 +0300 Subject: [PATCH] Makefile: adapt for libftdi vs libftdi1 differences Use the cflags and libs from pkg-config. This allows us to adapt to the distro differences. Also, make sure to autodetect if the distro provides libftdi or libftdi1, preferring the latter one. Signed-off-by: Dmitry Baryshkov --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 83a80fb..5a6e1ae 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,10 @@ else $(info No compiler flags for: $(CC)) endif -LDFLAGS := -ludev -lyaml -lftdi -lusb +LIBFTDI := $(shell pkg-config --exists libftdi1 && echo libftdi1 || echo libftdi) + +CPPFLAGS := $(shell pkg-config --cflags yaml-0.1 $(LIBFTDI) libudev) +LDFLAGS := $(shell pkg-config --libs yaml-0.1 $(LIBFTDI) libudev) CLIENT_SRCS := cdba.c circ_buf.c CLIENT_OBJS := $(CLIENT_SRCS:.c=.o)