Is Atmega8L-8PU compatible with Atmega 328 on arduino UNO?
The short answer is that it should be no problem at all... in fact in the off-the-shelf Arduino IDE, if you select from the menus: Tools => Boards => Arduino NG or older w/ ATmega8. It will compile your sketch for the ATMega8. Furthermore, if you hold down the Shift key when you click the Compile button, the IDE will show you the path to the temp directory in which your compilation artifacts are created. Assuming you know how to burn a HEX file to an AVR and set the fuses for your crystal, you should be able to take it from there...