a5b62848bae92ae64bd2295437883e603576076b
[openwrt.git] / openwrt / package / openwrt / libnvram / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=libnvram
6 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
7
8 EXTRA_CFLAGS := -c -I. -I../include
9
10 all: compile
11
12 define OBJ_template
13 $(PKG_BUILD_DIR)/$(1): $(PKG_BUILD_DIR)
14 $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -o $$@ $$(patsubst %.o,%.c,$(1))
15 endef
16
17 OBJS := nvram_linux.o nvram_convert.o main.o
18 LIBNVRAM_OBJS:= $(PKG_BUILD_DIR)/nvram_linux.o $(PKG_BUILD_DIR)/nvram_convert.o
19 $(foreach obj,$(OBJS),$(eval $(call OBJ_template,$(obj))))
20
21 $(PKG_BUILD_DIR):
22 mkdir -p $(PKG_BUILD_DIR)
23
24 $(PKG_BUILD_DIR)/nvram: $(PKG_BUILD_DIR)/main.o $(PKG_BUILD_DIR)/libnvram.so
25 $(TARGET_CC) $(TARGET_CFLAGS) -o $@ $< -L$(PKG_BUILD_DIR) -lnvram
26
27 $(PKG_BUILD_DIR)/libnvram.so: $(LIBNVRAM_OBJS)
28 $(TARGET_CC) -shared -o $@ $^
29
30 $(STAGING_DIR)/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so
31 install -m 644 $< $@
32
33 $(TARGET_DIR)/usr/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so
34 install -m 644 $< $@
35 $(STRIP) $@
36
37 $(TARGET_DIR)/usr/sbin/nvram: $(PKG_BUILD_DIR)/nvram
38 mkdir -p $(TARGET_DIR)/usr/sbin
39 install -m 755 $< $@
40 $(STRIP) $@
41
42 compile: $(PKG_BUILD_DIR)/libnvram.so $(STAGING_DIR)/lib/libnvram.so $(PKG_BUILD_DIR)/nvram
43 install: $(TARGET_DIR)/usr/lib/libnvram.so $(TARGET_DIR)/usr/sbin/nvram
44
45 clean:
46 rm -rf $(PKG_BUILD_DIR)
This page took 0.042753 seconds and 3 git commands to generate.