Index: branches/ipp-magic-v0/Ohana/src/gcompare/Makefile
===================================================================
--- branches/elixir/Ohana/src/gcompare/Makefile	(revision 2420)
+++ branches/ipp-magic-v0/Ohana/src/gcompare/Makefile	(revision 21062)
@@ -1,68 +1,29 @@
-include ../../Configure
+default: gcompare
+help:
+	@echo "make options: gcompare (default)"
+
+include ../../Makefile.System
 HOME 	=	$(ROOT)/src/gcompare
-default: all
-
 BIN	=	$(HOME)/bin
+LIB	=	$(HOME)/lib
 MAN	=	$(HOME)/doc
 SRC	=	$(HOME)/src
 INC	=	$(HOME)/include
-DESTBIN	=	$(LBIN)
-DESTLIB	=	$(LLIB)
-DESTINC	=	$(LINC)
-DESTMAN	=	$(LMAN)
+include ../../Makefile.Common
 
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
-LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
-CFLAGS	=	$(INCS) 
-CCFLAGS	=	$(INCS) $(LIBS) 
-LFLAGS	=	$(LIBS)
+# programs may add their own internal requirements here
+FULL_CFLAGS   = $(BASE_CFLAGS)
+FULL_CPPFLAGS = $(BASE_CPPFLAGS)
+FULL_LDFLAGS  = -ldvo -lFITS -lohana $(BASE_LDFLAGS)
 
-INSTALL = gcompare
+gcompare: $(BIN)/gcompare.$(ARCH)
+install: $(DESTBIN)/gcompare
 
-OBJ 	= \
+GCOMPARE 	= \
 $(SRC)/input.$(ARCH).o 				$(SRC)/output.$(ARCH).o    		\
 $(SRC)/compare.$(ARCH).o 			$(SRC)/sort.$(ARCH).o      		\
 $(SRC)/count_neighbors.$(ARCH).o                $(SRC)/nextline.$(ARCH).o		\
-$(SRC)/nextword.$(ARCH).o
+$(SRC)/nextword.$(ARCH).o			$(SRC)/gcompare.$(ARCH).o
 
