diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 113 |
1 files changed, 62 insertions, 51 deletions
@@ -11,18 +11,18 @@ # Multilib: -m32, -m64 # # host -# +# # The system that is going to run the software once it is built. Once the software # has been built, it will execute on this particular system. -# +# # build -# +# # The system where the build process is being executed. For most uses this # would be the same as the host system, but in case of cross-compilation # the two obviously differ. -# +# # target -# +# # The system against which the software being built will run on. This only exists, or rather # has a meaning, when the software being built may interact specifically with a # system that differs from the one it's being executed on (our host). This is the case @@ -99,14 +99,14 @@ SOURCE_PACKAGES = \ $(SOURCE_DIR)/mpc-$(VERSION_MPC).tar.gz \ $(SOURCE_DIR)/mpfr-$(VERSION_MPFR).tar.bz2 \ $(SOURCE_DIR)/zlib-$(VERSION_ZLIB).tar.gz \ - $(SOURCE_DIR)/bzip2-$(VERSION_BZ2).tar.gz + $(SOURCE_DIR)/bzip2-$(VERSION_BZ2).tar.gz #JOBS = -j4 JOBS = $(SOURCE_DIR)/binutils-$(VERSION_BINUTILS).tar.bz2: _download_prepare wget -c https://ftp.gnu.org/gnu/binutils/binutils-$(VERSION_BINUTILS).tar.bz2 -O \ - $(SOURCE_DIR)/binutils-$(VERSION_BINUTILS).tar.bz2 2>&1 + $(SOURCE_DIR)/binutils-$(VERSION_BINUTILS).tar.bz2 2>&1 $(SOURCE_DIR)/gcc-$(VERSION_GCC).tar.gz: wget -c https://ftp.gnu.org/gnu/gcc/gcc-$(VERSION_GCC)/gcc-$(VERSION_GCC).tar.gz -O \ $(SOURCE_DIR)/gcc-$(VERSION_GCC).tar.gz @@ -148,7 +148,7 @@ ifneq ($(LOCAL_INST_PATH),) mkdir -p $(LOCAL_INST_PATH) mkdir -p $(LOCAL_INST_PATH)/../x86-mingw64 cd $(LOCAL_INST_PATH); \ - tar -zxf $(PWD)/gcc-suite-$(VERSION_SUITE)-gcc-$(VERSION_GCC)-x86-linux64.tgz + tar -zxf $(PWD)/gcc-suite-$(VERSION_SUITE)-gcc-$(VERSION_GCC)-x86-linux64.tgz cd $(LOCAL_INST_PATH); \ tar -zxf $(PWD)/gcc-suite-$(VERSION_SUITE)-xgcc-$(VERSION_GCC)-$(VERSION_MINGW)-x86-linux64.tgz cd $(LOCAL_INST_PATH)/../x86-mingw64; \ @@ -160,10 +160,14 @@ prepare: tar -zxf $(SOURCE_DIR)/gcc-$(VERSION_GCC).tar.gz -C $(UNPACK_DIR)/ # Patches from https://gcc-mcf.lhmouse.com/ ... cd $(UNPACK_DIR)/gcc-$(VERSION_GCC) && \ - patch -p1 < $(PATCHES_DIR)/0002-Relocate-libintl.patch && \ - patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch && \ - patch -p1 < $(PATCHES_DIR)/0006-Windows-New-feature-to-allow-overriding.patch && \ - patch -p1 < $(PATCHES_DIR)/0008-Prettify-linking-no-undefined.patch && \ + patch -p1 < $(PATCHES_DIR)/0002-Relocate-libintl.patch + cd $(UNPACK_DIR)/gcc-$(VERSION_GCC) && \ + patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch + cd $(UNPACK_DIR)/gcc-$(VERSION_GCC) && \ + patch -p1 < $(PATCHES_DIR)/0006-Windows-New-feature-to-allow-overriding.patch + cd $(UNPACK_DIR)/gcc-$(VERSION_GCC) && \ + patch -p1 < $(PATCHES_DIR)/0008-Prettify-linking-no-undefined.patch + cd $(UNPACK_DIR)/gcc-$(VERSION_GCC) && \ patch -p1 < $(PATCHES_DIR)/0010-Fix-using-large-PCH.gcc10.patch tar -zxf $(SOURCE_DIR)/gdb-$(VERSION_GDB).tar.gz -C $(UNPACK_DIR)/ cd $(UNPACK_DIR)/gdb-$(VERSION_GDB) && \ @@ -172,8 +176,8 @@ prepare: cd $(UNPACK_DIR)/binutils-$(VERSION_BINUTILS) && \ patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch tar -jxf $(SOURCE_DIR)/mingw-w64-v$(VERSION_MINGW).tar.bz2 -C $(UNPACK_DIR)/ - #cd $(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/mingw-w64-tools/widl && \ - # patch -p0 < $(PATCHES_DIR)/mingw-tools-widl-realloc.patch + cd $(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/ && \ + patch -p1 < $(PATCHES_DIR)/0025-crt-Undefine-__rdtsc-for-GCC-11.patch tar -jxf $(SOURCE_DIR)/mpfr-$(VERSION_MPFR).tar.bz2 -C $(UNPACK_DIR)/ tar -jxf $(SOURCE_DIR)/isl-$(VERSION_ISL).tar.bz2 -C $(UNPACK_DIR)/ tar -zxf $(SOURCE_DIR)/mpc-$(VERSION_MPC).tar.gz -C $(UNPACK_DIR)/ @@ -272,8 +276,8 @@ lingcc-finish: rm -Rf $(INST_BASE)/gcc/share find $(INST_BASE)/gcc -type f -name "*.py" | xargs rm -f -lingcc-gdb: - rm -Rf $(BUILD_DIR)/lingdb +lingcc-gdb: + rm -Rf $(BUILD_DIR)/lingdb mkdir -p $(BUILD_DIR)/lingdb cd $(BUILD_DIR)/lingdb && \ export PATH=$(INST_BASE)/gcc/bin:$(PATH) && \ @@ -297,7 +301,7 @@ else cd $(INST_BASE) && \ tar -zcf $(PWD)/gcc-suite-$(VERSION_SUITE)-gcc-$(VERSION_GCC)-x86-linux64.tgz ./gcc endif - + ############################################################################## # Linux based MinGW multilib cross compiler @@ -344,9 +348,11 @@ xgcc-build-binutils: --target=$(XGCC_TARGET64) ;\ make $(JOBS) ;\ make $(JOBS) install-strip - cd $(XGCC_INST_DIR)/bin && ln -s x86_64-w64-mingw32-windres windres + cd $(XGCC_INST_DIR)/bin; \ + test -f windres && rm -f windres; \ + ln -s x86_64-w64-mingw32-windres windres -xgcc-mingw-pass1: +xgcc-mingw-pass1: mkdir -p $(BUILD_DIR)/mingw cd $(BUILD_DIR)/mingw ;\ PATH=$(INST_BASE)/gcc/bin:$(PATH) \ @@ -375,7 +381,7 @@ xgcc-pthread-64: --host=$(XGCC_TARGET64) && \ make $(JOBS) clean && \ make $(JOBS) && \ - make $(JOBS) install + make $(JOBS) install mv -f $(XGCC_INST_DIR)/$(XGCC_TARGET64)/bin/libwinpthread-1.dll \ $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib @@ -387,8 +393,8 @@ xgcc-pthread-32: LDLAGS="-m32 -static-libgcc -static-libstdc++" \ CFLAGS="-m32 -O2 -pipe" \ CXXFLAGS="-m32 -O2 -pipe" \ - CC='x86_64-w64-mingw32-gcc -m32' \ - CCAS='x86_64-w64-mingw32-gcc -m32' \ + CC='x86_64-w64-mingw32-gcc -m32 -fno-expensive-optimizations' \ + CCAS='x86_64-w64-mingw32-gcc -m32 -fno-expensive-optimizations' \ DLLTOOL='x86_64-w64-mingw32-dlltool -m i386' \ RC='x86_64-w64-mingw32-windres -F pe-i386' \ $(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/mingw-w64-libraries/winpthreads/configure \ @@ -402,7 +408,7 @@ xgcc-pthread-32: $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib32 -xgcc-gcc-pass1: +xgcc-gcc-pass1: mkdir -p $(BUILD_DIR)/gcc cd $(BUILD_DIR)/gcc && \ PATH=$(INST_BASE)/gcc/bin:$(PATH) \ @@ -439,7 +445,7 @@ xgcc-gcc-pass1: make $(JOBS) all-gcc && \ make $(JOBS) install-gcc -xgcc-mingw-pass2: +xgcc-mingw-pass2: cd $(BUILD_DIR)/mingw && \ LDLAGS="-static-libgcc -static-libstdc++" \ CFLAGS="-O2 -pipe" \ @@ -457,7 +463,7 @@ xgcc-mingw-pass2: make $(JOBS) && \ make $(JOBS) install -xgcc-gcc-pass2: +xgcc-gcc-pass2: export PATH=$(XGCC_INST_DIR)/bin:$(PATH) && \ cd $(BUILD_DIR)/gcc && \ make $(JOBS) && \ @@ -465,7 +471,7 @@ xgcc-gcc-pass2: xgcc-finish: - cd $(XGCC_INST_DIR) && rm -f mingw + cd $(XGCC_INST_DIR) && rm -f mingw for f in `find $(XGCC_INST_DIR) -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary' | cut -d: -f1`; do \ $(XGCC_INST_DIR)/bin/$(XGCC_TARGET64)-strip $$f ;\ done; @@ -489,11 +495,16 @@ xgcc-finish: cat $(XGCC_INST_DIR)/lib/gcc/$(XGCC_TARGET64)/$(VERSION_GCC)/specs \ $(SOURCE_DIR)/gcc.msvcr110.spec > \ $(XGCC_INST_DIR)/lib/gcc/$(XGCC_TARGET64)/$(VERSION_GCC)/msvcr110 - cd $(XGCC_INST_DIR)/x86_64-w64-mingw32/include && \ - ln -s windows.h Windows.h - cd $(XGCC_INST_DIR)/lib64 && ln -s ../lib/gcc/x86_64-w64-mingw32/lib/libgcc_s.a - -xgcc-gdb: + cd $(XGCC_INST_DIR)/x86_64-w64-mingw32/include; \ + if ! [ -f Windows.h ]; then \ + ln -s windows.h Windows.h ;\ + fi; + cd $(XGCC_INST_DIR)/x86_64-w64-mingw32/lib64;\ + if ! [ -f libgcc_s.a ]; then \ + ln -s ../lib/gcc/x86_64-w64-mingw32/lib/libgcc_s.a ;\ + fi; + +xgcc-gdb: rm -rf $(BUILD_DIR)/gdb && mkdir -p $(BUILD_DIR)/gdb cd $(BUILD_DIR)/gdb && \ export PATH=$(XGCC_BINPATH):$(INST_BASE)/gcc/bin:$(PATH) && \ @@ -507,7 +518,7 @@ xgcc-gdb: --build=$(ARCH64) \ --host=$(ARCH64) && \ make $(JOBS) && make $(JOBS) install - + xgcc-reimp: rm -Rf $(BUILD_DIR)/reimp cd $(BUILD_DIR)/ && \ @@ -563,12 +574,12 @@ xgcc-zlib: RANLIB=$(XGCC_BINPATH)/$(XGCC_PREFIX)ranlib \ ./configure \ --prefix=$(XGCC_INST_DIR)/$(XGCC_TARGET64) --static && \ - make clean && make + make clean && make cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \ cp -f libz.a $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib && \ cp -f zlib.h zconf.h $(XGCC_INST_DIR)/$(XGCC_TARGET64)/include chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib/libz.a - chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/include/zlib.h + chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/include/zlib.h chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/include/zconf.h # cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \ @@ -578,7 +589,7 @@ xgcc-zlib: RANLIB=$(XGCC_BINPATH)/$(XGCC_PREFIX)ranlib \ ./configure \ --prefix=$(XGCC_INST_DIR)/$(XGCC_TARGET64) --static && \ - make clean && make + make clean && make cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \ cp -f libz.a $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib32 && \ chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib32/libz.a @@ -595,7 +606,7 @@ xgcc-bzip2: cp -f libbz2.a $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/include/bzlib.h chmod 644 $(XGCC_INST_DIR)/$(XGCC_TARGET64)/lib/libbz2.a - # + # cd $(UNPACK_DIR)/bzip2-$(VERSION_BZ2) && \ export PATH=$(XGCC_BINPATH)/bin:$(PATH) && \ make \ @@ -676,7 +687,7 @@ wingcc-mingw: make $(JOBS) install cd $(WINGCC_INST_DIR) && rm -f mingw && ln -s $(XGCC_TARGET64) mingw -wingcc-pthread: wingcc-pthread-32 wingcc-pthread-64 +wingcc-pthread: wingcc-pthread-32 wingcc-pthread-64 wingcc-pthread-32: rm -Rf $(BUILD_DIR)/winpthreads-32 && mkdir -p $(BUILD_DIR)/winpthreads-32 @@ -685,8 +696,8 @@ wingcc-pthread-32: LDLAGS="-m32 -static-libgcc -static-libstdc++" \ CFLAGS="-m32 -O2 -pipe" \ CXXFLAGS="-m32 -O2 -pipe" \ - CC='x86_64-w64-mingw32-gcc -m32' \ - CCAS='x86_64-w64-mingw32-gcc -m32' \ + CC='x86_64-w64-mingw32-gcc -m32 -fno-expensive-optimizations' \ + CCAS='x86_64-w64-mingw32-gcc -m32 -fno-expensive-optimizations' \ DLLTOOL='x86_64-w64-mingw32-dlltool -m i386' \ RC='x86_64-w64-mingw32-windres -F pe-i386' \ $(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/mingw-w64-libraries/winpthreads/configure \ @@ -759,8 +770,8 @@ wingcc-finish: mv ../tmp/* . ;\ rm -Rf ../tmp ; find $(WINGCC_INST_DIR) -type f -name "*.py" | xargs rm -f - cd $(WINGCC_INST_DIR) && rm -Rf share - cd $(WINGCC_INST_DIR) && rm -f mingw + cd $(WINGCC_INST_DIR) && rm -Rf share + cd $(WINGCC_INST_DIR) && rm -f mingw cd $(WINGCC_INST_DIR) ;\ find . -type f -name "*.exe" | xargs $(XGCC_BINPATH)/$(XGCC_PREFIX)strip; true # @@ -783,7 +794,7 @@ wingcc-finish: cp -f ../../x86_64-w64-mingw32/lib/libgcc_s.a . cd $(WINGCC_INST_DIR)/lib/gcc/$(XGCC_TARGET64)/$(VERSION_GCC)/32 && \ cp -f ../../../x86_64-w64-mingw32/lib32/libgcc_s.a . - + wingcc-reimp: rm -Rf $(BUILD_DIR)/reimp cd $(BUILD_DIR)/ && \ @@ -845,7 +856,7 @@ wingcc-genidl: --prefix=$(WINGCC_INST_DIR) \ --host=$(XGCC_TARGET64) && \ make && \ - make install + make install wingcc-genlib: rm -Rf $(BUILD_DIR)/genlib @@ -857,7 +868,7 @@ wingcc-genlib: --prefix=$(WINGCC_INST_DIR) \ --host=$(XGCC_TARGET64) && \ make && \ - make install + make install wingcc-widl: cd $(UNPACK_DIR)/mingw-w64-v$(VERSION_MINGW)/mingw-w64-tools/widl && \ @@ -871,7 +882,7 @@ wingcc-widl: --prefix=$(WINGCC_INST_DIR) \ --host=$(XGCC_TARGET64) && \ make && \ - make install + make install wingcc-zlib: mkdir -p $(BUILD_DIR) @@ -885,14 +896,14 @@ wingcc-zlib: RANLIB=$(XGCC_BINPATH)/$(XGCC_PREFIX)ranlib \ ./configure \ --prefix=$(WINGCC_INST_DIR)/$(XGCC_TARGET64) --static && \ - make clean && make + make clean && make # cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \ cp -f libz.a $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib && \ cp -f zlib.h zconf.h $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include # chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib/libz.a - chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include/zlib.h + chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include/zlib.h chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include/zconf.h # cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \ @@ -902,7 +913,7 @@ wingcc-zlib: RANLIB=$(XGCC_BINPATH)/$(XGCC_PREFIX)ranlib \ ./configure \ --prefix=$(WINGCC_INST_DIR)/$(XGCC_TARGET64) --static && \ - make clean && make + make clean && make cd $(BUILD_DIR)/zlib-$(VERSION_ZLIB) && \ cp -f libz.a $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib32 && \ chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib32/libz.a @@ -918,7 +929,7 @@ wingcc-bzip2: cp -f libbz2.a $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/include/bzlib.h chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib/libbz2.a - # + # cd $(UNPACK_DIR)/bzip2-$(VERSION_BZ2) && \ export PATH=$(XGCC_BINPATH)/bin:$(PATH) && \ make \ @@ -928,7 +939,7 @@ wingcc-bzip2: cp -f libbz2.a $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib32 chmod 644 $(WINGCC_INST_DIR)/$(XGCC_TARGET64)/lib/libbz2.a -wingcc-gdb: +wingcc-gdb: rm -Rf $(BUILD_DIR)/gdb && mkdir -p $(BUILD_DIR)/gdb cd $(BUILD_DIR)/gdb && \ export PATH=$(XGCC_BINPATH):$(PATH) && \ @@ -978,4 +989,4 @@ fullclean: clean rm -Rf inst.* rm -Rf build.* rm -Rf unpack.* - + |