Makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. CFLAGS += -std=c99 -D_BSD_SOURCE
  2. CPPFLAGS += -D_GNU_SOURCE
  3. ifeq ($(origin PKG_CONFIG), undefined)
  4. PKG_CONFIG = pkg-config
  5. ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
  6. $(error $(PKG_CONFIG) not found)
  7. endif
  8. endif
  9. ifeq ($(origin LIBNL_CFLAGS) $(origin LIBNL_LDLIBS), undefined undefined)
  10. LIBNL_NAME ?= libnl-tiny
  11. ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBNL_NAME) 2>/dev/null),)
  12. $(error No $(LIBNL_NAME) development libraries found!)
  13. endif
  14. LIBNL_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBNL_NAME))
  15. LIBNL_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBNL_NAME))
  16. endif
  17. CFLAGS_JSONC = $(shell pkg-config --cflags json-c)
  18. LDFLAGS_JSONC = $(shell pkg-config --libs json-c)
  19. all: neighbours-batadv stations respondd.so
  20. neighbours-batadv: neighbours-batadv.c batadv-netlink.c
  21. $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LIBNL_CFLAGS) $(LDFLAGS) $(LDFLAGS_JSONC) $(LIBNL_LDLIBS) -Wall -o $@ $^ $(LDLIBS)
  22. stations: stations.c
  23. $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LDFLAGS) $(LDFLAGS_JSONC) -Wall -o $@ $^ $(LDLIBS) -liwinfo
  24. respondd.so: respondd.c
  25. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -fPIC -o $@ $^ $(LDLIBS)