libk  Diff

Differences From Artifact [773f649c53]:

To Artifact [dcf2a949b3]:


    58     58   	dos.*) bin_fmt=dosexe;;
    59     59   	none.*) bin_fmt=bin;;
    60     60   	*.32) bin_fmt=elf32;;
    61     61   	*.64) bin_fmt=elf64;;
    62     62   	*) say "cannot determine correct binary format to use for target $target"; exit 1;;
    63     63   esac
    64     64   
    65         -# first, we establish the
    66         -# parameters of the build
    67         -has cc && _cc=cc
    68         -has clang && _cc=clang 
    69         -has gcc && _cc=gcc # prefer gcc
    70         -cc=${cc:-$_cc}
    71         -has m4 && _m4=m4
    72         -m4=${m4:-$_m4}
    73         -has nasm && asm=nasm
    74         -has yasm && asm=yasm # prefer yasm
    75         -export cc
    76         -export m4
           65  +# first, we establish the parameters of the build
           66  +
           67  +# detect C compiler to use
           68  +	has cc && _cc=cc
           69  +	has clang && _cc=clang 
           70  +	has gcc && _cc=gcc # prefer gcc
           71  +	export cc=${cc:-$_cc}
           72  +
           73  +# detect m4 implementation to use. TODO: determine if BSD m4
           74  +# is compatible with our macro sources, otherwise we'll need
           75  +# to fix that or make gm4 a dep if we can't
           76  +	has m4 && _m4=m4
           77  +	export m4=${m4:-$_m4}
           78  +
           79  +# pick the assembler to use. long-term, we need to rewrite
           80  +# the x86* sources to just use gas, since gas is the only
           81  +# OSS assembler that seems to exist for other arches
           82  +	has nasm && asm=nasm
           83  +	has yasm && asm=yasm # prefer yasm
           84  +
    77     85   export gen=${gen:-gen}
    78     86   library=${library:-static} # {static|shared|both}
    79     87   export verbose=${verbose:-quiet} # {no|quiet|loud}
    80     88   
    81     89   doc=${doc:-yes}
    82     90   export doc_html=${doc_html:-yes}
    83     91   export doc_pdf=${doc_pdf:-yes}
................................................................................
    91     99   	        build_shared_library=yes;;
    92    100   
    93    101   	  both) build_static_library=yes
    94    102   	        build_shared_library=yes;;
    95    103   esac
    96    104   
    97    105   check cc "your C compiler of choice"
    98         -check asm "an assembler that takes Intel syntax and nasm-style-macros"
    99         -check m4 "the path to your m4 installation"
          106  +check asm "an assembler that takes Intel syntax and nasm-style macros"
          107  +check m4 "the path to your m4 binary"
   100    108   
   101    109   export build=$(global/build-id.sh)
   102    110   
   103    111   if test "$p_headers_errno" = ""; then
   104    112   	case $os in
   105    113   		lin) p_headers_errno="${p_headers_errno:-/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h}";;
   106    114   
................................................................................
   272    280   	for obj in ${fn_objects[@]} ${rt_objects[@]} ${data_objects[@]}; do
   273    281   		report ar rc $to/libk.a $obj
   274    282   	done
   275    283   	report ranlib $to/libk.a
   276    284   fi
   277    285   
   278    286   if test $build_shared_library == yes; then
   279         -	report ld -r ${rt_objects[@]} -o $to/boot.o
          287  +	report ld -r ${rt_objects[@]} -o $to/kboot.o
   280    288   	report ld -shared ${fn_objects[@]} ${data_objects[@]} -o $to/libk.so
   281    289   fi
   282    290   
   283    291   # fifth pass: compile the executable tools
   284    292   # against the libraries created in pass 5
   285    293   
   286    294   for mod in ${modules[@]}; do
   287    295   	for exe in $(scan mod/$mod '*.exe.c'); do
   288    296   		base="$(basename $exe)"
   289    297   		dest="$to/$mod.${base%%.exe.c}"
   290    298   		if test $build_shared_library == yes; then
   291         -			comp_c "$to/boot.o $exe" "$dest" -lk
          299  +			comp_c "$to/kboot.o $exe" "$dest" -lk
   292    300   		else
   293    301   			comp_c "$exe" "$dest" -lk
   294    302   		fi
   295    303   	done
   296    304   done
   297    305   
   298    306   set +x
   299    307   say "all passes finished; build $build complete at $(timestamp)"