So, when I took over the Optiboot project, I inherited a makefile structure that includes rules like:
atmega168: TARGET = atmega168 atmega168: MCU_TARGET = atmega168 atmega168: CFLAGS += $(COMMON_OPTIONS) atmega168: AVR_FREQ ?= 16000000L atmega168: LDSECTIONS = -Wl,--section-start=.text=0x3c00 -Wl,--section-start=.v atmega168: $(PROGRAM)_atmega168.hex atmega168: $(PROGRAM)_atmega168.lst atmega328: TARGET = atmega328 atmega328: MCU_TARGET = atmega328p atmega328: CFLAGS += $(COMMON_OPTIONS) atmega328: AVR_FREQ ?= 16000000L atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe atmega328: $(PROGRAM)_atmega328.hex atmega328: $(PROGRAM)_atmega328.lst
This is not a syntax/style that I'm used to. Aren't things on the right side of a ":" supposed to be "dependencies" of the "targets" on the left?
I don't even think I understand what's supposed to happen if the same target is mentioned multiple times, even without the above dependency vs expression issue.
Does anyone have an explanation for what's going on? Is there a good reason to use a syntax like this, or is it more likely to be a case of "the person who wrote the Makefile originally didn't really understand Make very well"?
My general observation is that Makefiles expand in complexity until no one really understands them any more :-( (auto-generated Makefiles are worse, since they start out incomprehensible by mortals.)