Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. IWINFO_SOVERSION = $(if $(SOVERSION),$(SOVERSION),0)
  2. IWINFO_BACKENDS = $(BACKENDS)
  3. IWINFO_CFLAGS = $(CFLAGS) -Wall -std=gnu99 -fstrict-aliasing -Iinclude
  4. IWINFO_LDFLAGS = -luci -lubox -lubus
  5. IWINFO_LIB = libiwinfo.so
  6. IWINFO_LIB_LDFLAGS = $(LDFLAGS) -shared -Wl,-soname -Wl,$(IWINFO_LIB).$(IWINFO_SOVERSION)
  7. IWINFO_LIB_OBJ = iwinfo_utils.o iwinfo_lib.o
  8. IWINFO_LUA = iwinfo.so
  9. IWINFO_LUA_LDFLAGS = $(LDFLAGS) -shared -L. -liwinfo -llua
  10. IWINFO_LUA_OBJ = iwinfo_lua.o
  11. IWINFO_CLI = iwinfo
  12. IWINFO_CLI_LDFLAGS = $(LDFLAGS) -L. -liwinfo
  13. IWINFO_CLI_OBJ = iwinfo_cli.o
  14. ifneq ($(filter wl wext madwifi,$(IWINFO_BACKENDS)),)
  15. IWINFO_CFLAGS += -DUSE_WEXT
  16. IWINFO_LIB_OBJ += iwinfo_wext.o iwinfo_wext_scan.o
  17. endif
  18. ifneq ($(filter wl,$(IWINFO_BACKENDS)),)
  19. IWINFO_CFLAGS += -DUSE_WL
  20. IWINFO_LIB_OBJ += iwinfo_wl.o
  21. endif
  22. ifneq ($(filter madwifi,$(IWINFO_BACKENDS)),)
  23. IWINFO_CFLAGS += -DUSE_MADWIFI
  24. IWINFO_LIB_OBJ += iwinfo_madwifi.o
  25. endif
  26. ifneq ($(filter nl80211,$(IWINFO_BACKENDS)),)
  27. IWINFO_CFLAGS += -DUSE_NL80211
  28. IWINFO_CLI_LDFLAGS += -lnl-tiny
  29. IWINFO_LIB_LDFLAGS += -lnl-tiny
  30. IWINFO_LIB_OBJ += iwinfo_nl80211.o
  31. endif
  32. compile: clean $(IWINFO_LIB) $(IWINFO_LUA) $(IWINFO_CLI)
  33. %.o: %.c
  34. $(CC) $(IWINFO_CFLAGS) $(FPIC) -c -o $@ $<
  35. $(IWINFO_LIB): $(IWINFO_LIB_OBJ)
  36. $(CC) $(IWINFO_LDFLAGS) $(IWINFO_LIB_LDFLAGS) -o $(IWINFO_LIB).$(IWINFO_SOVERSION) $(IWINFO_LIB_OBJ) && \
  37. ln -sf $(IWINFO_LIB).$(IWINFO_SOVERSION) $(IWINFO_LIB)
  38. $(IWINFO_LUA): $(IWINFO_LUA_OBJ)
  39. $(CC) $(IWINFO_LDFLAGS) $(IWINFO_LUA_LDFLAGS) -o $(IWINFO_LUA) $(IWINFO_LUA_OBJ)
  40. $(IWINFO_CLI): $(IWINFO_CLI_OBJ)
  41. $(CC) $(IWINFO_LDFLAGS) $(IWINFO_CLI_LDFLAGS) -o $(IWINFO_CLI) $(IWINFO_CLI_OBJ)
  42. clean:
  43. rm -f *.o $(IWINFO_LIB) $(IWINFO_LUA) $(IWINFO_CLI)