From f11c70aac45f4a4fb80920ce9c3f379618adb7d7 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sat, 24 Oct 2020 18:54:16 +0200 Subject: [PATCH] fxsdk: change INCLUDE flags to support folders inside GCC Useful for OpenLibm as it is installed inside an [openlibm] folder but needs to be included directly as it uses #include without the openlibm/ part. --- fxsdk/assets/Makefile | 14 ++++++++++---- fxsdk/fxsdk.sh | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/fxsdk/assets/Makefile b/fxsdk/assets/Makefile index 83e5192..370dbbb 100755 --- a/fxsdk/assets/Makefile +++ b/fxsdk/assets/Makefile @@ -10,8 +10,8 @@ include project.cfg # Compiler flags -CFLAGSFX := $(CFLAGS) $(CFLAGS_FX) $(INCLUDE) -CFLAGSCG := $(CFLAGS) $(CFLAGS_CG) $(INCLUDE) +CFLAGSFX = $(CFLAGS) $(CFLAGS_FX) $(INCLUDE_FX) +CFLAGSCG = $(CFLAGS) $(CFLAGS_CG) $(INCLUDE_CG) # Linker flags LDFLAGSFX := $(LDFLAGS) $(LDFLAGS_FX) @@ -40,6 +40,12 @@ endif FXCONVFX := --fx --toolchain=$(TOOLCHAIN_FX) FXCONVCG := --cg --toolchain=$(TOOLCHAIN_CG) +# Determine the compiler install and include path +GCC_BASE_FX := $(shell $(TOOLCHAIN_FX)-gcc --print-search-dirs | grep install | sed 's/install: //') +GCC_BASE_CG := $(shell $(TOOLCHAIN_CG)-gcc --print-search-dirs | grep install | sed 's/install: //') +GCC_INCLUDE_FX := $(GCC_BASE_FX)/include +GCC_INCLUDE_CG := $(GCC_BASE_CG)/include + # # File listings # @@ -128,10 +134,10 @@ build-cg/%.s.o: %.s # Preprocessed assembler sources build-fx/%.S.o: %.S @ mkdir -p $(dir $@) - $(TOOLCHAIN_FX)-gcc -c $< -o $@ $(INCLUDE) + $(TOOLCHAIN_FX)-gcc -c $< -o $@ $(INCLUDE_FX) build-cg/%.S.o: %.S @ mkdir -p $(dir $@) - $(TOOLCHAIN_CG)-gcc -c $< -o $@ $(INCLUDE) + $(TOOLCHAIN_CG)-gcc -c $< -o $@ $(INCLUDE_CG) # Images build-fx/assets/img/%.o: assets-fx/img/% diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index 559adeb..d00c0f9 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -185,8 +185,11 @@ CFLAGS_CG := -D FXCG50 -m4-nofpu CFLAGS += -Wall -Wextra -Wno-missing-field-initializers -Os # Include paths. Add one -I option for each folder from which you want to -# be able to include files with #include<>. -INCLUDE := -I include +# be able to include files with #include<>. The Makefile provides a variable +# GCC_INCLUDE_FX/GCC_INCLUDE_CG that represents the default include folder, +# which is useful for some libraries such as OpenLibm. +INCLUDE_FX = -I include +INCLUDE_CG = -I include # Libraries. Add one -l option for each library you are using, and also # suitable -L options if you have library files in custom folders. To use