Skip to content

Instantly share code, notes, and snippets.

@mgorges
Created September 26, 2020 09:47
Show Gist options
  • Save mgorges/35be89a793963e018601f055b29bb562 to your computer and use it in GitHub Desktop.
Save mgorges/35be89a793963e018601f055b29bb562 to your computer and use it in GitHub Desktop.
--- scm.sh 2020-09-26 02:34:36.000000000 -0700
+++ scm.sh 2020-09-26 02:43:59.000000000 -0700
@@ -80,4 +80,5 @@
fi
- #--------
- # compile scheme source files
+
+ #-------
+ # Preparing C files from SCM first
mkdir -p "$SYS_PREFIX/build"
@@ -89,7 +90,6 @@
scm_chsh=`stringhash "$scm_src"`
- scm_ctgt="$SYS_PREFIX/build/${scm_chsh}.c"
- scm_otgt="$SYS_PREFIX/build/${scm_chsh}.o"
+ scm_ctgt="$SYS_PREFIXROOT/build/${scm_chsh}.c"
scm_dirty=no
scm_hdr="$scm_path/"`basename $scm_src .scm`.sch
- if [ ! -f $scm_otgt ] || [ ! -f $scm_ctgt ]; then
+ if [ ! -f $scm_ctgt ]; then
scm_dirty=yes
@@ -99,3 +99,3 @@
if [ "X$scm_topdir" = "Xtextures" ] || [ "X$scm_topdir" = "Xstrings" ] || [ "Xscm_$topdir" = "Xfonts" ]; then
- if [ `isnewer "$scm_src" "$scm_otgt"` = "yes" ]; then
+ if [ `isnewer "$scm_src" "$scm_ctgt"` = "yes" ]; then
scm_dirty=yes
@@ -103,13 +103,13 @@
else
- if [ `newersourceindir "$scm_src" "$scm_otgt"` = "yes" ]; then
+ if [ `newersourceindir "$scm_src" "$scm_ctgt"` = "yes" ]; then
scm_dirty=yes
fi
- # This is actually much too less, should test all included/loaded files too.
- if [ -f $scm_hdr -a `isnewer "$scm_hdr" "$scm_otgt"` = "yes" ]; then
+ # This is actually much too less, should test all included/loaded files too.
+ if [ -f $scm_hdr -a `isnewer "$scm_hdr" "$scm_ctgt"` = "yes" ]; then
scm_dirty=yes
fi
- # ln_repl module special-case: always re-compile to make global macro changes available
- if [ "X$scm_topdir" = "Xln_repl" ]; then
- scm_dirty=yes
- fi
+ # ln_repl module special-case: always re-compile to make global macro changes available
+ if [ "X$scm_topdir" = "Xln_repl" ]; then
+ scm_dirty=yes
+ fi
fi
@@ -120,5 +120,4 @@
rmifexists "$scm_ctgt"
- if [ -f $scm_hdr ]; then scm_hdr="-e '(load \"$scm_hdr\")'"; else scm_hdr=""; fi
- gsc_processing=""
- # if [ $SYS_VERBOSE ]; then gsc_processing="$gsc_processing -expansion"; fi
+ if [ -f $scm_hdr ]; then scm_hdr="-e '(load \"$scm_hdr\")'"; else scm_hdr=""; fi
+ gsc_processing=""
if [ $veval_result != "0" ]; then rmifexists "$scm_ctgt"; fi
@@ -126,8 +125,18 @@
assertfile "$scm_ctgt"
- rmifexists "$scm_otgt"
- veval "$SYS_ENV $SYS_CC $payload_cdefs -c -o $scm_otgt $scm_ctgt -I$SYS_PREFIX/include -I$SYS_PREFIX/include/freetype2 -I$scm_path"
- assertfile "$scm_otgt"
fi
scm_csrcs="$scm_csrcs $scm_ctgt"
- payload_objs="$payload_objs $scm_otgt"
+ done
+ # ------
+ # compile c files if needed
+ for c_src in $scm_csrcs; do
+ dmsg_scm "compiling $c_src .."
+ c_src_base=`basename ${c_src}`
+ c_otgt=`echo "$SYS_PREFIX/build/$c_src_base" | sed 's/c$/o/'`
+ if [ ! -f $c_otgt -o `isnewer "$c_src" "$c_otgt"` = "yes" ]; then
+ echo " $c_src .."
+ rmifexists "$c_otgt"
+ veval "$SYS_ENV $SYS_CC $payload_cdefs -c -o $c_otgt $c_src -I$SYS_PREFIX/include -I$SYS_PREFIX/include/freetype2 -I$scm_path"
+ assertfile "$c_otgt"
+ fi
+ payload_objs="$payload_objs $c_otgt"
done
@@ -135,4 +144,4 @@
# compile scheme linker file
- scm_lctgt=`echo "$scm_ctgt" | sed 's/\.c$/\_\.c/'`
- scm_lotgt=`echo "$scm_lctgt" | sed 's/c$/o/'`
+ scm_lctgt="$SYS_PREFIXROOT/build/${scm_chsh}_.c"
+ scm_lotgt="$SYS_PREFIX/build/${scm_chsh}_.o"
if [ $scm_link_dirty = yes ] || [ ! -f $scm_lotgt ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment