fix permission error on /usr/sbin/nvram
[openwrt.git] / package / openwrt / libnvram / Makefile
1 #
2 # Linux router shared code Makefile
3 #
4 # Copyright 2001-2003, Broadcom Corporation
5 # All Rights Reserved.
6 #
7 # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11 #
12 # $Id$
13 include $(TOPDIR)/rules.mk
14
15 PKG_NAME:=libnvram
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
17
18 EXTRA_CFLAGS := -c -I. -I../include
19
20 all: compile
21
22 define OBJ_template
23 $(PKG_BUILD_DIR)/$(1): $(PKG_BUILD_DIR)
24 $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -o $$@ $$(patsubst %.o,%.c,$(1))
25 endef
26
27 OBJS := nvram_linux.o nvram_convert.o main.o
28 LIBNVRAM_OBJS:= $(PKG_BUILD_DIR)/nvram_linux.o $(PKG_BUILD_DIR)/nvram_convert.o
29 $(foreach obj,$(OBJS),$(eval $(call OBJ_template,$(obj))))
30
31 $(PKG_BUILD_DIR):
32 mkdir -p $(PKG_BUILD_DIR)
33
34 $(PKG_BUILD_DIR)/nvram: $(PKG_BUILD_DIR)/main.o
35 $(TARGET_CC) $(TARGET_CFLAGS) -o $@ $^ -L$(PKG_BUILD_DIR) -lnvram
36
37 $(PKG_BUILD_DIR)/libnvram.so: $(LIBNVRAM_OBJS)
38 $(TARGET_CC) -shared -o $@ $^
39
40 $(TARGET_DIR)/usr/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so
41 install -m 644 $< $@
42 install -m 644 $< $(STAGING_DIR)/lib/libnvram.so
43 $(STRIP) $@
44
45 $(TARGET_DIR)/usr/sbin/nvram: $(PKG_BUILD_DIR)/nvram
46 mkdir -p $(TARGET_DIR)/usr/sbin
47 install -m 755 $< $@
48 $(STRIP) $@
49
50 compile: $(PKG_BUILD_DIR)/libnvram.so $(PKG_BUILD_DIR)/nvram
51 install: $(TARGET_DIR)/usr/lib/libnvram.so $(TARGET_DIR)/usr/sbin/nvram
52
53 clean:
54 rm -rf $(PKG_BUILD_DIR)
This page took 0.037768 seconds and 5 git commands to generate.