Skip to content

Commit

Permalink
propagate MODE to Makefile for cross-compiling
Browse files Browse the repository at this point in the history
Allow makefile to be used directly for cross-compiling (e.g. when treated as a git submodule). This requires CC and AR to be passed for a particular toolchain, but CFLAGS must also specify CPU and FPU options -> introduce MODE variable. CFLAGS cannot be passed without need to override in the makefile, so a new variable is needed.

Cortex-M7 Example (linker: library and project use of VFP registers must match):
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar MODE="-mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard"

(commit can be cherry-picked)
  • Loading branch information
MisterHW committed Jan 7, 2023
1 parent 7d0c83d commit c394eb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libscpi/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VERSION = 2.1.0
LIBNAME = scpi

CFLAGS += -Wextra -Wmissing-prototypes -Wimplicit -Iinc
CFLAGS += $(MODE) -Wextra -Wmissing-prototypes -Wimplicit -Iinc
CFLAGS_SHARED += $(CFLAGS) -fPIC
LDFLAGS += -lm -Wl,--as-needed
LDFLAGS += $(MODE) -lm -Wl,--as-needed
#TESTCFLAGS += $(CFLAGS) `pkg-config --cflags cunit`
#TESTLDFLAGS += $(LDFLAGS) `pkg-config --libs cunit`
TESTCFLAGS += $(CFLAGS)
Expand Down

0 comments on commit c394eb9

Please sign in to comment.