aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 3c15800..bb26ce1 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,13 @@ QEMU_AVR ?= qemu-system-avr
MCU ?= atmega32u4
SIM_MCU ?= atmega2560
-CFLAGS += -Wall -Wextra -DF_CPU=16000000UL -mmcu=$(MCU) -O3
-SIM_CFLAGS += -Wall -Wextra -DF_CPU=16000000UL -mmcu=$(SIM_MCU) -g3 -gdwarf-2 -DWDT_DISABLE
+COMMON_CFLAGS += -Wall -Wextra -DF_CPU=16000000UL
+CFLAGS += $(COMMON_CFLAGS) -mmcu=$(MCU) -O3
+SIM_CFLAGS += $(COMMON_CFLAGS) -mmcu=$(SIM_MCU) -g3 -gdwarf-2 -DWDT_DISABLE
+
+COMMON_LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
+LDFLAGS += $(COMMON_LDFLAGS) -mmcu=$(MCU)
+SIM_LDFLAGS += $(COMMON_LDFLAGS) -mmcu=$(SIM_MCU)
$(shell mkdir -p build/{real,sim})
@@ -26,14 +31,14 @@ build/altimeter.elf: \
build/real/display_sim.o \
build/real/altimeter.o \
build/real/util.o
- $(CC) -o $@ $^ $(CFLAGS)
+ $(CC) -o $@ $^ $(LDFLAGS)
build/altimeter_sim.elf: \
build/sim/barometer_sim.o \
build/sim/display_sim.o \
build/sim/altimeter.o \
build/sim/util.o
- $(CC) -o $@ $^ $(SIM_CFLAGS)
+ $(CC) -o $@ $^ $(SIM_LDFLAGS)
include config.mk