-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·39 lines (28 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# AVR Makefile
# what do you want to call your binary
PROG=libarduino
# please uncomment the CPU that is used on your arduino
CPU=atmega328p
#CPU=atmega168
# please uncomment the speed that corresponds to your arduino (normally 16MHz)
F_CPU=16000000
#F_CPU=8000000
#############################################################################
# no additional config needed below (except perpapse the 'make install')
#############################################################################
CFLAGS= -g -Os -Wall -Wstrict-prototypes -Wa,-ahlms=$(PROG).lst -mmcu=$(CPU) -DF_CPU=$(F_CPU)
CFLAGS += -gdwarf-2 -std=gnu99 -Wextra -pedantic -ffunction-sections -fdata-sections -fno-inline-small-functions -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -MD -MP -MT $(*F).o -MF
SRC = uart.c ir.c pwm.c adc.c gpio.c crc8.c onewire.c ds18x20.c
OBJ = $(SRC:.c=.o)
# default target when "make" is run w/o arguments
all: $(PROG).a
# compile .c into .o
%.o: %.c
avr-gcc -c $(CFLAGS) -I. $*.c
# link up *.o to create the archive file
$(PROG).a: $(OBJ)
avr-ar rcs $(PROG).a $(OBJ)
# command to clean up junk (no source files) (invoked by "make clean")
clean:
rm -f *.o *.rom *.elf *.a *.map *~ *.lst