#ifdef / #switchdef / array for upload to multiple targets (same HW)

Yes, I'd suggest writing a config sketch that just takes the MAC / IP from serial and stores
it in the EEPROM, reads it back and prints to serial for confirmation, upload that
and run it for each board to configure.

Then upload the sketch that does what you want using EEPROM. You can always
make the EEPROM uploading an option of the main sketch if you need to, of course.

You may want to use DHCP and avoid uploading the IP.

Also if you are using an ethernet or WiFi card it should have a MAC ROM already...