Skip to content

Commit c356c5d

Browse files
committed
[GCC]: Pass extra flags to gcc build.
There is no way to pass extra flags to gcc though riscv-gnu-toolchain Makefile. This is neccesary for me, because I has to rewrite gmp, isl, mpfr, mpc folders in source of gcc project. Moreover, I don't want to rebuild them with gcc. Also I think, the opportunity to pass extra flags will be convenient for many development purposes.
1 parent 65056bd commit c356c5d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Makefile.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ stamps/build-gcc-linux-stage1: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-binutil
413413
$(WITH_ARCH) \
414414
$(WITH_TUNE) \
415415
$(WITH_ISA_SPEC) \
416+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
416417
CFLAGS_FOR_TARGET="-O2 $(CFLAGS_FOR_TARGET)" \
417418
CXXFLAGS_FOR_TARGET="-O2 $(CXXFLAGS_FOR_TARGET)"
418419
$(MAKE) -C $(notdir $@) inhibit-libc=true all-gcc
@@ -448,6 +449,7 @@ stamps/build-gcc-linux-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) $(addprefix stamps/b
448449
$(WITH_ARCH) \
449450
$(WITH_TUNE) \
450451
$(WITH_ISA_SPEC) \
452+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
451453
CFLAGS_FOR_TARGET="-O2 $(CFLAGS_FOR_TARGET)" \
452454
CXXFLAGS_FOR_TARGET="-O2 $(CXXFLAGS_FOR_TARGET)"
453455
$(MAKE) -C $(notdir $@)
@@ -502,6 +504,7 @@ stamps/build-gcc-linux-native: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-gcc-lin
502504
$(WITH_ARCH) \
503505
$(WITH_TUNE) \
504506
$(WITH_ISA_SPEC) \
507+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
505508
$(MAKE) -C $(notdir $@)
506509
$(MAKE) -C $(notdir $@) install
507510
cp -a $(INSTALL_DIR)/$(LINUX_TUPLE)/lib* $(SYSROOT)
@@ -580,6 +583,7 @@ stamps/build-gcc-newlib-stage1: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-binuti
580583
$(WITH_ARCH) \
581584
$(WITH_TUNE) \
582585
$(WITH_ISA_SPEC) \
586+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
583587
CFLAGS_FOR_TARGET="-Os $(CFLAGS_FOR_TARGET)" \
584588
CXXFLAGS_FOR_TARGET="-Os $(CXXFLAGS_FOR_TARGET)"
585589
$(MAKE) -C $(notdir $@) all-gcc
@@ -680,6 +684,7 @@ stamps/build-gcc-newlib-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-newlib
680684
$(WITH_ARCH) \
681685
$(WITH_TUNE) \
682686
$(WITH_ISA_SPEC) \
687+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
683688
CFLAGS_FOR_TARGET="-Os $(CFLAGS_FOR_TARGET)" \
684689
CXXFLAGS_FOR_TARGET="-Os $(CXXFLAGS_FOR_TARGET)"
685690
$(MAKE) -C $(notdir $@)
@@ -742,6 +747,7 @@ stamps/build-gcc-musl-stage1: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-binutils
742747
$(WITH_ARCH) \
743748
$(WITH_TUNE) \
744749
$(WITH_ISA_SPEC) \
750+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
745751
CFLAGS_FOR_TARGET="-O2 $(CFLAGS_FOR_TARGET)" \
746752
CXXFLAGS_FOR_TARGET="-O2 $(CXXFLAGS_FOR_TARGET)"
747753
$(MAKE) -C $(notdir $@) inhibit-libc=true all-gcc
@@ -810,6 +816,7 @@ stamps/build-gcc-musl-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-musl-lin
810816
$(WITH_ARCH) \
811817
$(WITH_TUNE) \
812818
$(WITH_ISA_SPEC) \
819+
$(GCC_EXTRA_CONFIGURE_FLAGS) \
813820
CFLAGS_FOR_TARGET="-O2 $(CFLAGS_FOR_TARGET)" \
814821
CXXFLAGS_FOR_TARGET="-O2 $(CXXFLAGS_FOR_TARGET)"
815822
$(MAKE) -C $(notdir $@)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ devtoolset-7 works.
137137
There are a number of additional options that may be passed to
138138
configure. See './configure --help' for more details.
139139

140+
Also you can define extra flags to pass to specific projects: ```BINUTILS_NATIVE_FLAGS_EXTRA, BINUTILS_TARGET_FLAGS_EXTRA, GCC_EXTRA_CONFIGURE_FLAGS, GDB_NATIVE_FLAGS_EXTRA, GDB_TARGET_FLAGS_EXTRA, GLIBC_NATIVE_FLAGS_EXTRA, GLIBC_TARGET_FLAGS_EXTRA```.
141+
Example: ```GCC_EXTRA_CONFIGURE_FLAGS=--with-gmp=/opt/gmp make linux```
142+
140143
#### Set default ISA spec version
141144

142145
`--with-isa-spec=` can specify the default version of the RISC-V Unprivileged

0 commit comments

Comments
 (0)