-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
executable file
·82 lines (60 loc) · 1.68 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# makefile
# Copyright (c) 2012 - 2017 Thomas Buck <[email protected]>
# All rights reserved.
TARGET = avr_pump_board
SRCS = src/main.c
SRCS += src/clock.c
SRCS += src/interface.c
SRCS += src/lights.c
SRCS += src/pumps.c
SRCS += src/recipe.c
SRCS += src/serial.c
# -----------------------------------------------------------------------------
MCU = atxmega128a1
F_CPU = 32000000
ISPPORT = usb
ISPTYPE = avrisp2
# -----------------------------------------------------------------------------
CARGS = -mmcu=$(MCU)
CARGS += -Iinc
CARGS += -Os
CARGS += -funsigned-char
CARGS += -funsigned-bitfields
CARGS += -fpack-struct
CARGS += -fshort-enums
CARGS += -ffunction-sections
CARGS += -fdata-sections
CARGS += -Wall -Wstrict-prototypes
CARGS += -std=gnu99
CARGS += -DF_CPU=$(F_CPU)
CARGS += -MP -MD
LDARGS = -Wl,-L.,-lm,--relax,--gc-sections
# -----------------------------------------------------------------------------
AVRDUDE = avrdude
AVRGCC = avr-gcc
AVRSIZE = avr-size
AVROBJCOPY = avr-objcopy
RM = rm -rf
# -----------------------------------------------------------------------------
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
all: $(TARGET).hex $(TARGET).elf $(OBJS)
program: $(TARGET).hex
$(AVRDUDE) -p $(MCU) -c $(ISPTYPE) -P $(ISPPORT) -e -U $(TARGET).hex
%.hex: %.elf $(OBJS)
$(AVROBJCOPY) -O ihex $< $@
%.elf: $(OBJS)
$(AVRGCC) $(CARGS) $(OBJS) --output $@ $(LDARGS)
$(AVRSIZE) $@
%.o: %.c
$(AVRGCC) -c $< -o $@ $(CARGS)
clean:
$(RM) $(OBJS)
$(RM) $(DEPS)
$(RM) $(TARGET).elf
$(RM) $(TARGET).hex
# Always recompile interface (prints compile date)
src/interface.o: FORCE
FORCE:
# -----------------------------------------------------------------------------
-include $(DEPS)