From 651d7b81282d250ffd24b8cd211a5023c170ca64 Mon Sep 17 00:00:00 2001 From: midipix Date: Feb 27 2016 21:18:25 +0000 Subject: build system: --toolchain: initial implementation. --- diff --git a/Makefile.in b/Makefile.in index 38b71f7..6a5adaa 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@ @@ -60,6 +61,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 @@ -170,6 +172,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 cf6cd40..1727dcd 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 0fd9f26..2cfe075 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 @@ -118,6 +119,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 @@ -173,6 +175,11 @@ common_defaults() mb_native_cc=$mb_compiler fi fi + + # toolchain + if [ x"$mb_toolchain" = x ]; then + mb_toolchain='binutils' + fi } @@ -276,6 +283,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' \ @@ -394,6 +402,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