spotfile.m4 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. m4_dnl Copyright (C) 2018 Alister Sanders
  2. m4_dnl
  3. m4_dnl This program is free software: you can redistribute it and/or modify
  4. m4_dnl it under the terms of the GNU General Public License as published by
  5. m4_dnl the Free Software Foundation, either version 3 of the License, or
  6. m4_dnl (at your option) any later version.
  7. m4_dnl
  8. m4_dnl This program is distributed in the hope that it will be useful,
  9. m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. m4_dnl GNU General Public License for more details.
  12. m4_dnl
  13. m4_dnl You should have received a copy of the GNU General Public License
  14. m4_dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. m4_dnl
  16. m4_divert(-1)m4_dnl
  17. # `sp_defn' is defined with a preceeding newline so that macros defined
  18. # with it can be used in single line comments in configurations
  19. m4_define(`sp_def', `m4_define(`$1', `$2')m4_dnl')
  20. sp_def(`sp_defn', `sp_def(`$1', `
  21. $2')m4_dnl')
  22. sp_def(`sp_default', `ifdef(`$1', `', `sp_def(`$1', `$2')')')
  23. sp_default(`SP_DATETIME', m4_esyscmd(echo -n $(date "+%F %T")))
  24. sp_default(`SP_VERSION', `<unknown version>')
  25. sp_default(`SP_BUILDHOST', `<unknown build host>')
  26. sp_default(`SP_TARGETHOST', `<unknown target host>')
  27. sp_defn(sp_blurb, `sp_com Generated with spotfile SP_VERSION on SP_DATETIME
  28. sp_com Build Host : SP_BUILDHOST
  29. sp_com Target Host : SP_TARGETHOST')
  30. sp_defn(sp_use, `sp_com --- begin spotfile content ($1) ---
  31. m4_include($1)sp_com --- end spotfile content ($1)---')
  32. sp_defn(sp_maybe_use, `sp_com --- begin spotfile content ($1) ---
  33. m4_sinclude($1)
  34. sp_com --- end spotfile content ($1)---')
  35. # Use host-specific files
  36. sp_def(`sp_host_use', `sp_use(SP_TARGETHOST/$1)')
  37. sp_def(`sp_host_maybe_use', `sp_maybe_use(SP_TARGETHOST/$1)')
  38. # Set the default single-line comment marker to `#'
  39. sp_def(`sp_set_com', `sp_def(`sp_com', `$1')')
  40. sp_set_com(`#')
  41. # Finally, disable m4 comments so that macros can be expanded within
  42. # configuration comments
  43. m4_changecom(`')
  44. m4_divert(0)m4_dnl