ser2neo: a serial port to NeoPixel ring bridge.

avr.mk 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright 2015 Google Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #
  15. APP ?= $(notdir $(PWD))
  16. VERSION ?= $(shell date +%Y%m%d)+git$(shell git describe --always)
  17. SRC = $(wildcard *.cc)
  18. OBJ = $(SRC:%.cc=%.o)
  19. CROSS_COMPILE = avr-
  20. CC = $(CROSS_COMPILE)gcc
  21. CXX = $(CROSS_COMPILE)g++
  22. CFLAGS = -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -Wall
  23. CXXFLAGS = $(CFLAGS) -std=gnu++1y
  24. all: $(APP).hex
  25. usb-flash: $(APP).hex
  26. sudo $(HOME)/bin/micronucleus --run $<
  27. %.elf: $(OBJ)
  28. $(CXX) $(CXXFLAGS) -o $@ $(OBJ)
  29. $(CROSS_COMPILE)size -d $@
  30. %.hex: %.elf
  31. avr-objcopy -j .text -j .data -O ihex $< $@
  32. clean:
  33. rm -f $(APP).hex $(APP).elf $(OBJ) *~ *.ii
  34. dist:
  35. rm -rf tmp
  36. mkdir tmp
  37. git archive --prefix=$(APP)-$(VERSION)/ HEAD | gzip > tmp/$(APP)-$(VERSION).tar.gz
  38. cd tmp && git clone $$(readlink -f ..) $(APP)
  39. $(MAKE) -C tmp/$(APP)