swconfig: support receiving SWITCH_TYPE_LINK from kernel
[openwrt/openwrt.git] / package / network / config / swconfig / Makefile
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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=swconfig
11 PKG_RELEASE:=10
12
13 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
14 PKG_LICENSE:=GPL-2.0
15
16 include $(INCLUDE_DIR)/package.mk
17 include $(INCLUDE_DIR)/kernel.mk
18
19 define Package/swconfig
20 SECTION:=base
21 CATEGORY:=Base system
22 DEPENDS:=+libuci +libnl-tiny
23 TITLE:=Switch configuration utility
24 endef
25
26 TARGET_CPPFLAGS := \
27 -D_GNU_SOURCE \
28 -I$(STAGING_DIR)/usr/include/libnl-tiny \
29 -I$(PKG_BUILD_DIR) \
30 $(TARGET_CPPFLAGS) \
31 -I$(LINUX_DIR)/user_headers/include
32
33 define Build/Prepare
34 mkdir -p $(PKG_BUILD_DIR)
35 $(CP) ./src/* $(PKG_BUILD_DIR)/
36 endef
37
38 define Build/Compile
39 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
40 $(MAKE) -C $(PKG_BUILD_DIR) \
41 $(TARGET_CONFIGURE_OPTS) \
42 LIBS="$(TARGET_LDFLAGS) -lnl-tiny -lm -luci"
43 endef
44
45 define Build/InstallDev
46 $(INSTALL_DIR) $(1)/usr/include
47 $(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/
48
49 $(INSTALL_DIR) $(1)/usr/lib
50 $(CP) $(PKG_BUILD_DIR)/libsw.so $(1)/usr/lib/
51 endef
52
53 define Package/swconfig/install
54 $(INSTALL_DIR) $(1)/sbin $(1)/lib/network
55 $(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig
56 $(INSTALL_BIN) $(PKG_BUILD_DIR)/libsw.so $(1)/lib
57 $(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
58 endef
59
60 $(eval $(call BuildPackage,swconfig))