# # Makefile for Project: USBasp # Author: Peter Henn # Creation Date: 2014-05-30 # License: GNU GPL v2 (see License.txt) MV=@mv ECHO=@echo MAKE=@make RM=@rm -f # Default Device and CPU Clock DEVICE=atmega8 F_CPU=12000000 mhz := $(shell echo $$(( $(F_CPU)/1000000 ))) all: $(MAKE) F_CPU=12000000 DEVICE=atmega8 do_firmware $(MAKE) F_CPU=16000000 DEVICE=atmega8 do_firmware $(MAKE) F_CPU=12000000 DEVICE=atmega88 do_firmware $(MAKE) F_CPU=12000000 DEVICE=atmega168p do_firmware $(MAKE) F_CPU=16000000 DEVICE=atmega168p do_firmware $(MAKE) F_CPU=18000000 DEVICE=atmega168p do_firmware $(MAKE) F_CPU=12000000 DEVICE=atmega328p do_firmware $(MAKE) F_CPU=16000000 DEVICE=atmega328p do_firmware $(MAKE) F_CPU=18000000 DEVICE=atmega328p do_firmware help: @echo "Usage:" @echo " make build firmware for specified CPUs and Speed" @echo " make help print this text" @echo " make clean remove redundant data" @echo " make deepclean clean & remove hex files" do_firmware: $(MAKE) clean $(ECHO) "======>BUILDING USBasp FIRMWARE for" $(ECHO) "CPU: $(DEVICE) - $(mhz) MHz" $(ECHO) "." $(MAKE) F_CPU=$(F_CPU) TARGET=$(DEVICE) -C firmware main.hex $(MV) firmware/main.hex bin/firmware/usbasp.$(DEVICE)-$(mhz)MHz.hex deepclean: clean $(RM) *~ $(RM) bin/firmware/usbasp.*MHz.hex clean: $(MAKE) -C firmware clean