41 lines
1.2 KiB
Makefile
41 lines
1.2 KiB
Makefile
# Makefile to build light_ws2812 library examples
|
|
# This is not a very good example of a makefile - the dependencies do not work, therefore everything is rebuilt every time.
|
|
|
|
# Change these parameters for your device
|
|
|
|
F_CPU = 16000000
|
|
# DEVICE = attiny85
|
|
DEVICE = atmega168p
|
|
#
|
|
# Tools:
|
|
CC = avr-gcc
|
|
|
|
LIB = light_ws2812
|
|
EXAMPLES = RGB_blinky RGBW_blinky Chained_writes Rainbow
|
|
DEP = ws2812_config.h Light_WS2812/light_ws2812.h
|
|
|
|
CFLAGS = -g2 -I. -ILight_WS2812 -mmcu=$(DEVICE) -DF_CPU=$(F_CPU)
|
|
CFLAGS+= -Os -ffunction-sections -fdata-sections -fpack-struct -fno-move-loop-invariants -fno-tree-scev-cprop -fno-inline-small-functions
|
|
CFLAGS+= -Wall -Wno-pointer-to-int-cast
|
|
#CFLAGS+= -Wa,-ahls=$<.lst
|
|
|
|
LDFLAGS = -Wl,--relax,--section-start=.text=0,-Map=main.map
|
|
|
|
all: $(EXAMPLES)
|
|
|
|
$(LIB): $(DEP)
|
|
@echo Building Library
|
|
@$(CC) $(CFLAGS) -o Objects/$@.o -c Light_WS2812/$@.c
|
|
|
|
$(EXAMPLES): $(LIB)
|
|
@echo Building $@
|
|
@$(CC) $(CFLAGS) -o Objects/$@.o Examples/$@.c Light_WS2812/$^.c
|
|
@avr-size Objects/$@.o
|
|
@avr-objcopy -j .text -j .data -O ihex Objects/$@.o $@.hex
|
|
@avr-objdump -d -S Objects/$@.o >Objects/$@.lss
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
rm -f *.hex Objects/*.o Objects/*.lss
|