cc_hh_tools.amk 1022 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. %instance deftypesuffix(hh-src, '%.hh') ;
  2. %instance deftypesuffix(cc-src, '%.cc') ;
  3. ALLOCD = make.allocd;
  4. NEXT = make.next;
  5. %tool allochd (
  6. hhsrc: %in [type = hh-src, persistent];
  7. hsrc: %out [type = C-incl] => match($hhsrc);
  8. prog: %in [type = command] => $ALLOCD;
  9. )
  10. {
  11. exec($prog, stdin => $hhsrc, stdout => $hsrc);
  12. echo({$hsrc ,'created'});
  13. };
  14. %tool alloccd (
  15. ccsrc: %in [type = cc-src, persistent];
  16. csrc: %out [type = C-src] => match($ccsrc);
  17. prog: %in [type = command] => $ALLOCD;
  18. )
  19. {
  20. exec($prog, stdin => $ccsrc, stdout => $csrc);
  21. echo({$csrc ,'created'});
  22. };
  23. # Possibly there's only one type of { cc-src, hh-src } available,
  24. # so introduce a new attribute.
  25. %derive f[cc-or-hh-src] %when get($f, type) == cc-src
  26. %or get($f, type) == hh-src;
  27. %tool mknext (
  28. cchhsrc: %in %list [cc-or-hh-src];
  29. next: %out [type = C-src] => next.c;
  30. prog: %in [type = command] => $NEXT;
  31. )
  32. {
  33. exec($prog, args => $cchhsrc, stdout => $next);
  34. echo({$next ,'created'});
  35. };