Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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:=12
  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_CFLAGS += -flto
  21. TARGET_LDFLAGS += -flto=jobserver
  22. TARGET_CPPFLAGS := \
  23. -D_GNU_SOURCE \
  24. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  25. -I$(PKG_BUILD_DIR) \
  26. $(TARGET_CPPFLAGS) \
  27. -I$(LINUX_DIR)/user_headers/include
  28. define Build/Compile
  29. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  30. $(MAKE) -C $(PKG_BUILD_DIR) \
  31. $(TARGET_CONFIGURE_OPTS) \
  32. LIBS="$(TARGET_LDFLAGS) -lnl-tiny -lm -luci -lubox"
  33. endef
  34. define Build/InstallDev
  35. $(INSTALL_DIR) $(1)/usr/include
  36. $(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/
  37. $(INSTALL_DIR) $(1)/usr/lib
  38. $(CP) $(PKG_BUILD_DIR)/libsw.a $(1)/usr/lib/
  39. endef
  40. define Package/swconfig/install
  41. $(INSTALL_DIR) $(1)/sbin $(1)/lib/network
  42. $(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig
  43. $(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
  44. endef
  45. $(eval $(call BuildPackage,swconfig))