X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=mk-2nd.awk;h=3fe7ed3d22a0d55f9da8577e8b2f836bf03e981e;hp=629b1697a2e88dbf84147f8d2f8f606b856dd18f;hb=7884aa084f9440fd964f14fe31853a5f85db5104;hpb=a8987e73ec254703634802b4f7ee30d3a485524d;ds=sidebyside diff --git a/mk-2nd.awk b/mk-2nd.awk index 629b1697..3fe7ed3d 100644 --- a/mk-2nd.awk +++ b/mk-2nd.awk @@ -1,6 +1,7 @@ -# $Id: mk-2nd.awk,v 1.15 2003/11/01 22:42:50 tom Exp $ +# $Id: mk-2nd.awk,v 1.22 2020/08/31 23:49:17 tom Exp $ ############################################################################## -# Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. # +# Copyright 2020 Thomas E. Dickey # +# Copyright 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -36,10 +37,14 @@ # development. # # Variables: -# model +# model directory into which objects are compiled. # MODEL (uppercase version of "model"; toupper is not portable) # echo (yes iff we will show the $(CC) lines) # subset ("none", "base", "base+ext_funcs" or "termlib") +# crenames ("yes" or "no", flag to control whether -c & -o options are used) +# cxxrenames ("yes" or "no", flag to control whether -c & -o options are used) +# traces ("all" or "DEBUG", to control whether tracing is compiled in) +# srcdir is expanded when "configure --srcdir" was used # # Fields in src/modules: # $1 = module name @@ -48,6 +53,13 @@ # # Fields in src/modules past $3 are dependencies # +function in_subset(value) { + value = " " value " "; + check = subset; + gsub("[+]", " ", check); + check = " " check " "; + return index(check,value); + } BEGIN { found = 0 using = 0 @@ -56,12 +68,19 @@ BEGIN { using = 0 if (subset == "none") { using = 1 - } else if (index(subset,$2) > 0) { + } else if (in_subset($2) > 0) { if (using == 0) { if (found == 0) { print "" print "# generated by mk-2nd.awk" - print "" + printf "# model: %s\n", model + printf "# MODEL: %s\n", MODEL + printf "# echo: %s\n", echo + printf "# subset: %s\n", subset + printf "# crenames: %s\n", crenames + printf "# cxxrenames: %s\n", cxxrenames + printf "# traces: %s\n", traces + printf "# srcdir: %s\n", srcdir } using = 1 } @@ -83,9 +102,11 @@ BEGIN { if ( $2 == "c++" ) { compile="CXX" suffix=".cc" + use_c_o=cxxrenames } else { compile="CC" suffix=".c" + use_c_o=crenames } printf "../%s/%s$o :\t%s/%s%s", model, $1, $3, $1, suffix for (n = 4; n <= NF; n++) printf " \\\n\t\t\t%s", $n @@ -96,13 +117,31 @@ BEGIN { atsign="@" printf "\t@echo 'compiling %s (%s)'\n", $1, model } + printf "\t%s", atsign; + if ( use_c_o != "yes" ) { + printf "cd ../%s; ", model; + } + # The choice here is between + # base+ext_funcs and + # termlib+ext_tinfo + # but they may appear in the same value. + if ( subset ~ /base/ ) { + mycflags="" + } else if ( subset ~ /termlib/ ) { + mycflags=" -DUSE_TERMLIB" + } + printf "$(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s)%s -c ", compile, MODEL, mycflags if ( $3 == "." || srcdir == "." ) { dir = $3 "/" sub("^\\$\\(srcdir\\)/","",dir); sub("^\\./","",dir); - printf "\t%scd ../%s; $(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s) -c ../%s/%s%s%s", atsign, model, compile, MODEL, name, dir, $1, suffix - } else - printf "\t%scd ../%s; $(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix + printf "../%s/%s%s%s", name, dir, $1, suffix + } else { + printf "%s/%s%s", $3, $1, suffix + } + if ( use_c_o == "yes" ) { + printf " -o ../%s/%s$o", model, $1 + } } else { printf "%s", $1 for (n = 2; n <= NF; n++) printf " %s", $n