From 9dbab97a1ea53e2de256f3a5223640d61cab9f38 Mon Sep 17 00:00:00 2001 From: nhkeni Date: Sun, 17 Mar 2024 12:17:41 -0400 Subject: [PATCH] depend.awk: Allow sort suppression from the command line. Idea from Pat. --- sys/unix/depend.awk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/unix/depend.awk b/sys/unix/depend.awk index 8f3d1f9aa..afe86a0ad 100644 --- a/sys/unix/depend.awk +++ b/sys/unix/depend.awk @@ -11,7 +11,6 @@ # cd .. ; sh sys/unix/setup.sh [sys/unix/hints/FOO] ) # newer usage: # cd sys/unix ; make -f Makefile.src updatedepend - # # This awk program scans each file in sequence, looking for lines beginning # with `#include "' and recording the name inside the quotes. For .h files, @@ -19,6 +18,10 @@ # corresponding .o file; dependencies in nested header files are propagated # to the .o target. # +# Variables that can be set on the command line: +# -v dontsortdeps=1 do not sort the dependencies +# -v dontsortfules=1 do not sort the rules +# # config.h and hack.h get special handling because of their heavy use; # timestamps for them allow make to avoid rechecking dates on # subsidiary headers for every source file; @@ -34,8 +37,6 @@ # zlib.h ditto # BEGIN { FS = "\"" #for `#include "X"', $2 is X - dosort = 1 - dorulesort = 1 special[++sp_cnt] = "../include/config.h" special[++sp_cnt] = "../include/hack.h" alt_deps["../include/extern.h"] = "" @@ -91,7 +92,7 @@ END { # function output_dep(){ - if(dorulesort){ + if(!dontsortrules){ worklist[++worklistctr] = file } else { output_final2() @@ -100,7 +101,7 @@ function output_dep(){ function output_final( x) { - if(dorulesort){ + if(!dontsortrules){ nhsort(worklist, 1, worklistctr, 1) for(x=1;x<=worklistctr;x++){ file = worklist[x] @@ -173,7 +174,7 @@ function format_dep(target, source, col, n, i, list, prefix, moc) #files duplicate the target as next element but we need to skip that too first = moc ? 3 : 2 source = list[first] - if (dosort){ + if (!dontsortdeps){ nhsort(list, first, n, 0) } for (i = first; i <= n; i++) {