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.
This commit is contained in:
Lephenixnoir 2020-10-24 18:54:16 +02:00
parent ee9c459c69
commit f11c70aac4
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 15 additions and 6 deletions

View file

@ -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/%

View file

@ -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