chiark / gitweb /
id location stuff done by Makefiles
[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 #       subsequently:   for all                 update FOO.hex
8 #   other possibilities are not ruled out
9 #
10 # filename conventions - contents of hex files
11 #   FOO.hex             FOO.o (only)
12 #   FOO-withcfg.hex     FOO.o                           config.o
13 #   FOO-entire0.hex     FOO.o           idlocs0.o       config.o
14 #   perpicNUMBER.hex                    idlocsNUMBER.o  config.o
15
16 PROGRAM_HEXES=  $(addsuffix .hex, $(PROGRAMS)) \
17                 $(addsuffix -withcfg.hex, $(PROGRAMS))
18
19 all:            $(TARGETS) $(PROGRAM_HEXES)
20
21 o=>$@.new && mv -f $@.new $@
22
23 LINK=           gplink -o $@ $^
24 ASSEMBLE=       gpasm -p 18f458
25
26 %-withcfg.hex:  %.o config.o
27                 $(LINK)
28
29 %.hex:          %.o
30                 $(LINK)
31
32 %.o:            %.asm
33                 $(ASSEMBLE) -c $<
34
35 .PRECIOUS:      %.o
36
37 pic-clean:
38                 -rm -f -- *~ *.new
39                 -rm -f *.hex *.cod *.lst *.o