headers.sh 931 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # Compile every exported ObjC header as if it were a file in every language.
  3. # This script is executed by test headers.c's TEST_BUILD command.
  4. TESTINCLUDEDIR=$1; shift
  5. TESTLOCALINCLUDEDIR=$1; shift
  6. COMPILE_C=$1; shift
  7. COMPILE_CXX=$1; shift
  8. COMPILE_M=$1; shift
  9. COMPILE_MM=$1; shift
  10. VERBOSE=$1; shift
  11. # stop after any command error
  12. set -e
  13. # echo commands when verbose
  14. if [ "$VERBOSE" != "0" ]; then
  15. set -x
  16. fi
  17. FILES="$TESTINCLUDEDIR/objc/*.h $TESTLOCALINCLUDEDIR/objc/*.h"
  18. CFLAGS='-fsyntax-only -Wno-unused-function -D_OBJC_PRIVATE_H_'
  19. $COMPILE_C $CFLAGS $FILES
  20. $COMPILE_CXX $CFLAGS $FILES
  21. $COMPILE_M $CFLAGS $FILES
  22. $COMPILE_MM $CFLAGS $FILES
  23. for STDC in '99' '11' ; do
  24. $COMPILE_C $CFLAGS $FILES -std=c$STDC
  25. $COMPILE_M $CFLAGS $FILES -std=c$STDC
  26. done
  27. for STDCXX in '98' '03' '11' '14' '17' ; do
  28. $COMPILE_CXX $CFLAGS $FILES -std=c++$STDCXX
  29. $COMPILE_MM $CFLAGS $FILES -std=c++$STDCXX
  30. done
  31. echo done