CC= gcc
-CXX= g++
CFLAGS= -g -Wall -O2 #-m64 #-arch ppc
-CXXFLAGS= $(CFLAGS)
-DFLAGS= -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE #-D_NO_CURSES
+DFLAGS= -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1
LOBJS= bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \
bam_pileup.o bam_lpileup.o bam_md.o glf.o razf.o faidx.o knetfile.o \
bam_sort.o
bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \
bamtk.o
PROG= samtools
-INCLUDES=
+INCLUDES=
SUBDIRS= . misc
-LIBPATH=
+LIBPATH=
+LIBCURSES= -lcurses # -lXCurses
.SUFFIXES:.c .o
libbam.a:$(LOBJS)
$(AR) -cru $@ $(LOBJS)
-### For the curses library: comment out `-lcurses' if you do not have curses installed
samtools:lib $(AOBJS)
- $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LIBPATH) -lm -lcurses -lz -L. -lbam
+ $(CC) $(CFLAGS) -o $@ $(AOBJS) -lm $(LIBPATH) $(LIBCURSES) -lz -L. -lbam
razip:razip.o razf.o
$(CC) $(CFLAGS) -o $@ razf.o razip.o -lz
-#ifndef _NO_CURSES
+#undef _HAVE_CURSES
+
+#if _CURSES_LIB == 0
+#elif _CURSES_LIB == 1
#include <curses.h>
-#ifdef NCURSES_VERSION
+#ifndef NCURSES_VERSION
+#warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled"
+#else
+#define _HAVE_CURSES
+#endif
+#elif _CURSES_LIB == 2
+#include <xcurses.h>
+#define _HAVE_CURSES
+#else
+#warning "_CURSES_LIB is not 0, 1 or 2; tview is NOT compiled"
+#endif
+
+#ifdef _HAVE_CURSES
#include <ctype.h>
#include <assert.h>
#include <string.h>
case 'k': ++tv->row_shift; break;
case KEY_BACKSPACE:
case '\177': pos -= tv->mcol; break;
-#ifdef KEY_RESIZE
case KEY_RESIZE: getmaxyx(stdscr, tv->mrow, tv->mcol); break;
-#endif
default: continue;
}
if (pos < 0) pos = 0;
fprintf(stderr, "[bam_tview_main] The ncurses library is unavailable; tview is not compiled.\n");
return 1;
}
-#endif
-#endif // #ifndef _NO_CURSES
+#endif // #ifdef _HAVE_CURSES
#include "bam.h"
#ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.5-7 (r403)"
+#define PACKAGE_VERSION "0.1.5-8 (r404)"
#endif
int bam_taf2baf(int argc, char *argv[]);
fprintf(stderr, " merge merge multiple sorted alignment files\n");
fprintf(stderr, " pileup generate pileup output\n");
fprintf(stderr, " faidx index/extract FASTA\n");
-#ifndef _NO_CURSES
+#if _CURSES_LIB != 0
fprintf(stderr, " tview text alignment viewer\n");
#endif
fprintf(stderr, " index index alignment\n");
else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1);
else if (strcmp(argv[1], "tagview") == 0) return bam_tagview(argc-1, argv+1);
else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1);
-#ifndef _NO_CURSES
+#if _CURSES_LIB != 0
else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1);
#endif
else {