diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 1c95bb8..14e42a4 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ all: quicktree quicktree : $(QUICKTREEOBJ) $(CC) $(LFLAGS) -o $@ $(QUICKTREEOBJ) -lm -$(OBJ)/quicktree.o : $(SRC)/quicktree.c +$(OBJ)/quicktree.o : $(SRC)/quicktree.c $(INC)/version.h $(CC) $(CFLAGS) -o $(OBJ)/quicktree.o $(SRC)/quicktree.c $(OBJ)/align.o : $(SRC)/align.c $(INC)/align.h diff --git a/include/version.h b/include/version.h new file mode 100644 index 0000000..accc0de --- /dev/null +++ b/include/version.h @@ -0,0 +1,27 @@ +/********************************************************************** + * File: version.h + * Author: Torsten Seemann + *------------------------------------------------------------------- + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------- + * NOTES: + * This file contains general utiliy functions used throughout the + * application, such as those for memory management and error + * messaging. I have used it as a place to put other general stuff + * until I have somewhere better to put it. + **********************************************************************/ +#ifndef _VERSION +#define _VERSION + +#define VERSION_MAJOR 2 +#define VERSION_MINOR 0 + +#endif diff --git a/src/quicktree.c b/src/quicktree.c index fa04f9d..ecd5437 100644 --- a/src/quicktree.c +++ b/src/quicktree.c @@ -27,7 +27,7 @@ #include "buildtree.h" #include "distancemat.h" #include "tree.h" - +#include "version.h" /********************* command-line options * ************************/ @@ -44,7 +44,8 @@ Advanced options :\n\ -kimura : Use the kimura translation for pairwise distances\n\ (ignored for distance matrix inputs)\n\ -boot : Calcuate bootstrap values with n iterations\n\ - (ignored for distance matrix outputs)\n\n\ + (ignored for distance matrix outputs)\n\ +-v : print version and exit\n\n\ *Use sreformat, part of the HMMer package to convert your alignment to Stockholm format\n"; static struct Option options[] = { @@ -53,7 +54,8 @@ static struct Option options[] = { { "-upgma", NO_ARGS }, { "-kimura", NO_ARGS }, { "-boot", INT_ARG }, - { "-h", NO_ARGS } + { "-h", NO_ARGS }, + { "-v", NO_ARGS }, }; static unsigned int use_kimura = 0; @@ -191,6 +193,10 @@ int main (int argc, char *argv[]) { fprintf( stderr, "%s", usage ); exit(0); } + else if (strcmp(optname, "-v") == 0) { + printf( "quicktree %d.%d\n", VERSION_MAJOR, VERSION_MINOR ); + exit(0); + } } if (argc - optindex != 1) { diff --git a/src/util.c b/src/util.c old mode 100755 new mode 100644