X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=mk-2nd.awk;h=1f637635228afae72e50896b6b1b9b26fa3be900;hp=9240b4707a1b1dd15133f2d5d5ff024dc8745801;hb=4d01f5de859abce88a97e91460db7f3769eedbc1;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/mk-2nd.awk b/mk-2nd.awk index 9240b470..1f637635 100644 --- a/mk-2nd.awk +++ b/mk-2nd.awk @@ -1,6 +1,6 @@ -# $Id: mk-2nd.awk,v 1.10 1998/02/11 12:13:53 tom Exp $ +# $Id: mk-2nd.awk,v 1.19 2005/01/22 16:30:04 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 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"), # @@ -27,7 +27,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey 1996,1997 +# Author: Thomas E. Dickey # # Generate compile-rules for the modules that we are using in libraries or # programs. We are listing them explicitly because we have turned off the @@ -36,10 +36,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 @@ -61,13 +65,27 @@ BEGIN { 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 } } } - !/^[@#]/ { + /^[@#]/ { + next + } + $1 ~ /trace/ { + if (traces != "all" && traces != MODEL && $1 != "lib_trace") + next + } + { if ($0 != "" \ && using != 0) { found = 1 @@ -76,11 +94,13 @@ 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 + 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 print "" if ( echo == "yes" ) @@ -89,10 +109,31 @@ BEGIN { atsign="@" printf "\t@echo 'compiling %s (%s)'\n", $1, model } - if ( $3 == "." || srcdir == "." ) - printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s", atsign, model, compile, MODEL, name, $1, suffix - else - printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix + 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 "../%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