Bootloader CPU Freq

In order to get a bootloader working on the atmega8 using the internal oscillator, I had to edit the bootloader Makefile and change the clock freq from 16MHz to 8MHz. The fuses can be set in the boards.txt file and the changes seem to be recognised, but changing build.f_cpu seems to have no effect.

Looking at the Makefile for other microcontrollers (168, 328) they all set the clock freq AVR_FREQ inside the makefile. Would it be possible to have this set from the IDE and the bootloader recompiled before flashing?