[1877] | 1 | ### Notice:
|
---|
| 2 | ### This Makefile assumes CASA+CASACore enviroment.
|
---|
| 3 | ### For who wants to build ASAP with older CASA without CASACore
|
---|
| 4 | ### environment, replace $(CASAPATH) with $(AIPSPATH).
|
---|
| 5 | EXTDIR := $(shell pwd)
|
---|
| 6 | ATNFDIR := $(EXTDIR)/atnf
|
---|
| 7 |
|
---|
[1898] | 8 | # the casa environment CASAPATH has to be defined
|
---|
[1877] | 9 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
| 10 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
| 11 |
|
---|
[1894] | 12 | CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
|
---|
| 13 | CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
|
---|
| 14 | LDFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=LD_FLAGS eval_vars) && echo $$LD_FLAGS)
|
---|
[1877] | 15 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
[1894] | 16 | CORELIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CORELIB eval_vars) && echo $$CORELIB)
|
---|
| 17 | WCSLIBLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=WCSLIBLIB eval_vars) && echo $$WCSLIBLIB)
|
---|
| 18 | CFITSIOLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOLIBD eval_vars) && echo $$CFITSIOLIBD)
|
---|
| 19 | CFITSIOINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOINCD eval_vars) && echo $$CFITSIOINCD)
|
---|
| 20 | RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
|
---|
| 21 |
|
---|
| 22 | CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
|
---|
[1877] | 23 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
| 24 |
|
---|
[1894] | 25 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
| 26 | #USELIB := lib64
|
---|
| 27 |
|
---|
[1898] | 28 | ifeq ($(shell uname), Darwin)
|
---|
[1877] | 29 | TARGETLIB := libatnf.dylib
|
---|
[1894] | 30 | else
|
---|
| 31 | TARGETLIB := libatnf.so
|
---|
[1877] | 32 | endif
|
---|
| 33 |
|
---|
| 34 | # the compiler
|
---|
| 35 | ifndef CXX
|
---|
| 36 | CXX := g++
|
---|
| 37 | endif
|
---|
| 38 |
|
---|
| 39 | # compiler flags
|
---|
[1894] | 40 | CXXFLAGS += -fPIC
|
---|
[1877] | 41 |
|
---|
| 42 | # cfitsio
|
---|
| 43 | CFITSIOLIB := -lcfitsio
|
---|
| 44 |
|
---|
| 45 | #rpfits
|
---|
| 46 | RPFITSLIB := -lrpfits
|
---|
| 47 |
|
---|
| 48 | # the linker
|
---|
| 49 | LD := $(CXX)
|
---|
| 50 |
|
---|
[1894] | 51 | LDFLAGS += -shared
|
---|
[1898] | 52 | ifeq ($(shell uname), Darwin)
|
---|
[1894] | 53 | LDFLAGS += -headerpad_max_install_names -install_name $(CASAROOT)/$(CASAARCH)/lib/$(TARGETLIB)
|
---|
| 54 | endif
|
---|
[1877] | 55 |
|
---|
[1894] | 56 | INCDIRS := -I$(COREINCD) -I$(CFITSIOINCD) -I$(EXTDIR)
|
---|
[1915] | 57 | LIBS := -L$(CFITSIOLIBD) $(CFITSIOLIB) -L$(RPFITSLIBD) $(RPFITSLIB) -L$(CASALIB) $(CORELIB) -lgfortran
|
---|
[1877] | 58 |
|
---|
| 59 | OBJECTS := $(ATNFDIR)/pks/pks_maths.o \
|
---|
| 60 | $(ATNFDIR)/PKSIO/ASTEDataset.o \
|
---|
| 61 | $(ATNFDIR)/PKSIO/ASTEFXDataset.o \
|
---|
| 62 | $(ATNFDIR)/PKSIO/ASTEFXReader.o \
|
---|
| 63 | $(ATNFDIR)/PKSIO/ASTEReader.o \
|
---|
| 64 | $(ATNFDIR)/PKSIO/FITSreader.o \
|
---|
| 65 | $(ATNFDIR)/PKSIO/GBTFITSreader.o \
|
---|
| 66 | $(ATNFDIR)/PKSIO/MBFITSreader.o \
|
---|
| 67 | $(ATNFDIR)/PKSIO/MBrecord.o \
|
---|
| 68 | $(ATNFDIR)/PKSIO/NRO45FITSReader.o \
|
---|
| 69 | $(ATNFDIR)/PKSIO/NRO45Reader.o \
|
---|
| 70 | $(ATNFDIR)/PKSIO/NRODataset.o \
|
---|
| 71 | $(ATNFDIR)/PKSIO/NROFITSDataset.o \
|
---|
| 72 | $(ATNFDIR)/PKSIO/NROOTFDataset.o \
|
---|
| 73 | $(ATNFDIR)/PKSIO/NROReader.o \
|
---|
| 74 | $(ATNFDIR)/PKSIO/PKSFITSreader.o \
|
---|
| 75 | $(ATNFDIR)/PKSIO/PKSMS2reader.o \
|
---|
| 76 | $(ATNFDIR)/PKSIO/PKSMS2writer.o \
|
---|
| 77 | $(ATNFDIR)/PKSIO/PKSreader.o \
|
---|
| 78 | $(ATNFDIR)/PKSIO/PKSSDwriter.o \
|
---|
| 79 | $(ATNFDIR)/PKSIO/SDFITSreader.o \
|
---|
| 80 | $(ATNFDIR)/PKSIO/SDFITSwriter.o #\
|
---|
[1894] | 81 | # $(ATNFDIR)/PKSIO/PKSmsg.o
|
---|
[1877] | 82 |
|
---|
| 83 | HEADERS := $(ATNFDIR)/pks/pks_maths.h \
|
---|
| 84 | $(ATNFDIR)/PKSIO/ASTEDataset.h \
|
---|
| 85 | $(ATNFDIR)/PKSIO/ASTEFXDataset.h \
|
---|
| 86 | $(ATNFDIR)/PKSIO/ASTEFXReader.h \
|
---|
| 87 | $(ATNFDIR)/PKSIO/ASTEReader.h \
|
---|
| 88 | $(ATNFDIR)/PKSIO/FITSreader.h \
|
---|
| 89 | $(ATNFDIR)/PKSIO/GBTFITSreader.h \
|
---|
| 90 | $(ATNFDIR)/PKSIO/MBFITSreader.h \
|
---|
| 91 | $(ATNFDIR)/PKSIO/MBrecord.h \
|
---|
| 92 | $(ATNFDIR)/PKSIO/NRO45FITSReader.h \
|
---|
| 93 | $(ATNFDIR)/PKSIO/NRO45Reader.h \
|
---|
| 94 | $(ATNFDIR)/PKSIO/NRODataRecord.h \
|
---|
| 95 | $(ATNFDIR)/PKSIO/NRODataset.h \
|
---|
| 96 | $(ATNFDIR)/PKSIO/NROFITSDataset.h \
|
---|
| 97 | $(ATNFDIR)/PKSIO/NROOTFDataset.h \
|
---|
| 98 | $(ATNFDIR)/PKSIO/NROReader.h \
|
---|
| 99 | $(ATNFDIR)/PKSIO/PKSFITSreader.h \
|
---|
| 100 | $(ATNFDIR)/PKSIO/PKSMS2reader.h \
|
---|
| 101 | $(ATNFDIR)/PKSIO/PKSMS2writer.h \
|
---|
| 102 | $(ATNFDIR)/PKSIO/PKSreader.h \
|
---|
| 103 | $(ATNFDIR)/PKSIO/PKSrecord.h \
|
---|
| 104 | $(ATNFDIR)/PKSIO/PKSSDwriter.h \
|
---|
| 105 | $(ATNFDIR)/PKSIO/PKSwriter.h \
|
---|
| 106 | $(ATNFDIR)/PKSIO/SDFITSreader.h \
|
---|
| 107 | $(ATNFDIR)/PKSIO/SDFITSwriter.h \
|
---|
| 108 | $(ATNFDIR)/PKSIO/SrcType.h #\
|
---|
| 109 | # $(ATNFDIR)/PKSIO/PKSmsg.h
|
---|
| 110 |
|
---|
[1951] | 111 | ifeq ($(shell uname), Darwin)
|
---|
| 112 | CASACORELIB = $(CASALIB)/libcasa_casa.dylib \
|
---|
| 113 | $(CASALIB)/libcasa_components.dylib \
|
---|
| 114 | $(CASALIB)/libcasa_coordinates.dylib \
|
---|
| 115 | $(CASALIB)/libcasa_derivedmscal.dylib \
|
---|
| 116 | $(CASALIB)/libcasa_fits.dylib \
|
---|
| 117 | $(CASALIB)/libcasa_images.dylib \
|
---|
| 118 | $(CASALIB)/libcasa_lattices.dylib \
|
---|
| 119 | $(CASALIB)/libcasa_measures.dylib \
|
---|
| 120 | $(CASALIB)/libcasa_mirlib.dylib \
|
---|
| 121 | $(CASALIB)/libcasa_msfits.dylib \
|
---|
| 122 | $(CASALIB)/libcasa_ms.dylib \
|
---|
| 123 | $(CASALIB)/libcasa_scimath_f.dylib \
|
---|
| 124 | $(CASALIB)/libcasa_scimath.dylib \
|
---|
| 125 | $(CASALIB)/libcasa_tables.dylib
|
---|
| 126 | else
|
---|
| 127 | CASACORELIB = $(CASALIB)/libcasa_casa.so \
|
---|
| 128 | $(CASALIB)/libcasa_components.so \
|
---|
| 129 | $(CASALIB)/libcasa_coordinates.so \
|
---|
| 130 | $(CASALIB)/libcasa_derivedmscal.so \
|
---|
| 131 | $(CASALIB)/libcasa_fits.so \
|
---|
| 132 | $(CASALIB)/libcasa_images.so \
|
---|
| 133 | $(CASALIB)/libcasa_lattices.so \
|
---|
| 134 | $(CASALIB)/libcasa_measures.so \
|
---|
| 135 | $(CASALIB)/libcasa_mirlib.so \
|
---|
| 136 | $(CASALIB)/libcasa_msfits.so \
|
---|
| 137 | $(CASALIB)/libcasa_ms.so \
|
---|
| 138 | $(CASALIB)/libcasa_scimath_f.so \
|
---|
| 139 | $(CASALIB)/libcasa_scimath.so \
|
---|
| 140 | $(CASALIB)/libcasa_tables.so
|
---|
| 141 | endif
|
---|
| 142 |
|
---|
[1877] | 143 | .SUFFIXES: .o .cc
|
---|
| 144 | .cc.o:
|
---|
| 145 | -@ echo
|
---|
| 146 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 147 |
|
---|
| 148 | .PHONY : all clean objects realclean install
|
---|
| 149 |
|
---|
[1879] | 150 | all : $(TARGETLIB)
|
---|
[1877] | 151 |
|
---|
| 152 | objects : $(OBJECTS)
|
---|
| 153 |
|
---|
| 154 | $(TARGETLIB) : $(OBJECTS)
|
---|
| 155 | -@ echo
|
---|
| 156 | $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
|
---|
| 157 |
|
---|
[1951] | 158 | $(OBJECTS) : $(HEADERS) $(CASACORELIB)
|
---|
[1877] | 159 |
|
---|
| 160 | install :
|
---|
| 161 | @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
|
---|
| 162 |
|
---|
| 163 | clean :
|
---|
| 164 | -rm -f $(OBJECTS)
|
---|
| 165 |
|
---|
| 166 | cleanso :
|
---|
| 167 | -rm -f $(TARGETLIB)
|
---|
| 168 |
|
---|
| 169 | realclean : clean cleanso
|
---|
| 170 |
|
---|