automatically configure switches when swconfig is installed
[openwrt/openwrt.git] / package / swconfig / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=kmod-swconfig
12 PKG_RELEASE:=1
13 PKG_BUILD_DEPENDS:=libnl
14
15 include $(INCLUDE_DIR)/package.mk
16
17 define Package/swconfig
18 SECTION:=base
19 CATEGORY:=Base system
20 DEPENDS:=@LINUX_2_6_26||LINUX_2_6_27||LINUX_2_6_28||LINUX_2_6_29 +libuci
21 TITLE:=Switch configuration utility
22 endef
23
24 TARGET_CPPFLAGS += \
25 -I$(LINUX_DIR)/include \
26 -I$(PKG_BUILD_DIR)
27
28 define Build/Prepare
29 mkdir -p $(PKG_BUILD_DIR)
30 $(CP) ./src/* $(PKG_BUILD_DIR)/
31 endef
32
33 define Build/Compile
34 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
35 $(MAKE) -C $(PKG_BUILD_DIR) \
36 $(TARGET_CONFIGURE_OPTS) \
37 LIBS="-L$(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/lib/libnl.a -lm -luci"
38 endef
39
40 define Package/swconfig/install
41 $(INSTALL_DIR) $(1)/bin $(1)/lib/network
42 $(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/bin/swconfig
43 $(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
44 endef
45
46 $(eval $(call BuildPackage,swconfig))