Makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #
  2. # Copyright (C) 2008-2010 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=swconfig
  9. PKG_RELEASE:=11
  10. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  11. PKG_LICENSE:=GPL-2.0
  12. include $(INCLUDE_DIR)/package.mk
  13. include $(INCLUDE_DIR)/kernel.mk
  14. define Package/swconfig
  15. SECTION:=base
  16. CATEGORY:=Base system
  17. DEPENDS:=+libuci +libnl-tiny
  18. TITLE:=Switch configuration utility
  19. endef
  20. TARGET_CPPFLAGS := \
  21. -D_GNU_SOURCE \
  22. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  23. -I$(PKG_BUILD_DIR) \
  24. $(TARGET_CPPFLAGS) \
  25. -I$(LINUX_DIR)/user_headers/include
  26. define Build/Prepare
  27. mkdir -p $(PKG_BUILD_DIR)
  28. $(CP) ./src/* $(PKG_BUILD_DIR)/
  29. endef
  30. define Build/Compile
  31. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  32. $(MAKE) -C $(PKG_BUILD_DIR) \
  33. $(TARGET_CONFIGURE_OPTS) \
  34. LIBS="$(TARGET_LDFLAGS) -lnl-tiny -lm -luci"
  35. endef
  36. define Build/InstallDev
  37. $(INSTALL_DIR) $(1)/usr/include
  38. $(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/
  39. $(INSTALL_DIR) $(1)/usr/lib
  40. $(CP) $(PKG_BUILD_DIR)/libsw.so $(1)/usr/lib/
  41. endef
  42. define Package/swconfig/install
  43. $(INSTALL_DIR) $(1)/sbin $(1)/lib/network
  44. $(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig
  45. $(INSTALL_BIN) $(PKG_BUILD_DIR)/libsw.so $(1)/lib
  46. $(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
  47. endef
  48. $(eval $(call BuildPackage,swconfig))