4c129fd4ce0d9043851c2387aa3ff1ab6e5a32e4
[openwrt.git] / openwrt / package / openwrt / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME := openwrt-utils
6 PKG_RELEASE := 1
7 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
8 PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_RELEASE)_$(ARCH).ipk
9 PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
10
11 SHARED_INCLUDE:=${shell pwd}/include
12
13 libshared-compile libnvram-compile wlc-compile:
14 @$(MAKE) -C $(patsubst %-compile,%,$@) compile
15
16 libshared-install libnvram-install wlc-install:
17 @$(MAKE) -C $(patsubst %-install,%,$@) install
18
19 libshared-clean libnvram-clean wlc-clean:
20 @$(MAKE) -C $(patsubst %-clean,%,$@) clean
21
22 $(PKG_IPK_DIR)/sbin/mtd: mtd.c
23 mkdir -p $(PKG_IPK_DIR)/sbin
24 $(TARGET_CC) -o $@ $<
25
26 $(PKG_IPK_DIR)/sbin/jffs2root: jffs2root.c
27 mkdir -p $(PKG_IPK_DIR)/sbin
28 $(TARGET_CC) -o $@ $<
29
30 $(PKG_IPK_DIR)/usr/sbin/wlc: wlc.c libshared-compile
31 mkdir -p $(PKG_IPK_DIR)/usr/sbin
32 $(TARGET_CC) -o $@ $< -lshared -L./libshared -I$(SHARED_INCLUDE)
33
34 # wlconf tool extracted from linksys firmware GPL.unpackedtree
35 # WRT54GS_3_37_2_1109_US
36 LINKSYS_TGZ_SITE=http://openwrt.openbsd-geek.de
37 LINKSYS_TGZ_MD5SUM=1b596e5bf26d2898d1eab5bd200bee58
38 LINKSYS_WLCONF_TGZ=linksys-wlconf.tar.gz
39 LINKSYS_WLCONF_DIR=$(BUILD_DIR)/linksys-wlconf
40
41 $(DL_DIR)/$(LINKSYS_WLCONF_TGZ):
42 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINKSYS_WLCONF_TGZ) $(LINKSYS_TGZ_MD5SUM) $(LINKSYS_TGZ_SITE)
43
44 $(LINKSYS_WLCONF_DIR)/.unpacked: $(DL_DIR)/$(LINKSYS_WLCONF_TGZ)
45 zcat $(DL_DIR)/$(LINKSYS_WLCONF_TGZ) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
46 touch $(LINKSYS_WLCONF_DIR)/.unpacked
47
48 $(TARGET_DIR)/usr/sbin/wlconf: $(LINKSYS_WLCONF_DIR)/.unpacked
49 $(MAKE) -C $(LINKSYS_WLCONF_DIR) INSTALLDIR=$(TARGET_DIR) \
50 CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld STRIP="$(STRIP)" \
51 CFLAGS="$(TARGET_CFLAGS) -I. -I$(SHARED_INCLUDE) \
52 -Wall -DOPENWRT_WLCONF" \
53 LDFLAGS="-lnvram -lshared" \
54 install
55 $(STRIP) $@
56
57 $(PKG_IPK): $(PKG_IPK_DIR)/sbin/mtd $(PKG_IPK_DIR)/sbin/jffs2root $(PKG_IPK_DIR)/usr/sbin/wlc
58 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_RELEASE) $(ARCH)
59 $(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
60 $(STRIP) $(PKG_IPK_DIR)/sbin/*
61 mkdir -p $(PACKAGE_DIR)
62 $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
63
64 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
65 $(IPKG) install $(PKG_IPK)
66
67 source: $(DL_DIR)/$(LINKSYS_WLCONF_TGZ)
68 prepare: $(LINKSYS_WLCONF_DIR)/.unpacked
69 compile: prepare libnvram-compile libshared-compile $(PKG_IPK)
70 install: libnvram-install libshared-install \
71 $(TARGET_DIR)/usr/sbin/wlconf \
72 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list
73
74 clean: libshared-clean libnvram-clean
75 rm -rf $(PKG_BUILD_DIR)
76 rm -f $(PKG_IPK)
This page took 0.044223 seconds and 3 git commands to generate.