Mac based AVR development issue
Your makefile should compile each C file into object code, then use the linker to combine the objects with libraries. You don't need -lm for each compiled file.

In your makefile, you are using $(COMPILE) as both compiler and linker, which is fine for GCC, but is probably confusing matters.

all:    main.hex

.c.o:
    $(COMPILE) -c $&lt; -o $@

.S.o:
    $(COMPILE) -c $&lt; -o $@

.c.s:
    $(COMPILE) -S $&lt; -o $@

main.elf: $(OBJECTS)
    $(COMPILE) -lm -o main.elf $(OBJECTS)