Index: trunk/SophyaExt/XAstroPack/Makefile
===================================================================
--- trunk/SophyaExt/XAstroPack/Makefile	(revision 2742)
+++ trunk/SophyaExt/XAstroPack/Makefile	(revision 2743)
@@ -1,17 +1,40 @@
-include ../Mgr/Makefile.h
+include ../BuildMgr/sophyamake.inc
+
+all: $(SOPHYALIBP)libXAstroPack.a
+
+clean: cleantest
+	rm -f $(SOPHYAOBJP)mollweide.o $(SOPHYAOBJP)tstxastro.o \
+              $(SOPHYAOBJP)xastropack.o $(SOPHYAOBJP)magfield.o
+	rm -f $(SOPHYALIBP)libXAstroPack.a
+
+cleantest:
+	rm -f *.o tstxastro tstmollweide mollw.data mollw2.data
+
+$(SOPHYALIBP)libXAstroPack.a : $(SOPHYAOBJP)magfield.o \
+             $(SOPHYAOBJP)mollweide.o $(SOPHYAOBJP)xastropack.o
+	$(AR) $(ARFLAGS) $@ $?
  
-all: $(LIB)libXAstroPack.a
-clean:
-	rm -f $(OBJ)mollweide.o $(OBJ)tstxastro.o $(OBJ)xastropack.o $(OBJ)magfield.o
-	rm -f $(LIB)libXAstroPack.a
-$(LIB)libXAstroPack.a : $(OBJ)magfield.o $(OBJ)mollweide.o $(OBJ)xastropack.o
-	$(ARCXX) $(ARCXXFLAGS) $@ $($(ARARGS))
-ifeq ($(CXX),cxx)
-	$(CXX) $? $(CPPFLAGS) $(CXXFLAGS) -o $(OBJ)xx.x -Hf
-endif 
- 
-$(OBJ)mollweide.o: mollweide.cc mollweide.h
-$(OBJ)xastropack.o: xastropack.cc xastropack.h \
- $(INC)machdefs.h \
- $(EXTINCPATH)XAstro/astro.h
-$(OBJ)magfield.o: magfield.c magfield.h
+$(SOPHYAOBJP)mollweide.o: mollweide.cc mollweide.h
+	$(CXXCOMPILE) -o $@ $<
+
+$(SOPHYAOBJP)xastropack.o: xastropack.cc xastropack.h \
+ $(SOPHYAINCP)machdefs.h \
+ $(SOPHYAINCP)XAstro/astro.h
+	$(CXXCOMPILE) -o $@ $<
+
+$(SOPHYAOBJP)magfield.o: magfield.c magfield.h
+	$(CCOMPILE) -o $@ $<
+
+#---------------------
+tstxastro: tstxastro.o $(SOPHYAOBJP)xastropack.o
+	$(CXXLINK) $^ -o $@ $(SOPEXTLIBP) -lxastro -lc -lm
+
+tstxastro.o: tstxastro.cc
+	$(CXXCOMPILE) -o $@ $<
+
+#---------------------
+tstmollweide: tstmollweide.o $(SOPHYAOBJP)mollweide.o
+	$(CXXLINK) -o $@ $^ $(SOPEXTLIBP) -lxastro -lc -lm
+
+tstmollweide.o: tstmollweide.cc
+	$(CXXCOMPILE) -o $@ $<
Index: trunk/SophyaExt/XAstroPack/smakefile
===================================================================
--- trunk/SophyaExt/XAstroPack/smakefile	(revision 2743)
+++ trunk/SophyaExt/XAstroPack/smakefile	(revision 2743)
@@ -0,0 +1,40 @@
+include $(SOPHYABASE)/include/sophyamake.inc
+
+all: $(SOPHYALIBP)libXAstroPack.a
+
+clean: cleantest
+	rm -f $(SOPHYAOBJP)mollweide.o $(SOPHYAOBJP)tstxastro.o \
+              $(SOPHYAOBJP)xastropack.o $(SOPHYAOBJP)magfield.o
+	rm -f $(SOPHYALIBP)libXAstroPack.a
+
+cleantest:
+	rm -f *.o tstxastro tstmollweide mollw.data mollw2.data
+
+$(SOPHYALIBP)libXAstroPack.a : $(SOPHYAOBJP)magfield.o \
+             $(SOPHYAOBJP)mollweide.o $(SOPHYAOBJP)xastropack.o
+	$(AR) $(ARFLAGS) $@ $?
+ 
+$(SOPHYAOBJP)mollweide.o: mollweide.cc mollweide.h
+	$(CXXCOMPILE) -o $@ $<
+
+$(SOPHYAOBJP)xastropack.o: xastropack.cc xastropack.h \
+ $(SOPHYAINCP)machdefs.h \
+ $(SOPHYAINCP)XAstro/astro.h
+	$(CXXCOMPILE) -o $@ $<
+
+$(SOPHYAOBJP)magfield.o: magfield.c magfield.h
+	$(CCOMPILE) -o $@ $<
+
+#---------------------
+tstxastro: tstxastro.o $(SOPHYAOBJP)xastropack.o
+	$(CXXLINK) $^ -o $@ $(SOPEXTLIBP) -lxastro -lc -lm
+
+tstxastro.o: tstxastro.cc
+	$(CXXCOMPILE) -o $@ $<
+
+#---------------------
+tstmollweide: tstmollweide.o $(SOPHYAOBJP)mollweide.o
+	$(CXXLINK) -o $@ $^ $(SOPEXTLIBP) -lxastro -lc -lm
+
+tstmollweide.o: tstmollweide.cc
+	$(CXXCOMPILE) -o $@ $<
Index: trunk/SophyaExt/XAstroPack/tstmollweide.cc
===================================================================
--- trunk/SophyaExt/XAstroPack/tstmollweide.cc	(revision 2743)
+++ trunk/SophyaExt/XAstroPack/tstmollweide.cc	(revision 2743)
@@ -0,0 +1,39 @@
+//#define TEST_MOLLWEIDE
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include "sopnamsp.h"
+#include "mollweide.h"
+
+int main()
+{
+ FILE *file  = fopen("mollw.data","w");
+ FILE *file2 = fopen("mollw2.data","w");
+ int i,npoints=250000;
+ double tvrai,lon,lat,x,y,tcalc,a;
+ double longitude,latitude,tll,txy;
+
+ tll=txy=0.;
+ for(i=0;i<=npoints;i++) {
+   //tvrai = 1.57078;
+   tvrai = (double)i*(M_PI_2) /(double)npoints;
+   a = 2.*tvrai+sin(2.*tvrai);
+   lat = asin(a/M_PI);
+   tcalc = MollWeide_XY(0.,lat,&x,&y);
+   if(fabs(tcalc-tvrai)>tll) {tll = fabs(tcalc-tvrai); txy=tvrai;}
+   if(file) fprintf(file,"%e %e %e %e\n",tvrai,tcalc,a,tcalc-tvrai);
+ }
+ printf("Maximum difference: %e for t=%.10e=Pi/2-%.10e\n",tll,txy,M_PI_2-txy);
+ if(file) fclose(file);
+
+ for(lon=0.;lon<360.;lon+=2.5) for(lat=-90.;lat<=90.1;lat+=2.5) {
+   txy = MollWeide_XY(lon*M_PI/180.,lat*M_PI/180.,&x,&y);
+   tll = MollWeide_LL(x,y,&longitude,&latitude);
+   longitude *= 180./M_PI;
+   latitude  *= 180./M_PI;
+   if(file2) fprintf(file2,"%e %e %e %e %e %e %e %e %e %e\n"
+     ,lon,lat,x,y,longitude,latitude,txy,tll,longitude-lon,latitude-lat);
+ }
+ if(file2) fclose(file2);
+ return 0;
+}
