Added gcc compiler magic to get libgomp to build for akaros
[akaros.git] / tools / compilers / gcc-glibc / Makefile
index a9f05aa..98d3d79 100644 (file)
@@ -90,6 +90,7 @@ make-all:
        $(MAKE) .$(BINARY_PREFIX)gcc-stage1-install
        $(MAKE) .$(BINARY_PREFIX)glibc-make
        $(MAKE) .$(BINARY_PREFIX)glibc-install
+       $(MAKE) .$(BINARY_PREFIX)ros-install-libs
        $(MAKE) .$(BINARY_PREFIX)gcc-stage2-make
        $(MAKE) .$(BINARY_PREFIX)gcc-stage2-install
        mkdir -p $(ROSDIR)/fs/$(ARCH)/lib
@@ -142,13 +143,21 @@ binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
 gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
        rm -rf gcc-$(GCC_VERSION)
        tar -jxf gcc-$(GCC_VERSION).tar.bz2
-       patch -p0 < gcc-$(GCC_VERSION)-ros.patch
+       $(MAKE) .gcc-ros-patch
        patch --no-backup-if-mismatch -p0 < gcc-$(GCC_VERSION)-riscv.patch
 
+.gcc-ros-patch:
+       -cd gcc-$(GCC_VERSION); \
+       diff -ruB --unidirectional-new-file \
+            ../gcc-$(GCC_VERSION) \
+            ../gcc-$(GCC_VERSION)-ros \
+            | grep -v "Only in ../gcc-$(GCC_VERSION)" \
+            | patch -p2 
+
 glibc-$(GLIBC_VERSION): glibc-$(GLIBC_VERSION).tar.bz2
        rm -rf glibc-$(GLIBC_VERSION)
        tar -jxf glibc-$(GLIBC_VERSION).tar.bz2
-       $(MAKE) .glibc-patch
+       $(MAKE) .glibc-ros-patch
        patch --no-backup-if-mismatch -p0 < glibc-$(GLIBC_VERSION)-riscv.patch
        rm glibc-$(GLIBC_VERSION)/sysdeps/sparc/sparc32/elf/start.S
        rm glibc-$(GLIBC_VERSION)/sysdeps/riscv/elf/start.S
@@ -158,7 +167,7 @@ glibc-$(GLIBC_VERSION): glibc-$(GLIBC_VERSION).tar.bz2
        rm glibc-$(GLIBC_VERSION)/sysdeps/i386/init-first.c
        rm glibc-$(GLIBC_VERSION)/sysdeps/i386/sysdep.h
 
-.glibc-patch:
+.glibc-ros-patch:
        -cd glibc-$(GLIBC_VERSION); \
        diff -ruB --unidirectional-new-file \
             ../glibc-$(GLIBC_VERSION) \
@@ -281,20 +290,27 @@ $(BINARY_PREFIX)gcc-stage2-builddir: gcc-$(GCC_VERSION)
        cd $(BINARY_PREFIX)glibc-builddir; \
        make -j $(MAKE_JOBS) install
 
+.$(BINARY_PREFIX)ros-install-libs:
+       cd $(ROSDIR); \
+       make TARGET_ARCH=$(ARCH) -j $(MAKE_JOBS) install-libs
+
 .$(BINARY_PREFIX)gcc-stage2-configure:
        $(MAKE) $(BINARY_PREFIX)gcc-stage2-builddir
        cd $(BINARY_PREFIX)gcc-stage2-builddir; \
        ../gcc-$(GCC_VERSION)/configure \
                  --enable-shared \
                  --enable-tls \
+                 --enable-libgomp \
                  --disable-multilib \
                  --disable-nls \
                  --program-prefix=$(BINARY_PREFIX) \
                  --target=$(ARCH)-ros \
                  --prefix=$(INSTDIR) \
-                 --enable-languages=c,c++ \
+                 --enable-languages=c,c++,go \
                  $(GCC_BUILD_FLAGS) \
+                 --without-libffi \
                  --with-__thread \
+                 --with-parlib \
                  --with-headers=$(INSTDIR)/$(ARCH)-ros/include \
                  --disable-werror;
        touch $@
@@ -307,7 +323,7 @@ $(BINARY_PREFIX)gcc-stage2-builddir: gcc-$(GCC_VERSION)
        cd $(BINARY_PREFIX)gcc-stage2-builddir; \
        make -j $(MAKE_JOBS) install
 
-patches:
+patches: gcc-$(GCC_VERSION) binutils-$(BINUTILS_VERSION)
        rm -rf orig-src
        mkdir orig-src