[package] replace some -I & -L flags with $(TARGET_CPPFLAGS) & $(TARGET_LDFLAGS)...
[openwrt-10.03/.git] / package / uci / Makefile
1 #
2 # Copyright (C) 2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 UCI_VERSION=0.7
12 UCI_RELEASE=3
13
14 PKG_NAME:=uci
15 PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE))
16 PKG_RELEASE:=1
17
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
20 PKG_MD5SUM:=b8c033e7b08bb39e87ef00bdb779f0ba
21
22 include $(INCLUDE_DIR)/package.mk
23
24 # set to 1 to enable debugging
25 DEBUG=
26
27 define Package/libuci
28   SECTION:=libs
29   CATEGORY:=Libraries
30   TITLE:=C library for the Unified Configuration Interface (UCI)
31 endef
32
33 define Package/uci
34   SECTION:=base
35   CATEGORY:=Base system
36   DEPENDS:=+libuci
37   TITLE:=Utility for the Unified Configuration Interface (UCI)
38 endef
39
40 define Package/libuci-lua
41   SECTION=libs
42   CATEGORY=Libraries
43   DEPENDS:=+libuci +lua
44   TITLE:=Lua plugin for UCI
45 endef
46
47 define Build/Configure
48 endef
49
50 TARGET_CFLAGS += $(FPIC)
51 UCI_MAKEOPTS = \
52                 $(TARGET_CONFIGURE_OPTS) \
53                 COPTS="$(TARGET_CFLAGS)" \
54                 DEBUG="$(DEBUG)" \
55                 VERSION="$(UCI_VERSION)" \
56                 CPPFLAGS="-I$(PKG_BUILD_DIR) $(TARGET_CPPFLAGS)" \
57                 OS="Linux"
58
59 # work around a nasty gcc bug
60 ifneq ($(CONFIG_GCC_VERSION_4_2_4),)
61   UCI_MAKEOPTS += WOPTS=""
62 endif
63
64 define Build/Compile
65         $(MAKE) -C $(PKG_BUILD_DIR) $(UCI_MAKEOPTS)
66         $(MAKE) -C $(PKG_BUILD_DIR)/lua $(UCI_MAKEOPTS)
67 endef
68
69 define Package/libuci/install
70         $(INSTALL_DIR) $(1)/lib
71         $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/lib/
72 endef
73
74 define Package/libuci-lua/install
75         $(INSTALL_DIR) $(1)/usr/lib/lua
76         $(CP) $(PKG_BUILD_DIR)/lua/uci.so $(1)/usr/lib/lua/
77 endef
78
79 define Package/uci/install
80         $(INSTALL_DIR) $(1)/etc/uci-defaults
81         $(INSTALL_DIR) $(1)/sbin
82         $(INSTALL_BIN) $(PKG_BUILD_DIR)/uci $(1)/sbin/
83         $(CP) ./files/* $(1)/
84 endef
85
86 define Build/InstallDev
87         $(INSTALL_DIR) $(1)/usr/include
88         $(CP) $(PKG_BUILD_DIR)/uci{,_config}.h $(1)/usr/include
89         $(INSTALL_DIR) $(1)/usr/lib
90         $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/usr/lib
91         $(CP) $(PKG_BUILD_DIR)/libuci.a $(1)/usr/lib
92         $(CP) $(PKG_BUILD_DIR)/libucimap.a $(1)/usr/lib
93 endef
94
95 $(eval $(call BuildPackage,uci))
96 $(eval $(call BuildPackage,libuci))
97 $(eval $(call BuildPackage,libuci-lua))