commit 0989a42ecf8ddc1c38f40710db46be04932062f3 parent 26fb95fa5e441e0decf1ac581f3f9130a2ba0f12 Author: Martin Kloeckner <mjkloeckner@gmail.com> Date: Sun, 28 Sep 2025 16:58:20 -0300 updated `Makefile`: bind compile recipe to bin file Diffstat:
| M | Makefile | | | 15 | +++++++-------- |
1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile @@ -11,27 +11,26 @@ CFLAGS := -Wall -Os -DF_CPU=16000000UL -mmcu=atmega328p .PHONY: all -all: $(BIN_DIR) compile +all: $(BIN_DIR) $(BIN_DIR)/main.hex $(BIN_DIR)/%.o: $(SRC_DIR)/%.c $(CC) $(CFLAGS) \ -c $< -o $@ - @echo "" -compile: $(OBJS) +$(BIN_DIR)/main.elf: $(OBJS) $(CC) $(CFLAGS) \ -o $(BIN_DIR)/main.elf $(OBJS) - @echo "" + +$(BIN_DIR)/main.hex: $(BIN_DIR)/main.elf avr-objcopy -O ihex -R .eeprom $(BIN_DIR)/main.elf $(BIN_DIR)/main.hex -upload: compile +upload: $(BIN_DIR)/main.hex avrdude -F -V -c arduino -p ATMEGA328P \ -P $(PORT) -b 115200 -U flash:w:$(BIN_DIR)/main.hex $(BIN_DIR): - @if [ ! -d "$(BIN_DIR)" ]; then \ - echo "Creating folder '$(BIN_DIR)'"; \ - mkdir -p $(BIN_DIR); \ + @if [ ! -d "$(BIN_DIR)" ]; then \ + mkdir -pv $(BIN_DIR); \ fi size:
