### Notice: 
###    This Makefile assumes CASA+CASACore enviroment. 
###    For who wants to build ASAP with older CASA without CASACore 
###    environment, replace $(CASAPATH) with $(AIPSPATH). 

# the casa environment AIPSPATH has to be defined
CASAROOT  := $(word 1, $(CASAPATH))
CASAARCH  := $(word 2, $(CASAPATH))

COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
CASALIB   := $(CASAROOT)/$(CASAARCH)/lib

# the compiler
ifndef CXX
   CXX      := g++
endif

# compiler flags
CXXFLAGS := -fPIC -O3 -g -Wl,-rpath=$(CASALIB)
CXXFLAGS += -ansi -Wno-long-long -Wall

# darwin specific flags
ifeq "$(CASAARCH)" "darwin"
#   CXXFLAGS += -Wno-long-double
endif

INCDIRS   := -I$(COREINCD)
LIBS      := -L$(CASALIB) -lcasa_tables -lcasa_casa

OBJECTS := asap2to3 

.SUFFIXES: .cpp

.cpp:
	$(CXX) $(CXXFLAGS) $(INCDIRS) $(LIBS) -o $@ $<

all : $(OBJECTS)

$(OBJECTS):

clean :
	-rm -f $(OBJECTS)
