changeset 107:5f01480e8f12

Mac build
author tobaru
date Thu, 21 Nov 2019 17:10:11 +0900
parents 547c20b052dc
children 8162269b5682
files src/CMakeLists.txt src/gearsTools/pmake.pl
diffstat 2 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Thu Nov 21 14:49:52 2019 +0900
+++ b/src/CMakeLists.txt	Thu Nov 21 17:10:11 2019 +0900
@@ -114,7 +114,7 @@
 add_custom_command(
   OUTPUT  "initcode"
   DEPENDS initcode.o
-  COMMAND "arm-none-eabi-objcopy" "-S" "-O" "binary" "--prefix-symbols=\"_binary_build/initcode\"" "${CMAKE_BEFORE_PROJECT_PATH}/kernel.dir/initcode.o" "initcode"
+  COMMAND "${XV6_OBJCOPY}" "-S" "-O" "binary" "--prefix-symbols=\"_binary_build/initcode\"" "${CMAKE_BEFORE_PROJECT_PATH}/kernel.dir/initcode.o" "initcode"
 )
 #file(COPY "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/initcode.o.dir/initcode" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
 
--- a/src/gearsTools/pmake.pl	Thu Nov 21 14:49:52 2019 +0900
+++ b/src/gearsTools/pmake.pl	Thu Nov 21 17:10:11 2019 +0900
@@ -27,21 +27,22 @@
 my $xv6_src_dir = $FindBin::Bin;
 $xv6_src_dir =~  s|(.*)/gearsTools(.*)|$1|;
 
-
+my $objcopy;
 if ($^O =~ /darwin/){
-    $cc      = "$ENV{CBC_LANG_COMPILER}-7.0";
-    $asm     = "$ENV{CBC_LANG_COMPILER}-7.0";
+    $objcopy = "llvm-objcopy";
+    my $arm_library = $ENV{ARM_LIBRARY};
+    $cc      = $ENV{CBC_COMPILER};
+    $asm     = $ENV{CBC_COMPILER};
     $cflags  = qq|-Wall -g --target=armv6-linux-gnueabihf -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -DCBCXV6=1  -g -O0   -nodefaultlibs
              -Wno-macro-redefined -Wno-gnu-designator -Wno-sometimes-uninitialized -Wno-tautological-compare  
              -Wno-nullability-completeness -Wno-expansion-to-defined |;
     $cflags .= ' -B' . $ENV{HOME} .'/workspace/cr/arm_library/usr/lib/gcc/arm-linux-gnueabihf/6.3.0';
     $cflags .= ' --gcc-toolchain=arm-linux-gnueabihf-raspbian';
-             #$ld = '/Users/anatofuz/workspace/compiler/llvm/llvm-project/build/bin/lld';
-             #$ld = '/Users/anatofuz/workspace/compiler/llvm/llvm-project/build/bin/ld.lld';
-    $ld = '/usr/local/linaro/arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ld';
+    # $ld = '/usr/local/linaro/arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ld';
+    $ld = "ld.lld";
 
-    #$libgcc = '/Users/anatofuz/workspace/cr/arm_library/usr/lib/gcc/arm-linux-gnueabihf/6.3.0/libgcc.a';
-    $libgcc = '/usr/local/lib/gcc/arm-none-eabi/7.3.1/libgcc.a';
+    # $libgcc = '/usr/local/lib/gcc/arm-none-eabi/7.3.1/libgcc.a';
+    $libgcc = "$arm_library/usr/lib/gcc/arm-linux-gnueabihf/6.3.0/libgcc.a";
     #chomp($libgcc = `$cc --print-libgcc-file-name`);
     $ldflags = " -L. -T kernel-cmake.ld";
     $kernel_cflags   = '--target=armv6-linux-gnueabihf  -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -g -O0 -iquote ../   -c';
@@ -52,19 +53,20 @@
     $initcode_cflags = '--target=armv6-linux-gnueabihf   -nostdinc  -c';
     $initcode_ld_command = "$ld -L.  -N -e start -Ttext 0 <OBJECTS> -o <TARGET> <LINK_LIBRARIES>";
 
-    my $arm_library = '/Users/anatofuz/workspace/cr/arm_library';
 
     push(@cmake_arg,
       "-DCBC_XV6_SYSROOT=\"$arm_library\"",
       # "-DCMAKE_OSX_SYSROOT=\"$arm_library\"",
-      #"-DCMAKE_AR=\"/Users/anatofuz/workspace/compiler/llvm/llvm-project/build/bin/llvm-ar\"",
       #"-DCMAKE_RANLIB=\"/Users/anatofuz/workspace/compiler/llvm/llvm-project/build/bin/llvm-ar\"",
-      "-DCMAKE_AR=\"/usr/local/linaro/arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ar\"",
-      "-DCMAKE_RANLIB=\"/usr/local/linaro/arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ranlib\"",
+       "-DCMAKE_AR=\"/usr/local/opt/llvm/bin/llvm-ar\"",
+       "-DCMAKE_RANLIB=\"/usr/local/opt/llvm/bin/llvm-ranlib\"",
+      # "-DCMAKE_AR=\"/usr/local/linaro/arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ar\"",
+      # "-DCMAKE_RANLIB=\"/usr/local/linaro/arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ranlib\"",
       # "-DCMAKE_OSX_XV6_INCLUDE_DIR=\"$arm_library/usr/include\"",
     );
 
 } else {
+    $objcopy = "arm-none-eabi-objcopy";
     $cc     = '/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc';
     $asm    = $cc;
     $cflags = qq|-B/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-  
@@ -94,6 +96,7 @@
   "-DINITOCDE_CFLAGS=\"$initcode_cflags\"",
   "-DINITOCDE_LINK_EXECUTABLE=\"$initcode_ld_command\"",
   "-S $xv6_src_dir",
+  "-DXV6_OBJCOPY=\"$objcopy\"",
   $curdir);
 
 unshift(@cmake_arg, $cmake);