summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Koenig <jck@techsat.com>2017-05-31 13:37:34 (GMT)
committerJoerg Koenig <jck@techsat.com>2017-05-31 13:37:34 (GMT)
commitbd7d7d5f8541ab146e258054f4bb2f260dc2378f (patch)
tree4fbafb13e33c16edb88dfa763b9028d10b1ef247
parentbf869e3b8f080c98af049f7aca95848853412307 (diff)
downloadgcc-compiler-suite-bd7d7d5f8541ab146e258054f4bb2f260dc2378f.zip
gcc-compiler-suite-bd7d7d5f8541ab146e258054f4bb2f260dc2378f.tar.gz
gcc-compiler-suite-bd7d7d5f8541ab146e258054f4bb2f260dc2378f.tar.bz2
Reworked Makefilerefs/changes/98/1698/1
Change-Id: I857884172219ee6c5e260cdb7ada680e4518a58b
-rwxr-xr-xMakefile262
1 files changed, 151 insertions, 111 deletions
diff --git a/Makefile b/Makefile
index 2ca368c..904fbb8 100755
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,11 @@
# system that differs from the one it's being executed on (our host). This is the case
# for compilers, debuggers, profilers and analyzers and other tools in general.
#
+# Build order:
+#
+# linux hosted nativ compiler -> linux hosted mingw cross compiler -> windows hosted nativ compiler
+#
+#
SUITE = 1.0.0
@@ -70,10 +75,18 @@ INST_BASE_LINUX = $(PWD)/inst.x86-linux64
XGCC_INST_DIR = $(INST_BASE_LINUX)/mingw64
XGCC_PREFIX = $(XGCC_TARGET64)-
XGCC_BINPATH = $(XGCC_INST_DIR)/bin
-XGCC32 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)gcc -m32"
-XGCC64 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)gcc -m64"
-XGPP32 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)g++ -m32"
-XGPP64 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)g++ -m64"
+XGCC32 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)gcc -m32 -static-libgcc"
+XGCC64 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)gcc -m64 -static-libgcc"
+XGPP32 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)g++ -m32 -static-libgcc -static-libstdc++"
+XGPP64 = "$(XGCC_BINPATH)/$(XGCC_PREFIX)g++ -m64 -static-libgcc -static-libstdc++"
+
+GCC_BINPATH = $(INST_BASE)/gcc-$(VERSION_GCC)/bin
+GCC32 = "$(GCC_BINPATH)/gcc -m32 -static-libgcc"
+GXX32 = "$(GCC_BINPATH)/g++ -m32 -static-libgcc -static-libstdc++"
+GCC64 = "$(GCC_BINPATH)/gcc -m32 -static-libgcc"
+GXX64 = "$(GCC_BINPATH)/g++ -m32 -static-libgcc -static-libstdc++"
+GCC = "$(GCC_BINPATH)/gcc -static-libgcc"
+GXX = "$(GCC_BINPATH)/g++ -static-libgcc -static-libstdc++"
WINGCC_ROOTNAME = gcc-$(VERSION_GCC)
@@ -132,9 +145,10 @@ download: $(SOURCE_PACKAGES)
_download_prepare:
mkdir -p $(SOURCE_DIR)
-all: xgcc-all \
- wingcc-all \
+all: \
lingcc-all \
+ xgcc-all \
+ wingcc-all \
fullclean
prepare:
@@ -169,10 +183,114 @@ build-common:
mkdir -p $(BUILD_DIR)
##############################################################################
+# Nativ Multilib Linux Compiler (64 -Bit)
+##############################################################################
+lingcc-all:
+ make ARCH=x86-linux64 clean
+ make ARCH=x86-linux64 prepare
+ #
+ make ARCH=x86-linux64 lingcc-binutils
+ make ARCH=x86-linux64 lingcc-gcc
+ make ARCH=x86-linux64 lingcc-finish
+ make ARCH=x86-linux64 lingcc-gdb
+ make ARCH=x86-linux64 lingcc-pack
+
+lingcc-binutils:
+ mkdir -p $(BUILD_DIR)/binutils
+ cd $(BUILD_DIR)/binutils ;\
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++" \
+ $(UNPACK_DIR)/binutils-$(VERSION_BINUTILS)/configure \
+ --with-pkgversion=$(GCC_PKGVERSION) \
+ --prefix=$(INST_BASE)/gcc-$(VERSION_GCC) \
+ --disable-nls \
+ --enable-deterministic-archives \
+ --with-gcc \
+ --with-gnu-ld \
+ --with-gnu-as \
+ --disable-werror \
+ --enable-targets=$(ARCH64),$(ARCH32) && \
+ make $(JOBS) && make $(JOBS) install
+
+
+lingcc-gcc:
+ mkdir -p $(BUILD_DIR)/gcc
+ cd $(BUILD_DIR)/gcc && \
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++" \
+ $(UNPACK_DIR)/gcc-$(VERSION_GCC)/configure \
+ --with-pkgversion=$(GCC_PKGVERSION) \
+ --prefix=$(INST_BASE)/gcc-$(VERSION_GCC) \
+ --build=$(ARCH64) \
+ --host=$(ARCH64) \
+ --target=$(ARCH64) \
+ --disable-nls \
+ --enable-languages=$(LANGUAGES) \
+ --with-gcc \
+ --with-gnu-ld \
+ --with-gnu-as \
+ --without-x \
+ --enable-shared \
+ --enable-static \
+ --with-tune-64=core2 \
+ --disable-werror \
+ --disable-symvers \
+ --enable-multilib \
+ --enable-64bit \
+ --enable-clocale=gnu \
+ --enable-version-specific-runtime-libs \
+ --enable-fully-dynamic-string && \
+ make $(JOBS) all && \
+ make $(JOBS) install
+
+lingcc-finish:
+ for f in `find $(INST_BASE)/gcc-$(VERSION_GCC) -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary' | cut -d: -f1`; do \
+ strip $$f ;\
+ done;
+ rm -Rf $(INST_BASE)/gcc-$(VERSION_GCC)/share
+ cp -f $(SOURCE_DIR)/mingw.gcc.specs \
+ $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs
+ #
+ sed -i -e 's/__LIB32__/lib\/gcc\/$(ARCH64)\/lib32/g' \
+ $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs
+ sed -i -e 's/__LIB64__/lib\/gcc\/$(ARCH64)\/lib64/g' \
+ $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs
+ #
+ cat $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs \
+ $(SOURCE_DIR)/gcc.msvcr90.spec > \
+ $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/msvcr90
+ cat $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs \
+ $(SOURCE_DIR)/gcc.msvcr100.spec > \
+ $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/msvcr100
+ cat $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs \
+ $(SOURCE_DIR)/gcc.msvcr110.spec > \
+ $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/msvcr110
+ find $(INST_BASE)/gcc-$(VERSION_GCC) -type f -name "*.py" | xargs rm -f
+
+lingcc-gdb:
+ rm -Rf $(BUILD_DIR)/lingdb
+ mkdir -p $(BUILD_DIR)/lingdb
+ cd $(BUILD_DIR)/lingdb && \
+ CFLAGS="-g -O2 -static-libgcc" \
+ CXXFLAGS="-g -O2 -static-libgcc -static-libstdc++ -fpermissive" \
+ $(UNPACK_DIR)/gdb-$(VERSION_GDB)/configure \
+ --prefix=$(INST_BASE)/gcc-$(VERSION_GCC) \
+ --target=$(ARCH64) \
+ --host=$(ARCH64) \
+ --build=$(ARCH64) && \
+ make $(JOBS) && make $(JOBS) install
+
+lingcc-pack:
+ rm -Rf $(INST_BASE)/gcc$(VERSION_GCC)/share
+ cd $(INST_BASE) && \
+ tar -zcf $(PWD)/gcc-suite-$(VERSION_SUITE)-gcc-$(VERSION_GCC)-x86-linux64.tgz ./gcc-$(VERSION_GCC)
+
+
+##############################################################################
# Linux based MinGW multilib cross compiler
##############################################################################
xgcc-all:
- make fullclean
+ make clean
make prepare
#
make build-common
@@ -193,6 +311,8 @@ xgcc-all:
xgcc-build-binutils:
mkdir -p $(BUILD_DIR)/binutils
cd $(BUILD_DIR)/binutils ;\
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++" \
$(UNPACK_DIR)/binutils-$(VERSION_BINUTILS)/configure \
--with-pkgversion=$(GCC_PKGVERSION) \
--prefix=$(XGCC_INST_DIR) \
@@ -212,6 +332,8 @@ xgcc-build-binutils:
xgcc-mingw-pass1:
mkdir -p $(BUILD_DIR)/mingw
cd $(BUILD_DIR)/mingw ;\
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++" \
$(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/mingw-w64-headers/configure \
--prefix=$(XGCC_INST_DIR)/$(XGCC_TARGET64) \
--host=$(XGCC_TARGET64) ;\
@@ -223,6 +345,8 @@ xgcc-mingw-pass1:
xgcc-gcc-pass1:
mkdir -p $(BUILD_DIR)/gcc
cd $(BUILD_DIR)/gcc && \
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++" \
$(UNPACK_DIR)/gcc-$(VERSION_GCC)/configure \
--with-pkgversion=$(GCC_PKGVERSION) \
--prefix=$(XGCC_INST_DIR) \
@@ -253,6 +377,8 @@ xgcc-gcc-pass1:
xgcc-mingw-pass2:
cd $(BUILD_DIR)/mingw && \
export PATH=$(PATH):$(XGCC_INST_DIR)/bin && \
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++" \
$(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/configure \
--prefix=$(XGCC_INST_DIR)/$(XGCC_TARGET64) \
--host=$(XGCC_TARGET64) \
@@ -295,9 +421,11 @@ xgcc-finish:
$(XGCC_INST_DIR)/lib/gcc/$(XGCC_TARGET64)/$(VERSION_GCC)/msvcr110
xgcc-gdb:
- mkdir -p $(BUILD_DIR)/gdb
+ rm -rf $(BUILD_DIR)/gdb && mkdir -p $(BUILD_DIR)/gdb
cd $(BUILD_DIR)/gdb && \
export PATH=$(PATH):$(XGCC_BINPATH) && \
+ CFLAGS="-O2 -pipe -static-libgcc" \
+ CXXFLAGS="-O2 -pipe -static-libgcc -static-libstdc++ -fpermissive" \
$(UNPACK_DIR)/gdb-$(VERSION_GDB)/configure \
--prefix=$(XGCC_INST_DIR) \
--target=$(XGCC_TARGET64) \
@@ -317,18 +445,25 @@ xgcc-genpeimg:
rm -Rf $(BUILD_DIR)/genpeimg
cd $(BUILD_DIR)/ && \
tar -zxf $(SOURCE_DIR)/genpeimg.tar.gz
+ export PATH=$(PATH):$(GCC_BINPATH) && \
+ CC=$(GCC) CXX=$(GXX) \
+ CFLAGS="-O2 -pipe -static-libgcc" \
cd $(BUILD_DIR)/genpeimg && \
+ LDLAGS="-static-libgcc" \
./configure && \
- make
+ make CFLAGS="-static-libgcc"
cp -f $(BUILD_DIR)/genpeimg/genpeimg $(XGCC_INST_DIR)/bin/$(XGCC_TARGET64)-genpeimg
xgcc-gendef:
rm -Rf $(BUILD_DIR)/gendef
cd $(BUILD_DIR)/ && \
tar -zxf $(SOURCE_DIR)/gendef.tar.gz
+ export PATH=$(PATH):$(GCC_BINPATH) && \
+ CC=$(GCC) CXX=$(GXX) \
cd $(BUILD_DIR)/gendef && \
+ LDLAGS="-static-libgcc" \
./configure && \
- make
+ make CFLAGS="-static-libgcc"
cp -f $(BUILD_DIR)/gendef/gendef $(XGCC_INST_DIR)/bin/$(XGCC_TARGET64)-gendef
xgcc-zlib:
@@ -557,6 +692,8 @@ wingcc-zlib:
cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \
export PATH=$(PATH):$(XGCC_BINPATH) && \
CC=$(XGCC64) \
+ AR=$(XGCC_BINPATH)/$(XGCC_PREFIX)ar \
+ RANLIB=$(XGCC_BINPATH)/$(XGCC_PREFIX)ranlib \
./configure \
--prefix=$(WINGCC_INST_DIR)/$(XGCC_TARGET64) --static && \
make clean && make
@@ -569,7 +706,7 @@ wingcc-zlib:
chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include/zlib.h
chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include/zconf.h
#
- cd $(BUILDDIR)/zlib-$(VERSION_ZLIB) && \
+ cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \
export PATH=$(PATH):$(XGCC_BINPATH) && \
CC=$(XGCC32) \
AR=$(XGCC_BINPATH)/$(XGCC_PREFIX)ar \
@@ -606,7 +743,9 @@ wingcc-gdb:
rm -Rf $(BUILD_DIR)/gdb && mkdir -p $(BUILD_DIR)/gdb
cd $(BUILD_DIR)/gdb && \
export PATH=$(PATH):$(XGCC_BINPATH) && \
- CC=$(XGCC64) CXX=$(XGPP64) CXXFLAGS="-g -O2 -fpermissive" \
+ CC=$(XGCC64) CXX=$(XGPP64) \
+ CXXFLAGS="-g -O2 -fpermissive" \
+ CFLAGS="-g -O2" \
$(UNPACK_DIR)/gdb-$(VERSION_GDB)/configure \
--prefix=$(WINGCC_INST_DIR) \
--target=$(XGCC_TARGET64) \
@@ -621,105 +760,6 @@ wingcc-pack:
rm -Rf $(WINGCC_INST_DIR)/share
cd $(INST_BASE) && \
zip -qr $(PWD)/gcc-suite-$(VERSION_SUITE)-gcc-$(VERSION_GCC)-$(VERSION_MINGW)-x86-mingw64.zip ./$(WINGCC_ROOTNAME)
-
-##############################################################################
-# Nativ Multilib Linux Compiler (64 -Bit)
-##############################################################################
-lingcc-all:
- make ARCH=x86-linux64 clean
- make ARCH=x86-linux64 prepare
- #
- make ARCH=x86-linux64 lingcc-binutils
- make ARCH=x86-linux64 lingcc-gcc
- make ARCH=x86-linux64 lingcc-finish
- make ARCH=x86-linux64 lingcc-gdb
- make ARCH=x86-linux64 lingcc-pack
-
-lingcc-binutils:
- mkdir -p $(BUILD_DIR)/binutils
- cd $(BUILD_DIR)/binutils ;\
- $(UNPACK_DIR)/binutils-$(VERSION_BINUTILS)/configure \
- --with-pkgversion=$(GCC_PKGVERSION) \
- --prefix=$(INST_BASE)/gcc-$(VERSION_GCC) \
- --disable-nls \
- --enable-deterministic-archives \
- --with-gcc \
- --with-gnu-ld \
- --with-gnu-as \
- --disable-werror \
- --enable-targets=$(ARCH64),$(ARCH32) && \
- make $(JOBS) && make $(JOBS) install
-
-
-lingcc-gcc:
- mkdir -p $(BUILD_DIR)/gcc
- cd $(BUILD_DIR)/gcc && \
- $(UNPACK_DIR)/gcc-$(VERSION_GCC)/configure \
- --with-pkgversion=$(GCC_PKGVERSION) \
- --prefix=$(INST_BASE)/gcc-$(VERSION_GCC) \
- --build=$(ARCH64) \
- --host=$(ARCH64) \
- --target=$(ARCH64) \
- --disable-nls \
- --enable-languages=$(LANGUAGES) \
- --with-gcc \
- --with-gnu-ld \
- --with-gnu-as \
- --without-x \
- --enable-shared \
- --enable-static \
- --with-tune-64=core2 \
- --disable-werror \
- --disable-symvers \
- --enable-multilib \
- --enable-64bit \
- --enable-clocale=gnu \
- --enable-version-specific-runtime-libs \
- --enable-fully-dynamic-string && \
- make $(JOBS) all && \
- make $(JOBS) install
-
-lingcc-finish:
- for f in `find $(INST_BASE)/gcc-$(VERSION_GCC) -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary' | cut -d: -f1`; do \
- strip $$f ;\
- done;
- rm -Rf $(INST_BASE)/gcc-$(VERSION_GCC)/share
- cp -f $(SOURCE_DIR)/mingw.gcc.specs \
- $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs
- #
- sed -i -e 's/__LIB32__/lib\/gcc\/$(ARCH64)\/lib32/g' \
- $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs
- sed -i -e 's/__LIB64__/lib\/gcc\/$(ARCH64)\/lib64/g' \
- $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs
- #
- cat $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs \
- $(SOURCE_DIR)/gcc.msvcr90.spec > \
- $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/msvcr90
- cat $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs \
- $(SOURCE_DIR)/gcc.msvcr100.spec > \
- $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/msvcr100
- cat $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/specs \
- $(SOURCE_DIR)/gcc.msvcr110.spec > \
- $(INST_BASE)/gcc-$(VERSION_GCC)/lib/gcc/$(ARCH64)/$(VERSION_GCC)/msvcr110
- find $(INST_BASE)/gcc-$(VERSION_GCC) -type f -name "*.py" | xargs rm -f
-
-lingcc-gdb:
- rm -Rf $(BUILD_DIR)/lingdb
- mkdir -p $(BUILD_DIR)/lingdb
- cd $(BUILD_DIR)/lingdb && \
- CXXFLAGS="-g -O2 -fpermissive" \
- $(UNPACK_DIR)/gdb-$(VERSION_GDB)/configure \
- --prefix=$(INST_BASE)/gcc-$(VERSION_GCC) \
- --target=$(ARCH64) \
- --host=$(ARCH64) \
- --build=$(ARCH64) && \
- make $(JOBS) && make $(JOBS) install
-
-lingcc-pack:
- rm -Rf $(INST_BASE)/gcc$(VERSION_GCC)/share
- cd $(INST_BASE) && \
- tar -zcf $(PWD)/gcc-suite-$(VERSION_SUITE)-gcc-$(VERSION_GCC)-x86-linux64.tgz ./gcc-$(VERSION_GCC)
-
# ----------------------------------------------------------------------------