d1c8fd7b5e1d90de7f87d150e5e6c4766b9dc966
[openwrt/staging/yousong.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:=11
12
13 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
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/Compile
34 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
35 $(MAKE) -C $(PKG_BUILD_DIR) \
36 $(TARGET_CONFIGURE_OPTS) \
37 LIBS="$(TARGET_LDFLAGS) -lnl-tiny -lm -luci"
38 endef
39
40 define Build/InstallDev
41 $(INSTALL_DIR) $(1)/usr/include
42 $(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/
43
44 $(INSTALL_DIR) $(1)/usr/lib
45 $(CP) $(PKG_BUILD_DIR)/libsw.so $(1)/usr/lib/
46 endef
47
48 define Package/swconfig/install
49 $(INSTALL_DIR) $(1)/sbin $(1)/lib/network
50 $(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig
51 $(INSTALL_BIN) $(PKG_BUILD_DIR)/libsw.so $(1)/lib
52 $(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
53 endef
54
55 $(eval $(call BuildPackage,swconfig))