Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "Press Ctrl-C at any time to abort Makefile generation"
  4.  
  5. echo
  6. echo "The project name should start with a letter and contain nothing but "
  7. echo "letters (A-z), digits (0-9) and dashes ('-'). Do not include the "
  8. echo "version number."
  9. echo
  10. echo "Example: hello-world"
  11. echo
  12. echo -n "Project name: "
  13. read NAME
  14.  
  15. echo
  16. echo -n "Version number (example: 1.0.0): "
  17. read VERSION
  18.  
  19. SOURCES=`find -name \*.h -or -name \*.hh -or -name \*.hpp -or -name \*.hxx -or -name \*.cc -or -iname \*.c -or -name \*.cpp -or -name \*.cxx -or -name \*.m -or -name \*.i -or -name \*.ii -or -iname \*.s -type f | sed 's,^\./,,' | tr '\n' ' '`
  20.  
  21. if [ x"$SOURCES" = x ]
  22. then
  23. echo "Error no sources were found (.cc, .c, .C, .cpp, .cxx, .m, .i, .ii, .s, .S)"
  24. exit 1
  25. fi
  26.  
  27. echo
  28. echo "The following sources will be included: "
  29. echo "$SOURCES"
  30.  
  31. echo
  32. echo -n "Press enter to continue..."
  33. read
  34.  
  35. cat > configure.ac <<EOF
  36. AC_INIT($NAME,$VERSION)
  37. AM_INIT_AUTOMAKE([-Wall -Werror foreign])
  38.  
  39. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  40.  
  41. AC_PROG_CC
  42. AC_PROG_CXX
  43. AC_PROG_INSTALL
  44. AC_PROG_MAKE_SET
  45.  
  46. AC_OUTPUT(Makefile)
  47. EOF
  48.  
  49. BNAME=`echo -n "$NAME"_SOURCES | sed 's/[-\.]/_/g'`
  50.  
  51. cat > Makefile.am <<EOF
  52. bin_PROGRAMS = $NAME
  53.  
  54. $BNAME = $SOURCES
  55. EOF
  56.  
  57. autoreconf -i -f || exit 1
  58.  
  59. ./configure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement