#!/bin/bash

DIR=mac80211

if [ ! -f $DIR/Makefile.save ]; then
	cp $DIR/Makefile $DIR/Makefile.save
fi

cat << EOD >$DIR/Makefile
include \$(src)/../config

CFLAGS_ieee80211.o += -DRC80211_PID_COMPILE

$(
	cat $DIR/Makefile.save | sed -r -f $RULES \
		-e 's/mac80211\.o/rt2x_mac80211.o/g' \
		-e 's/rc80211_pid-/rt2x_rc80211_pid-/g' \
		-e 's/mac80211-/rt2x_mac80211-/g'
)
EOD

#
# Special modifications to the wireless source code.
#
sed -i -e 's/rc80211_pid_init/rt2x_rc80211_pid_init/g' \
	$DIR/rc80211_pid_algo.c $DIR/ieee80211_rate.h $DIR/ieee80211.c
sed -i -e 's/ieee80211_init)/rt2x_ieee80211_init)/g' \
	-e 's/ieee80211_init(/rt2x_ieee80211_init(/g' \
	$DIR/ieee80211.c

