From 46d732fea4ece0c921a43a73845bb5a8009877e3 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 26 Feb 2016 17:09:04 -0500 Subject: build system: --toolchain: initial implementation. --- Makefile.in | 3 +++ config.project | 1 + config.usage | 2 ++ configure | 11 +++++++++++ sysinfo/compiler/clang.mk | 19 ------------------- sysinfo/compiler/cparser.mk | 19 ------------------- sysinfo/compiler/gcc.mk | 19 ------------------- sysinfo/toolchain/binutils.mk | 17 +++++++++++++++++ sysinfo/toolchain/llvm.mk | 17 +++++++++++++++++ 9 files changed, 51 insertions(+), 57 deletions(-) create mode 100644 sysinfo/toolchain/binutils.mk create mode 100644 sysinfo/toolchain/llvm.mk diff --git a/Makefile.in b/Makefile.in index 1fff0dd..3d56b19 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,6 +6,7 @@ HOST = @host@ TARGET = @target@ ARCH = @arch@ COMPILER = @compiler@ +TOOLCHAIN = @toolchain@ SYSROOT = @sysroot@ CROSS_COMPILE = @cross_compile@ SHELL = @shell@ @@ -62,6 +63,7 @@ static: include $(PROJECT_DIR)/sysinfo/host/$(HOST).mk include $(PROJECT_DIR)/sysinfo/compiler/$(COMPILER).mk +include $(PROJECT_DIR)/sysinfo/toolchain/$(TOOLCHAIN).mk include $(PROJECT_DIR)/project/defs.mk include $(PROJECT_DIR)/project/tree.mk @@ -211,6 +213,7 @@ clean: @echo TARGET:' '$(TARGET) @echo ARCH:' '$(ARCH) @echo COMPILER:' '$(COMPILER) + @echo TOOLCHAIN:' '$(TOOLCHAIN) @echo SYSROOT:' '$(SYSROOT) @echo XCOMPILE:' '$(CROSS_COMPILE) @echo SHELL:' '$(SHELL) diff --git a/config.project b/config.project index b147a66..1847425 100644 --- a/config.project +++ b/config.project @@ -20,6 +20,7 @@ mb_default_host= mb_default_target= mb_default_arch= mb_default_compiler= +mb_default_toolchain= mb_default_sysroot= mb_default_cross_compile= mb_default_shell=sh diff --git a/config.usage b/config.usage index ca4419c..fda5882 100644 --- a/config.usage +++ b/config.usage @@ -17,6 +17,7 @@ supported switches: --target --arch --compiler + --toolchain --sysroot --cross-compile --shell @@ -43,6 +44,7 @@ supported variables: TARGET ARCH COMPILER + TOOLCHAIN SYSROOT CROSS_COMPILE SHELL diff --git a/configure b/configure index 7409596..b2dfe60 100755 --- a/configure +++ b/configure @@ -45,6 +45,7 @@ init_vars() mb_target=$TARGET mb_arch=$ARCH mb_compiler=$COMPILER + mb_toolchain=$TOOLCHAIN mb_sysroot=$SYSROOT mb_cross_compile=$CROSS_COMPILE mb_shell=$SHELL @@ -120,6 +121,7 @@ common_defaults() [ -z "$mb_target" ] && mb_target=$mb_default_target [ -z "$mb_arch" ] && mb_arch=$mb_default_arch [ -z "$mb_compiler" ] && mb_compiler=$mb_default_compiler + [ -z "$mb_toolchain" ] && mb_toolchain=$mb_default_toolchain [ -z "$mb_sysroot" ] && mb_sysroot=$mb_default_sysroot [ -z "$mb_cross_compile" ] && mb_cross_compile=$mb_default_cross_compile [ -z "$mb_shell" ] && mb_shell=$mb_default_shell @@ -177,6 +179,11 @@ common_defaults() mb_native_cc=$mb_compiler fi fi + + # toolchain + if [ x"$mb_toolchain" = x ]; then + mb_toolchain='binutils' + fi } @@ -280,6 +287,7 @@ config_copy() -e 's^@target@^'"$mb_target"'^g' \ -e 's^@arch@^'"$mb_arch"'^g' \ -e 's^@compiler@^'"$mb_compiler"'^g' \ + -e 's^@toolchain@^'"$mb_toolchain"'^g' \ -e 's^@sysroot@^'"$mb_sysroot"'^g' \ -e 's^@cross_compile@^'"$mb_cross_compile"'^g' \ -e 's^@shell@^'"$mb_shell"'^g' \ @@ -400,6 +408,9 @@ for arg ; do --compiler=*) mb_compiler=${arg#*=} ;; + --toolchain=*) + mb_toolchain=${arg#*=} + ;; --sysroot=*) mb_sysroot=${arg#*=} ;; diff --git a/sysinfo/compiler/clang.mk b/sysinfo/compiler/clang.mk index a372dc4..ba9ecfc 100644 --- a/sysinfo/compiler/clang.mk +++ b/sysinfo/compiler/clang.mk @@ -26,23 +26,4 @@ else endif -AS = $(CROSS_COMPILE)as -AR = $(CROSS_COMPILE)ar -LD = $(CROSS_COMPILE)ld -NM = $(CROSS_COMPILE)nm -OBJDUMP = $(CROSS_COMPILE)objdump -RANLIB = $(CROSS_COMPILE)ranlib -SIZE = $(CROSS_COMPILE)size -STRIP = $(CROSS_COMPILE)strip -STRINGS = $(CROSS_COMPILE)strings - - -ADDR2LINE = $(CROSS_COMPILE)addr2line -COV = $(CROSS_COMPILE)gcov -CXXFILT = $(CROSS_COMPILE)c++filt -ELFEDIT = $(CROSS_COMPILE)elfedit -OBJCOPY = $(CROSS_COMPILE)objcopy -READELF = $(CROSS_COMPILE)readelf - - CFLAGS_PIC = -fPIC diff --git a/sysinfo/compiler/cparser.mk b/sysinfo/compiler/cparser.mk index eea15c3..a57cdcc 100644 --- a/sysinfo/compiler/cparser.mk +++ b/sysinfo/compiler/cparser.mk @@ -26,23 +26,4 @@ else endif -AS = $(CROSS_COMPILE)as -AR = $(CROSS_COMPILE)ar -LD = $(CROSS_COMPILE)ld -NM = $(CROSS_COMPILE)nm -OBJDUMP = $(CROSS_COMPILE)objdump -RANLIB = $(CROSS_COMPILE)ranlib -SIZE = $(CROSS_COMPILE)size -STRIP = $(CROSS_COMPILE)strip -STRINGS = $(CROSS_COMPILE)strings - - -ADDR2LINE = $(CROSS_COMPILE)addr2line -COV = $(CROSS_COMPILE)gcov -CXXFILT = $(CROSS_COMPILE)c++filt -ELFEDIT = $(CROSS_COMPILE)elfedit -OBJCOPY = $(CROSS_COMPILE)objcopy -READELF = $(CROSS_COMPILE)readelf - - CFLAGS_PIC = -fPIC diff --git a/sysinfo/compiler/gcc.mk b/sysinfo/compiler/gcc.mk index 1705859..d14d8dc 100644 --- a/sysinfo/compiler/gcc.mk +++ b/sysinfo/compiler/gcc.mk @@ -21,23 +21,4 @@ else endif -AS = $(CROSS_COMPILE)as -AR = $(CROSS_COMPILE)ar -LD = $(CROSS_COMPILE)ld -NM = $(CROSS_COMPILE)nm -OBJDUMP = $(CROSS_COMPILE)objdump -RANLIB = $(CROSS_COMPILE)ranlib -SIZE = $(CROSS_COMPILE)size -STRIP = $(CROSS_COMPILE)strip -STRINGS = $(CROSS_COMPILE)strings - - -ADDR2LINE = $(CROSS_COMPILE)addr2line -COV = $(CROSS_COMPILE)gcov -CXXFILT = $(CROSS_COMPILE)c++filt -ELFEDIT = $(CROSS_COMPILE)elfedit -OBJCOPY = $(CROSS_COMPILE)objcopy -READELF = $(CROSS_COMPILE)readelf - - CFLAGS_PIC = -fPIC diff --git a/sysinfo/toolchain/binutils.mk b/sysinfo/toolchain/binutils.mk new file mode 100644 index 0000000..a29ac0c --- /dev/null +++ b/sysinfo/toolchain/binutils.mk @@ -0,0 +1,17 @@ +AS = $(CROSS_COMPILE)as +AR = $(CROSS_COMPILE)ar +LD = $(CROSS_COMPILE)ld +NM = $(CROSS_COMPILE)nm +OBJDUMP = $(CROSS_COMPILE)objdump +RANLIB = $(CROSS_COMPILE)ranlib +SIZE = $(CROSS_COMPILE)size +STRIP = $(CROSS_COMPILE)strip +STRINGS = $(CROSS_COMPILE)strings + + +ADDR2LINE = $(CROSS_COMPILE)addr2line +COV = $(CROSS_COMPILE)gcov +CXXFILT = $(CROSS_COMPILE)c++filt +ELFEDIT = $(CROSS_COMPILE)elfedit +OBJCOPY = $(CROSS_COMPILE)objcopy +READELF = $(CROSS_COMPILE)readelf diff --git a/sysinfo/toolchain/llvm.mk b/sysinfo/toolchain/llvm.mk new file mode 100644 index 0000000..3c805a8 --- /dev/null +++ b/sysinfo/toolchain/llvm.mk @@ -0,0 +1,17 @@ +AS = llvm-mc -filetype=obj +AR = llvm-ar +LD = lld +NM = llvm-nm +OBJDUMP = llvm-objdump +RANLIB = llvm-ranlib +SIZE = llvm-size +STRIP = $(CROSS_COMPILE)strip +STRINGS = $(CROSS_COMPILE)strings + + +ADDR2LINE = $(CROSS_COMPILE)addr2line +COV = $(CROSS_COMPILE)gcov +CXXFILT = $(CROSS_COMPILE)c++filt +ELFEDIT = $(CROSS_COMPILE)elfedit +OBJCOPY = $(CROSS_COMPILE)objcopy +READELF = $(CROSS_COMPILE)readelf -- cgit v1.2.3