updated the makefile to create the build directory as needed.

This commit is contained in:
Jake Goodwin 2023-04-02 18:21:37 -07:00
parent 50502e4d1c
commit af08ced653
1 changed files with 13 additions and 10 deletions

View File

@ -1,9 +1,10 @@
ASM=avra ASM=avra
#INCLUDE=/opt/microchip/mplabx/v6.05/packs/Microchip/ATmega_DFP/3.0.158/avrasm/inc/m328pdef.inc #INCLUDE=/opt/microchip/mplabx/v6.05/packs/Microchip/ATmega_DFP/3.0.158/avrasm/inc/m328pdef.inc
INCLUDE=/opt/microchip/mplabx/v6.05/packs/Microchip/ATmega_DFP/3.0.158/avrasm/inc/ INCLUDE=/opt/microchip/mplabx/v6.05/packs/Microchip/ATmega_DFP/3.0.158/avrasm/inc/
SRC=./src/main.s SRC=./src
OUT=./build/prog PROG=main
MAPFILE=./build/prog.map OUT=./build
MAPFILE=prog.map
F_CPU=1000000UL F_CPU=1000000UL
MCU=atmega328p MCU=atmega328p
@ -17,20 +18,22 @@ OBJDUMP = avr-objdump
AVRSIZE = avr-size AVRSIZE = avr-size
AVRDUDE = avrdude AVRDUDE = avrdude
PROG=./src/main.s.hex #PROG=${OUT}/main.asm.hex
all: all:
${ASM} -I ${INCLUDE} ${SRC} -o ${OUT} -m ${MAPFILE} if [ -d ${OUT} ]; then return 0; else mkdir ${OUT}; fi
${ASM} -I ${INCLUDE} ${SRC}/${PROG}.asm -I ${OUT}/${PROG}.hex -m ${OUT}/${MAPFILE}
mv ${SRC}/*.hex ${OUT}
mv ${SRC}/*.obj ${OUT}
mv ${SRC}/*.cof ${OUT}
flash: ${PROG} flash: ${PROG}
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$< $(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<
clean: clean:
if test -e ${SRC}.hex; then
echo "cleaing hex files!"; echo "cleaing hex files!";
rm ${SRC}.hex; rm ${OUT}/*
done;
fi
flash_usbasp: PROGRAMMER_TYPE = usbasp flash_usbasp: PROGRAMMER_TYPE = usbasp
flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments