summaryrefslogtreecommitdiff
path: root/package/openwrt/libnvram/Makefile
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-03-07 23:24:52 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-03-07 23:24:52 +0000
commit0bc4109776d047ae999f11b3e329d10eb364d561 (patch)
tree1380766f4869ba8d6b2db810ef2f6d49b5c17799 /package/openwrt/libnvram/Makefile
parent94e6296f0f36687cdd6dd96848c9abf76c16a0ff (diff)
add libshared/libnvram and required includes under version control
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@344 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/openwrt/libnvram/Makefile')
-rw-r--r--package/openwrt/libnvram/Makefile54
1 files changed, 54 insertions, 0 deletions
diff --git a/package/openwrt/libnvram/Makefile b/package/openwrt/libnvram/Makefile
new file mode 100644
index 0000000000..d109a17483
--- /dev/null
+++ b/package/openwrt/libnvram/Makefile
@@ -0,0 +1,54 @@
+#
+# Linux router shared code Makefile
+#
+# Copyright 2001-2003, Broadcom Corporation
+# All Rights Reserved.
+#
+# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+#
+# $Id$
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libnvram
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+EXTRA_CFLAGS := -c -I. -I../include
+
+all: compile
+
+define OBJ_template
+$(PKG_BUILD_DIR)/$(1): $(PKG_BUILD_DIR)
+ $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -o $$@ $$(patsubst %.o,%.c,$(1))
+endef
+
+OBJS := nvram_linux.o nvram_convert.o main.o
+LIBNVRAM_OBJS:= $(PKG_BUILD_DIR)/nvram_linux.o $(PKG_BUILD_DIR)/nvram_convert.o
+$(foreach obj,$(OBJS),$(eval $(call OBJ_template,$(obj))))
+
+$(PKG_BUILD_DIR):
+ mkdir -p $(PKG_BUILD_DIR)
+
+$(PKG_BUILD_DIR)/nvram: $(PKG_BUILD_DIR)/main.o
+ $(TARGET_CC) $(TARGET_CFLAGS) -o $@ $^ -L$(PKG_BUILD_DIR) -lnvram
+
+$(PKG_BUILD_DIR)/libnvram.so: $(LIBNVRAM_OBJS)
+ $(TARGET_CC) -shared -o $@ $^
+
+$(TARGET_DIR)/usr/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so
+ install -m 644 $< $@
+ install -m 644 $< $(STAGING_DIR)/lib/libnvram.so
+ $(STRIP) $@
+
+$(TARGET_DIR)/usr/sbin/nvram: $(PKG_BUILD_DIR)/nvram
+ mkdir -p $(TARGET_DIR)/usr/sbin
+ install -m 644 $< $@
+ $(STRIP) $@
+
+compile: $(PKG_BUILD_DIR)/libnvram.so $(PKG_BUILD_DIR)/nvram
+install: $(TARGET_DIR)/usr/lib/libnvram.so $(TARGET_DIR)/usr/sbin/nvram
+
+clean:
+ rm -rf $(PKG_BUILD_DIR)