chiark / gitweb /
correcter comment
[trains.git] / pic.make
1 # recommended programming order
2 #   one test on PIC#0
3 #       first time:                             erase, write FOO-entire0.hex
4 #       subsequently if only FOO.asm changed:   update FOO.hex
5 #   for all pics
6 #       first time:     for each individually   erase, write perpicNUM.hex
7 #                       then for all            update FOO.hex
8 #       subsequently:   for all                 update FOO.hex
9 #   other possibilities are not ruled out
10 #
11 # filename conventions - contents of hex files
12 #   FOO.hex             FOO.o (only)
13 #   FOO-withcfg.hex     FOO.o                           config.o
14 #   FOO-entire0.hex     FOO.o           idlocs0.o       config.o
15 #   perpicNUMBER.hex                    idlocsNUMBER.o  config.o
16
17 PROGRAM_HEXES=  $(addsuffix .hex, $(PROGRAMS)) \
18                 $(addsuffix -withcfg.hex, $(PROGRAMS))
19
20 all:            $(TARGETS) $(PROGRAM_HEXES)
21
22 o=>$@.new && mv -f $@.new $@
23
24 LINK=           gplink -o $@ $^
25 ASSEMBLE=       gpasm -p 18f458
26
27 %-withcfg.hex:  %.o config.o
28                 $(LINK)
29
30 %.hex:          %.o
31                 $(LINK)
32
33 %.o:            %.asm
34                 $(ASSEMBLE) -c $<
35
36 .PRECIOUS:      %.o
37
38 pic-clean:
39                 -rm -f -- *~ *.new
40                 -rm -f *.hex *.cod *.lst *.o