aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2020-12-20 22:22:17 +1300
committerDavid Phillips <david@yeah.nah.nz>2020-12-20 22:22:17 +1300
commit75154ebdfbbfe7a04d21d910254058a757d2eef6 (patch)
treea4b2276da1b23a88fb15c434a2aaa7d6939c79b0 /Makefile
parent74dbe89a7574ccfc0238c9ec4f55ac4fd9d40949 (diff)
downloadaltimeter-75154ebdfbbfe7a04d21d910254058a757d2eef6.tar.xz
Use float-enabled printf implementation
I hadn't realised there is a float-enabled printf implementation in AVR libc, so let's use that instead of our own hack.
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