paul@24 | 1 | # Makefile - Rules for building PIC32 deployment payloads |
paul@24 | 2 | # |
paul@24 | 3 | # Copyright (C) 2015, 2017, 2018 Paul Boddie <paul@boddie.org.uk> |
paul@24 | 4 | # Copyright (C) Xiangfu Liu <xiangfu@sharism.cc> |
paul@24 | 5 | # |
paul@24 | 6 | # This program is free software: you can redistribute it and/or modify |
paul@24 | 7 | # it under the terms of the GNU General Public License as published by |
paul@24 | 8 | # the Free Software Foundation, either version 3 of the License, or |
paul@24 | 9 | # (at your option) any later version. |
paul@24 | 10 | # |
paul@24 | 11 | # This program is distributed in the hope that it will be useful, |
paul@24 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@24 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@24 | 14 | # GNU General Public License for more details. |
paul@24 | 15 | # |
paul@24 | 16 | # You should have received a copy of the GNU General Public License |
paul@24 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@24 | 18 | |
paul@24 | 19 | .PHONY: all clean distclean |
paul@24 | 20 | |
paul@24 | 21 | all: $(HEX) $(SREC) |
paul@24 | 22 | |
paul@24 | 23 | clean: |
paul@24 | 24 | rm -f $(OBJ) $(TARGET) $(HEX) $(SREC) $(DUMP) *.map |
paul@24 | 25 | |
paul@24 | 26 | distclean: clean |
paul@24 | 27 | echo "Nothing else to clean." |
paul@24 | 28 | |
paul@24 | 29 | $(HEX): $(TARGET) |
paul@24 | 30 | $(OBJCOPY) -O ihex $(TARGET) $(HEX) |
paul@24 | 31 | |
paul@24 | 32 | $(SREC): $(TARGET) |
paul@24 | 33 | $(OBJCOPY) -O srec $(TARGET) $(SREC) |
paul@24 | 34 | |
paul@24 | 35 | $(TARGET): $(OBJ) |
paul@24 | 36 | $(LD) $(LDFLAGS) -T $(SCRIPT) $(OBJ) -o $@ |
paul@24 | 37 | $(OBJDUMP) -D $(TARGET) > $(DUMP) |
paul@24 | 38 | $(OBJDUMP) -h $(TARGET) > $(MAP) |
paul@24 | 39 | $(NM) -n $(TARGET) > System.map |
paul@24 | 40 | |
paul@24 | 41 | .c.o: |
paul@24 | 42 | $(CC) -c $(CFLAGS) $< -o $@ |
paul@24 | 43 | |
paul@24 | 44 | .S.o: |
paul@24 | 45 | $(CC) -c $(CFLAGS) $< -o $@ |