2
0

dosubst.awk 851 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Dedicated to the public domain.
  2. # SPDX-License-Identifier: 0BSD
  3. #
  4. # awk script to substitute variables in scripts and applications.
  5. #
  6. # You can pass these variables to it in Makefiles or on the
  7. # commandline:
  8. # bdir="$(bindir)"
  9. # py="$(PYTHON)"
  10. # awkay="$(AWK_BINARY)"
  11. # pfx="$(prefix)"
  12. # prl="$(PERL)"
  13. # sysconfdirectory="$(sysconfdir)"
  14. # pkgdatadirectory="$(pkgdatadir)"
  15. {
  16. if (/@bindirectory@/) {
  17. gsub("@bindirectory@",bdir) ;
  18. }
  19. if (/@PYTHONEXE@/) {
  20. gsub("@PYTHONEXE@",py) ;
  21. }
  22. if (/@AWKEXE@/) {
  23. gsub("@AWKEXE@",awkay) ;
  24. }
  25. if (/@SUBSTPREFIX@/) {
  26. gsub("@SUBSTPREFIX@",pfx) ;
  27. }
  28. if (/@PERLEXE@/) {
  29. gsub("@PERLEXE@",prl) ;
  30. }
  31. if (/@SYSCONFDIR@/) {
  32. gsub("@SYSCONFDIR@",sysconfdirectory) ;
  33. }
  34. if (/@PKGDATADIRECTORY@/) {
  35. gsub("@PKGDATADIRECTORY@",pkgdatadirectory) ;
  36. }
  37. print $0 ;
  38. }