Uniformize package Makefile,
[openwrt.git] / 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 $(TARGET_DIR)/usr/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so
31 install -m 644 $< $@
32 install -m 644 $< $(STAGING_DIR)/lib/libnvram.so
33 $(STRIP) $@
34
35 $(TARGET_DIR)/usr/sbin/nvram: $(PKG_BUILD_DIR)/nvram
36 mkdir -p $(TARGET_DIR)/usr/sbin
37 install -m 755 $< $@
38 $(STRIP) $@
39
40 compile: $(PKG_BUILD_DIR)/libnvram.so $(PKG_BUILD_DIR)/nvram
41 install: $(TARGET_DIR)/usr/lib/libnvram.so $(TARGET_DIR)/usr/sbin/nvram
42
43 clean:
44 rm -rf $(PKG_BUILD_DIR)
This page took 0.050835 seconds and 5 git commands to generate.