# Last edited on 2026-07-23 06:58:20 by stolfi


######################################################################
# Sub-make - caller must define 
#   ${SRC} = the "main.wds" source file,
#   ${SMP} = the sample directory (e.g. "engl/wow") for sample-functions, and
#   ${DIC} = the name of the output file (wordlist in order of decr. freq.)

SMP := SMP.IS.UNDEFINED
SRC := SRC.IS.UNDEFINED
DIC := DIC.IS.UNDEFINED

ifneq "/${SMP}" "/SMP.IS.UNDEFINED"

AWK := ../../${SMP}/sample_fns.gawk
TBL := ../../${SMP}/word_map.tbl

wordlist: ${DIC}

endif 
# End of ${SMP} / ${SRC} / ${DIC} submake
######################################################################

printf "\n"
pgm='/./{ n+=$1; next; } END{ print n; }'
for sec??? in "${secs[@]}" "tot.1" ; do
  printf "  %s" ${sec???} 
  for kind??? in  raw gud bad ; do
    wfrKindFile="dat/${smp???}/${sec???}/${sizeopt}/${kind???}.wfr"
    printf " %s = %7d" \
        "${sizeopt}/${kind???}" \
        `cat ${wfrKindFile} | gawk "${pgm}"` \
      2>&1 \
      | sed -e 's:^:  :g' \
      1>&2
  done
  printf "\n"
done
