Simplified distributed block storage with strong consistency, like in Ceph
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
956 B

  1. #!/usr/bin/perl
  2. use strict;
  3. my $deps = {};
  4. for my $line (split /\n/, `grep '^#include "' *.cpp *.h`)
  5. {
  6. if ($line =~ /^([^:]+):\#include "([^"]+)"/s)
  7. {
  8. $deps->{$1}->{$2} = 1;
  9. }
  10. }
  11. my $added;
  12. do
  13. {
  14. $added = 0;
  15. for my $file (keys %$deps)
  16. {
  17. for my $dep (keys %{$deps->{$file}})
  18. {
  19. if ($deps->{$dep})
  20. {
  21. for my $subdep (keys %{$deps->{$dep}})
  22. {
  23. if (!$deps->{$file}->{$subdep})
  24. {
  25. $added = 1;
  26. $deps->{$file}->{$subdep} = 1;
  27. }
  28. }
  29. }
  30. }
  31. }
  32. } while ($added);
  33. for my $file (sort keys %$deps)
  34. {
  35. if ($file =~ /\.cpp$/)
  36. {
  37. my $obj = $file;
  38. $obj =~ s/\.cpp$/.o/s;
  39. print "$obj: $file ".join(" ", sort keys %{$deps->{$file}})."\n";
  40. print "\tg++ \$(CXXFLAGS) -c -o \$\@ \$\<\n";
  41. }
  42. }