3 include $(TOPDIR
)/rules.mk
5 PKG_NAME
:= openwrt-utils
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
11 PKG_WLCOMPAT
:= $(PACKAGE_DIR
)/kmod-wlcompat_
$(LINUX_VERSION
)-$(PKG_RELEASE
)_
$(ARCH
).ipk
13 SHARED_INCLUDE
:=${shell pwd
}/include
15 libshared-compile libnvram-compile
:
16 @
$(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile
18 libshared-install libnvram-install
: libshared-compile libnvram-compile
19 @
$(MAKE
) -C
$(patsubst %-install,%,$@
) install
21 libshared-clean libnvram-clean wlc-clean
:
22 @
$(MAKE
) -C
$(patsubst %-clean,%,$@
) clean
24 $(PKG_IPK_DIR
)/sbin
/mtd
: mtd.c
25 mkdir
-p
$(PKG_IPK_DIR
)/sbin
28 $(PKG_IPK_DIR
)/sbin
/jffs2root
: jffs2root.c
29 mkdir
-p
$(PKG_IPK_DIR
)/sbin
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
)
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
43 $(DL_DIR
)/$(LINKSYS_WLCONF_TGZ
):
44 $(SCRIPT_DIR
)/download.pl
$(DL_DIR
) $(LINKSYS_WLCONF_TGZ
) $(LINKSYS_TGZ_MD5SUM
) $(LINKSYS_TGZ_SITE
)
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
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" \
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
)
66 $(IPKG_STATE_DIR
)/info/$(PKG_NAME
).list
: $(PKG_IPK
)
69 $(IPKG_STATE_DIR
)/info/kmod-wlcompat.list
: $(PKG_WLCOMPAT
)
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
78 $(PKG_BUILD_DIR
)/wlcompat.o
:
79 $(TARGET_CC
) $(WLCOMPAT_FLAGS
) -o
$@ wlcompat.c
81 $(PKG_BUILD_DIR
)/wlcompat-debug.o
:
82 $(TARGET_CC
) -DDEBUG
$(WLCOMPAT_FLAGS
) -o
$@ wlcompat.c
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
)
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
100 clean: libshared-clean libnvram-clean
101 rm -rf
$(PKG_BUILD_DIR
)