Add support for ATmega168p CPU
[pub/USBasp.git] / Makefile
1 #
2 # Makefile for Project: USBasp
3 # Author: Peter Henn
4 # Creation Date: 2014-05-30
5 # License: GNU GPL v2 (see License.txt)
6
7 MV=@mv
8 ECHO=@echo
9 MAKE=@make
10 RM=@rm -f
11
12 # Default Device and CPU Clock
13 DEVICE=atmega8
14 F_CPU=12000000
15 mhz := $(shell echo $$(( $(F_CPU)/1000000 )))
16
17 all:
18 $(MAKE) F_CPU=12000000 DEVICE=atmega8 do_firmware
19 $(MAKE) F_CPU=16000000 DEVICE=atmega8 do_firmware
20 $(MAKE) F_CPU=12000000 DEVICE=atmega88 do_firmware
21 $(MAKE) F_CPU=12000000 DEVICE=atmega168p do_firmware
22 $(MAKE) F_CPU=16000000 DEVICE=atmega168p do_firmware
23 $(MAKE) F_CPU=18000000 DEVICE=atmega168p do_firmware
24 $(MAKE) F_CPU=12000000 DEVICE=atmega328p do_firmware
25 $(MAKE) F_CPU=16000000 DEVICE=atmega328p do_firmware
26 $(MAKE) F_CPU=18000000 DEVICE=atmega328p do_firmware
27
28 help:
29 @echo "Usage:"
30 @echo " make build firmware for specified CPUs and Speed"
31 @echo " make help print this text"
32 @echo " make clean remove redundant data"
33 @echo " make deepclean clean & remove hex files"
34
35 do_firmware:
36 $(MAKE) clean
37 $(ECHO) "======>BUILDING USBasp FIRMWARE for"
38 $(ECHO) "CPU: $(DEVICE) - $(mhz) MHz"
39 $(ECHO) "."
40 $(MAKE) F_CPU=$(F_CPU) TARGET=$(DEVICE) -C firmware main.hex
41 $(MV) firmware/main.hex bin/firmware/usbasp.$(DEVICE)-$(mhz)MHz.hex
42
43 deepclean: clean
44 $(RM) *~
45 $(RM) bin/firmware/usbasp.*MHz.hex
46
47 clean:
48 $(MAKE) -C firmware clean