Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Press Ctrl-C at any time to abort Makefile generation"
- echo
- echo "The project name should start with a letter and contain nothing but "
- echo "letters (A-z), digits (0-9) and dashes ('-'). Do not include the "
- echo "version number."
- echo
- echo "Example: hello-world"
- echo
- echo -n "Project name: "
- read NAME
- echo
- echo -n "Version number (example: 1.0.0): "
- read VERSION
- 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' ' '`
- if [ x"$SOURCES" = x ]
- then
- echo "Error no sources were found (.cc, .c, .C, .cpp, .cxx, .m, .i, .ii, .s, .S)"
- exit 1
- fi
- echo
- echo "The following sources will be included: "
- echo "$SOURCES"
- echo
- echo -n "Press enter to continue..."
- read
- cat > configure.ac <<EOF
- AC_INIT($NAME,$VERSION)
- AM_INIT_AUTOMAKE([-Wall -Werror foreign])
- m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
- AC_PROG_CC
- AC_PROG_CXX
- AC_PROG_INSTALL
- AC_PROG_MAKE_SET
- AC_OUTPUT(Makefile)
- EOF
- BNAME=`echo -n "$NAME"_SOURCES | sed 's/[-\.]/_/g'`
- cat > Makefile.am <<EOF
- bin_PROGRAMS = $NAME
- $BNAME = $SOURCES
- EOF
- autoreconf -i -f || exit 1
- ./configure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement