Skip to content

Commit

Permalink
support libnl flavors like libnl-tiny to allow builds for openwrt
Browse files Browse the repository at this point in the history
libnl-3 is available on x86 in debian - in openwrt libnl is split into
multiple packages which are incompatible between libnl and libnl-tiny.
This adds support for these flavors such that ddhcpd can be built using
libnl-tiny
  • Loading branch information
christf committed Dec 3, 2022
1 parent fdf26dc commit 22fefb2
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ HDRS=$(wildcard *.h)
REVISION=$(shell git rev-list --first-parent HEAD --max-count=1)

CC=gcc

ifeq ($(origin PKG_CONFIG), undefined)
PKG_CONFIG = pkg-config
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
$(error $(PKG_CONFIG) not found)
endif
endif

ifeq ($(origin LIBNL_CFLAGS) $(origin LIBNL_LDLIBS), undefined undefined)
LIBNL_NAME ?= libnl-3.0
ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBNL_NAME) 2>/dev/null),)
$(error No $(LIBNL_NAME) development libraries found!)
endif
LIBNL_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBNL_NAME))
LIBNL_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBNL_NAME))
endif
CFLAGS += $(LIBNL_CFLAGS)
LFLAGS += $(LIBNL_LDLIBS)


CFLAGS+= \
-Wall \
-Wextra \
Expand All @@ -26,8 +46,7 @@ CFLAGS+= \
-Wswitch-default \
-Wswitch-enum \
-Wunreachable-code \
-Winit-self \
`pkg-config --cflags libnl-3.0`
-Winit-self

CXXFLAGS+= \
${CFLAGS} \
Expand All @@ -37,8 +56,7 @@ CXXFLAGS+= \

LFLAGS+= \
-flto \
-lm \
`pkg-config --libs libnl-3.0`
-lm

ifeq ($(DEBUG),1)
CFLAGS+= \
Expand Down

0 comments on commit 22fefb2

Please sign in to comment.