Convert libnet to new packaging style
[openwrt.git] / 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 PKG_WLCOMPAT := $(PACKAGE_DIR)/kmod-wlcompat_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
12
13 SHARED_INCLUDE:=${shell pwd}/include
14
15 libshared-compile libnvram-compile:
16 @$(MAKE) -C $(patsubst %-compile,%,$@) compile
17
18 libshared-install libnvram-install: libshared-compile libnvram-compile
19 @$(MAKE) -C $(patsubst %-install,%,$@) install
20
21 libshared-clean libnvram-clean wlc-clean:
22 @$(MAKE) -C $(patsubst %-clean,%,$@) clean
23
24 $(PKG_IPK_DIR)/sbin/mtd: mtd.c
25 mkdir -p $(PKG_IPK_DIR)/sbin
26 $(TARGET_CC) -o $@ $<
27
28 $(PKG_IPK_DIR)/sbin/jffs2root: jffs2root.c
29 mkdir -p $(PKG_IPK_DIR)/sbin
30 $(TARGET_CC) -o $@ $<
31
32 $(PKG_IPK_DIR)/usr/sbin/wlc: wlc.c libshared-install
33 mkdir -p $(PKG_IPK_DIR)/usr/sbin
34 $(TARGET_CC) -o $@ $< -lshared -L./libshared -I$(SHARED_INCLUDE)
35
36 # wlconf tool extracted from linksys firmware GPL.unpackedtree
37 # WRT54GS_3_37_2_1109_US
38 LINKSYS_TGZ_SITE=http://openwrt.openbsd-geek.de
39 LINKSYS_TGZ_MD5SUM=1b596e5bf26d2898d1eab5bd200bee58
40 LINKSYS_WLCONF_TGZ=linksys-wlconf.tar.gz
41 LINKSYS_WLCONF_DIR=$(BUILD_DIR)/linksys-wlconf
42
43 $(DL_DIR)/$(LINKSYS_WLCONF_TGZ):
44 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINKSYS_WLCONF_TGZ) $(LINKSYS_TGZ_MD5SUM) $(LINKSYS_TGZ_SITE)
45
46 $(LINKSYS_WLCONF_DIR)/.unpacked: $(DL_DIR)/$(LINKSYS_WLCONF_TGZ)
47 zcat $(DL_DIR)/$(LINKSYS_WLCONF_TGZ) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
48 touch $(LINKSYS_WLCONF_DIR)/.unpacked
49
50 $(TARGET_DIR)/usr/sbin/wlconf: $(LINKSYS_WLCONF_DIR)/.unpacked
51 $(MAKE) -C $(LINKSYS_WLCONF_DIR) INSTALLDIR=$(TARGET_DIR) \
52 CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld STRIP="$(STRIP)" \
53 CFLAGS="$(TARGET_CFLAGS) -I. -I$(SHARED_INCLUDE) \
54 -Wall -DOPENWRT_WLCONF" \
55 LDFLAGS="-lnvram -lshared" \
56 install
57 $(STRIP) $@
58
59 $(PKG_IPK): $(PKG_IPK_DIR)/sbin/mtd $(PKG_IPK_DIR)/sbin/jffs2root $(PKG_IPK_DIR)/usr/sbin/wlc
60 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_RELEASE) $(ARCH)
61 $(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
62 $(STRIP) $(PKG_IPK_DIR)/sbin/*
63 mkdir -p $(PACKAGE_DIR)
64 $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
65
66 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
67 $(IPKG) install $<
68
69 $(IPKG_STATE_DIR)/info/kmod-wlcompat.list: $(PKG_WLCOMPAT)
70 $(IPKG) install $<
71
72
73 WLCOMPAT_FLAGS:=$(TARGET_CLFAGS) -D__KERNEL__ -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 \
74 -mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 \
75 -Wa,-mips32 -Wa,--trap -DMODULE -mlong-calls -fno-common -I. -I linux-2.4 -funsigned-char -nostdinc \
76 -iwithprefix include -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/asm/gcc -I./include -c
77
78 $(PKG_BUILD_DIR)/wlcompat.o:
79 $(TARGET_CC) $(WLCOMPAT_FLAGS) -o $@ wlcompat.c
80
81 $(PKG_BUILD_DIR)/wlcompat-debug.o:
82 $(TARGET_CC) -DDEBUG $(WLCOMPAT_FLAGS) -o $@ wlcompat.c
83
84 $(PKG_WLCOMPAT): $(PKG_BUILD_DIR)/wlcompat.o $(PKG_BUILD_DIR)/wlcompat-debug.o
85 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BUILD_DIR)/wlcompat kmod-wlcompat.control $(LINUX_VERSION)-$(PKG_RELEASE) $(ARCH)
86 mkdir -p $(PKG_BUILD_DIR)/wlcompat/etc/modules.d
87 echo "wlcompat" > $(PKG_BUILD_DIR)/wlcompat/etc/modules.d/10-wlcompat
88 mkdir -p $(PKG_BUILD_DIR)/wlcompat/lib/modules/$(LINUX_VERSION)
89 cp $^ $(PKG_BUILD_DIR)/wlcompat/lib/modules/$(LINUX_VERSION)/
90 $(IPKG_BUILD) $(PKG_BUILD_DIR)/wlcompat $(PACKAGE_DIR)
91
92 source: $(DL_DIR)/$(LINKSYS_WLCONF_TGZ)
93 prepare: $(LINKSYS_WLCONF_DIR)/.unpacked
94 compile: prepare libnvram-compile libshared-compile $(PKG_IPK) $(PKG_WLCOMPAT)
95 install: libnvram-install libshared-install \
96 $(TARGET_DIR)/usr/sbin/wlconf \
97 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list \
98 $(IPKG_STATE_DIR)/info/kmod-wlcompat.list
99
100 clean: libshared-clean libnvram-clean
101 rm -rf $(PKG_BUILD_DIR)
102 rm -f $(PKG_IPK)
This page took 0.045974 seconds and 5 git commands to generate.