forked from foxharp/avrlirc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
113 lines (87 loc) · 2.67 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Makefile for avrlirc and avrlirc2udp
# Paul Fox, April 2007
# current code assumes ATTiny2313. (it uses UART, 16 bit timer, and
# input capture event interrupt.)
MCU = attiny2313
# location of cross-compiler -- edit to suit
#CROSS = /opt/avr-gcc-070314/bin/avr-
CROSS = avr-
CC=$(CROSS)gcc
LD=$(CROSS)gcc
NM=$(CROSS)nm
SIZE=$(CROSS)size
OBJCOPY = $(CROSS)objcopy
OBJDUMP = $(CROSS)objdump
CFLAGS = -c -Os -Wwrite-strings -Wall -mmcu=$(MCU)
CFLAGS += -Wa,-adhlns=$(<:%.c=%.lst)
LFLAGS = -mmcu=$(MCU)
HOSTCC = gcc
# HCFLAGS = -DPERSONAL_HACKS
HCFLAGS = -DVERSION=$(VERSION) -DPERSONAL_HACKS
PROG = avrlirc
SRCS = avrlirc.c
OBJS = avrlirc.o
VERSION = $(shell date +%y%m%d-%H%M)
CFLAGS += -DAVRLIRC_VERSION="\"$(VERSION)\""
all: $(PROG).hex $(PROG).lss avrlirc2udp airboard-ir
$(PROG).out: $(OBJS)
@-test -f $(PROG).out && (echo size was: ; $(SIZE) $(PROG).out)
$(LD) -o $@ $(LFLAGS) $(OBJS)
$(NM) -n $@ >$(PROG).map
@echo size is:
@$(SIZE) $(PROG).out
$(PROG).hex: $(PROG).out
$(OBJCOPY) -R .eeprom -O ihex $^ $@
# Create extended listing file from ELF output file.
%.lss: %.out
$(OBJDUMP) -h -S $< > $@
sizes: $(OBJS)
@echo
@echo Individual:
$(SIZE) -t $(OBJS)
@echo
@echo Complete:
$(SIZE) $(PROG).out
avrlirc2udp: avrlirc2udp.c
$(HOSTCC) $(HCFLAGS) -Wall avrlirc2udp.c -o avrlirc2udp
airboard-ir: airboard-ir.c
$(HOSTCC) $(HCFLAGS) -O2 -Wall airboard-ir.c -o airboard-ir
# convenience target for upgrading on multiple machines
install-airboard-ir: $(PROG) ab-installscript
for h in kousa moss phlox lily pansy;\
do \
echo $$h ;\
scp $(PROG) ab-installscript $$h:/tmp ;\
ssh -t olpc@$$h sudo sh /tmp/ab-installscript ;\
done
for h in jade ivy ;\
do \
echo $$h ;\
scp $(PROG) ab-installscript $$h:/tmp ;\
ssh -t pgf@$$h sudo sh /tmp/ab-installscript ;\
done
ab-installscript:
echo 'set -x; cd /usr/local/bin; mv $(PROG) $(PROG).old; mv /tmp/$(PROG) . ; killall $(PROG)' >ab-installscript
chmod a+x ab-installscript
tarball: all clean
mkdir -p oldfiles
mv $(PROG)-*.hex *.tar.gz oldfiles || true
mv $(PROG).hex $(PROG)-$(VERSION).hex || true
ln -s avrlirc ../avrlirc-$(VERSION)
tar -C .. --dereference \
--exclude CVS \
--exclude oldfiles \
--exclude web \
--exclude '*.tar.gz' \
-czf ../avrlirc-$(VERSION).tar.gz avrlirc-$(VERSION)
mv ../avrlirc-$(VERSION).tar.gz .
rm -f ../avrlirc-$(VERSION)
program:
sudo avrdude -p t2313 -c sp12 -U avrlirc.hex -E noreset
bod_fuses: # brown-out detection
sudo avrdude -p t2313 -c sp12 -U lfuse:w:0x64:m -U hfuse:w:0xd7:m -E noreset
clean:
rm -f *.o *.flash *.flash.* *.out *.map *.lst *.lss
rm -f avrlirc2udp airboard-ir ab-installscript
clobber: clean
rm -f avrlirc.hex