do 781 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh -e
  2. mkdir include
  3. (
  4. echo x86
  5. echo unknown
  6. ) | (
  7. while read n
  8. do
  9. okabi | (
  10. while read abi
  11. do
  12. okc-$abi | (
  13. while read c
  14. do
  15. echo "=== `date` === Trying $n.c with $c..." >&2
  16. rm -f cpuid.c
  17. cp $n.c cpuid.c || continue
  18. $c -o cpuid cpuid.c || continue
  19. $c -o cbytes cbytes.c || continue
  20. ./cpuid > cpuid.out || continue
  21. echo 'static const char cpuid[] = {' > cpuid.h || continue
  22. ./cbytes < cpuid.out >> cpuid.h || continue
  23. echo '} ;' >> cpuid.h || continue
  24. cp cpuid.h include/cpuid.h || continue
  25. cat cpuid.out
  26. exit 0
  27. done
  28. exit 111
  29. ) && exit 0
  30. done
  31. exit 111
  32. ) && exit 0
  33. done
  34. exit 111
  35. )