# GCC-AVR standard Makefile part 2 # Volker Oth 1/2000 # Modified by AVRfreaks.net for smoother integrasjon with AVR Studio. (06/2001) #define all project specific object files OBJ = $(ASRC:.s=.o) $(SRC:.c=.o) CPFLAGS += -mmcu=$(MCU) ASFLAGS += -mmcu=$(MCU) LDFLAGS += -mmcu=$(MCU) #this defines the aims of the make process all: $(TRG).elf $(TRG).hex $(TRG).ok $(TRG).cof #compile: instructions to create assembler and/or object files from C source %o : %c $(CC) -c $(CPFLAGS) -I$(INCDIR) $< -o $@ %s : %c $(CC) -S $(CPFLAGS) -I$(INCDIR) $< -o $@ #assemble: instructions to create object file from assembler files %o : %s $(AS) -c $(ASFLAGS) -I$(INCDIR) $< -o $@ #link: instructions to create elf output file from object files %elf: $(OBJ) $(CC) $(OBJ) $(LIB) $(LDFLAGS) -o $@ #create bin (ihex, srec) file from elf output file %hex: %elf $(BIN) -O $(FORMAT) -R .eeprom $< $@ %eep: %elf $(BIN) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ %cof: %elf # $(ELFCOF) $< $(OUT) $@ $*sym # a wedlug wskazowek z forum avrgcc $(ELFCOF) $< $(OUT) $@ $*sym $(CP) Coff\$@ . $(CP) Coff\\*sym . $(CP) Coff\\*S . #If all other steps compile ok then echo "Errors: none". #Necessary for AVR Studio to understand that everything went ok. %ok: @echo "Errors: none" #make instruction to delete created files clean: $(RM) $(OBJ) $(RM) $(SRC:.c=.s) $(RM) $(SRC:.c=.lst) $(RM) $(TRG).map $(RM) $(TRG).elf $(RM) $(TRG).obj $(RM) $(TRG).a90 $(RM) $(TRG).hex $(RM) *.bak $(RM) *.log size: $(SIZE) $(TRG).elf