summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-02-26 17:09:04 -0500
committermidipix <writeonce@midipix.org>2016-02-27 16:16:52 -0500
commit722b8cc3216fc96671a1ad468a3d8b9e1d5970f1 (patch)
tree5b08ef8b079354bcd69e2a2fba3c99a67a9422f6
parent043390fda836708eed9bd9b07801e25085203e79 (diff)
downloadpemagine-722b8cc3216fc96671a1ad468a3d8b9e1d5970f1.tar.bz2
pemagine-722b8cc3216fc96671a1ad468a3d8b9e1d5970f1.tar.xz
build system: --toolchain: initial implementation.
-rw-r--r--Makefile.in3
-rw-r--r--config.project1
-rw-r--r--config.usage2
-rwxr-xr-xconfigure11
-rw-r--r--sysinfo/compiler/clang.mk19
-rw-r--r--sysinfo/compiler/cparser.mk19
-rw-r--r--sysinfo/compiler/gcc.mk19
-rw-r--r--sysinfo/toolchain/binutils.mk17
-rw-r--r--sysinfo/toolchain/llvm.mk17
9 files changed, 51 insertions, 57 deletions
diff --git a/Makefile.in b/Makefile.in
index c4257c4..9c99c05 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
@@ -169,6 +171,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 b8b62e1..85cc3d4 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