-all: gcompare
-
-# dependancy rules for binary code ##########################
-.PRECIOUS: %.$(ARCH).o
-.PRECIOUS: $(BIN)/%.$(ARCH)
-.PRECIOUS: $(SRC)/%.$(ARCH).o
-
-%.$(ARCH).o : %.c
-	$(CC) $(CFLAGS) -c $^ -o $@
-
-$(BIN)/%.$(ARCH) : $(SRC)/%.$(ARCH).o $(OBJ)
-	$(CC) $^ -o $@ $(LFLAGS)
-
-$(DESTBIN)/%: $(BIN)/%.$(ARCH)
-	mkdir -p $(DESTBIN)
-	rm -f $(DESTBIN)/$*
-	cp $(BIN)/$*.$(ARCH) $(DESTBIN)/$*
-
-%.install:
-	make $(DESTBIN)/$*
-
-$(INSTALL): % : $(BIN)/%.$(ARCH)
-
-# utilities #################################################
-clean:
-	rm -f *~ 
-	rm -f #* 
-	rm -f */*~ 
-	rm -f */#* 
-	rm -f */*.o
-	rm -f $(BIN)/gcompare.$(ARCH)
-
-dist: clean
-	rm -f $(BIN)/gcompare
-
-install:
-	for i in $(INSTALL); do make $$i.install; done
-	mkdir -p $(DESTMAN)
-	rm -f $(DESTMAN)/gcompare.1
-	cp $(MAN)/gcompare.1 $(DESTMAN)/
-
+$(GCOMPARE): $(INC)/gcompare.h
+$(BIN)/gcompare.$(ARCH): $(GCOMPARE)
Index: branches/ipp-magic-v0/Ohana/src/gcompare/bin/.cvsignore
===================================================================
--- branches/ipp-magic-v0/Ohana/src/gcompare/bin/.cvsignore	(revision 21062)
+++ branches/ipp-magic-v0/Ohana/src/gcompare/bin/.cvsignore	(revision 21062)
@@ -0,0 +1,4 @@
+*.linux *.lin64 *.sol *.sun *.sid *.hp *.irix
+*.linrh
+*.darwin
+*.darwin_x86
Index: branches/ipp-magic-v0/Ohana/src/gcompare/include/gcompare.h
===================================================================
--- branches/elixir/Ohana/src/gcompare/include/gcompare.h	(revision 2420)
+++ branches/ipp-magic-v0/Ohana/src/gcompare/include/gcompare.h	(revision 21062)
@@ -28,5 +28,5 @@
 int                get_argument      PROTO((int, char **, char *));
 int                remove_argument   PROTO((int, int *, char **));
-void               sort              PROTO((data_type));
+void               data_sort         PROTO((data_type));
 void               output            PROTO((data_type, data_type, match_type *, int, int, int, int, int));
 char              *nextword          PROTO((char *));
Index: branches/ipp-magic-v0/Ohana/src/gcompare/src/gcompare.c
===================================================================
--- branches/elixir/Ohana/src/gcompare/src/gcompare.c	(revision 2420)
+++ branches/ipp-magic-v0/Ohana/src/gcompare/src/gcompare.c	(revision 21062)
@@ -71,6 +71,6 @@
   fprintf (stderr, "list 2: %d values %d %d\n", data2.Nvalues, X2, Y2);
 
-  sort (data1); fprintf (stderr, "sorted 1\n");
-  sort (data2); fprintf (stderr, "sorted 2\n");
+  data_sort (data1); fprintf (stderr, "sorted 1\n");
+  data_sort (data2); fprintf (stderr, "sorted 2\n");
 
   fprintf (stderr, "noauto: %e\n", noauto);
Index: branches/ipp-magic-v0/Ohana/src/gcompare/src/neighbors.c
===================================================================
--- branches/elixir/Ohana/src/gcompare/src/neighbors.c	(revision 2420)
+++ branches/ipp-magic-v0/Ohana/src/gcompare/src/neighbors.c	(revision 21062)
@@ -46,5 +46,5 @@
   fprintf (stderr, "list 1: %d values %d %d\n", data1.Nvalues, X1, Y1);
 
-  sort (data1); fprintf (stderr, "sorted 1\n");
+  data_sort (data1); fprintf (stderr, "sorted 1\n");
 
   count_neighbors (data1, radius, DX, DY);
Index: branches/ipp-magic-v0/Ohana/src/gcompare/src/sort.c
===================================================================
--- branches/elixir/Ohana/src/gcompare/src/sort.c	(revision 2420)
+++ branches/ipp-magic-v0/Ohana/src/gcompare/src/sort.c	(revision 21062)
@@ -1,40 +1,13 @@
 # include "gcompare.h"
 
-void sort (data)
-data_type data;
-{
-  int l,j,ir,i, N;
-  value_type temp;
+void data_sort (data_type data) {
 
-  N = data.Nvalues;
-  if (N == 1)
-    return;
+# define SWAPFUNC(A,B){ value_type tmp; tmp = data.values[A]; data.values[A] = data.values[B]; data.values[B] = tmp; }
+# define COMPARE(A,B)(data.values[A].X < data.values[B].X)
 
-  l = N >> 1;
-  ir = N - 1;
-  for (;;) {
-    if (l > 0) {
-      temp = data.values[--l];
-    }
-    else {
-      temp = data.values[ir];
-      data.values[ir] = data.values[0];
-      if (--ir == 0) {
-        data.values[0] = temp;
-        return;
-      }
-    }
-    i = l;
-    j = (l << 1) + 1;
-    while (j <= ir) {
-      if (j < ir && data.values[j].X < data.values[j+1].X) ++j;
-      if (temp.X < data.values[j].X) {
-        data.values[i]=data.values[j];
-        j += (i=j) + 1;
-      }
-      else j = ir + 1;
-    }
-    data.values[i] = temp;
-  }
+  OHANA_SORT (data.Nvalues, COMPARE, SWAPFUNC);
+
+# undef SWAPFUNC
+# undef COMPARE
+
 }
-
