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
	$(CXXCOMPILELIB) -o $@ $<

$(SOPHYAOBJP)xastropack.o: xastropack.cc xastropack.h \
 $(SOPHYAINCP)machdefs.h \
 $(SOPHYAINCP)XAstro/astro.h
	$(CXXCOMPILELIB) -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
	$(CXXCOMPILEPROG) -o $@ $<

#---------------------
tstmollweide: tstmollweide.o $(SOPHYAOBJP)mollweide.o
	$(CXXLINK) -o $@ $^ $(SOPEXTLIBP) -lxastro -lc -lm

tstmollweide.o: tstmollweide.cc
	$(CXXCOMPILEPROG) -o $@ $<
