$FreeWRT$
--- madwifi-0.9.2.orig/tools/Makefile	Fri Jul 14 07:15:56 2006
+++ madwifi-0.9.2/tools/Makefile	Thu Sep 21 02:22:02 2006
@@ -46,9 +46,14 @@ endif
 
 INCS=  -include $(DEPTH)/include/compat.h
 
-
+ifdef DOMULTI
+OBJS= do_multi.o athstats.o 80211stats.o athkey.o athchans.o athctrl.o \
+	athdebug.o 80211debug.o wlanconfig.o 
+ALL=  ${OBJS} madwifi_multi
+else
 ALL=	athstats 80211stats athkey athchans athctrl \
 	athdebug 80211debug wlanconfig
+endif
 
 all:	$(ALL)
 
@@ -58,6 +63,30 @@ ALL_CFLAGS= $(CFLAGS) $(INCS)
 LDFLAGS=
 
 all:	$(ALL)
+
+athstats.o: athstats.c
+	${CC} -c -o athstats.o -DDOMULTI=1 ${ALL_CFLAGS} -I../ath athstats.c
+80211stats.o: 80211stats.c
+	${CC} -c -o 80211stats.o -DDOMULTI=1 ${ALL_CFLAGS} 80211stats.c
+athkey.o: athkey.c
+	${CC} -c -o athkey.o -DDOMULTI=1 ${ALL_CFLAGS} athkey.c
+athchans.o: athchans.c
+	${CC} -c -o athchans.o -DDOMULTI=1 ${ALL_CFLAGS} athchans.c
+athctrl.o: athctrl.c
+	${CC} -c -o athctrl.o -DDOMULTI=1 ${ALL_CFLAGS} athctrl.c
+athdebug.o: athdebug.c
+	${CC} -c -o athdebug.o -DDOMULTI=1 ${ALL_CFLAGS} athdebug.c
+wlanconfig.o: wlanconfig.c
+	${CC} -c -o wlanconfig.o -DDOMULTI=1 ${ALL_CFLAGS} wlanconfig.c
+80211debug.o: 80211debug.c
+	${CC} -c -o 80211debug.o -DDOMULTI=1 ${ALL_CFLAGS} 80211debug.c
+do_multi.o: do_multi.c
+	${CC} -c -o do_multi.o -DDOMULTI=1 ${ALL_CFLAGS} do_multi.c
+madwifi_multi:
+	${CC} -o madwifi_multi ${LDFLAGS} ${OBJS}
+	for i in athstats 80211stats athkey athchans athctrl athdebug wlanconfig 80211debug; do \
+	ln -s -f madwifi_multi $$i; \
+	done
 
 athstats: athstats.c
 	$(CC) -o athstats $(ALL_CFLAGS) -I../ath $(LDFLAGS) athstats.c
