[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 | # casacore library dependencies
|
---|
| 43 | CORELIBS := -lcasa_casa -lcasa_measures -lcasa_scimath -lcasa_ms -lcasa_tables
|
---|
| 44 |
|
---|
| 45 | # cfitsio
|
---|
| 46 | CFITSIOLIB := -lcfitsio
|
---|
| 47 |
|
---|
| 48 | #rpfits
|
---|
| 49 | RPFITSLIB := -lrpfits
|
---|
| 50 |
|
---|
| 51 | # the linker
|
---|
| 52 | LD := $(CXX)
|
---|
| 53 |
|
---|
[1894] | 54 | LDFLAGS += -shared
|
---|
[1898] | 55 | ifeq ($(shell uname), Darwin)
|
---|
[1894] | 56 | LDFLAGS += -headerpad_max_install_names -install_name $(CASAROOT)/$(CASAARCH)/lib/$(TARGETLIB)
|
---|
| 57 | endif
|
---|
[1877] | 58 |
|
---|
[1894] | 59 | INCDIRS := -I$(COREINCD) -I$(CFITSIOINCD) -I$(EXTDIR)
|
---|
| 60 | LIBS := -L$(CFITSIOLIBD) $(CFITSIOLIB) -L$(RPFITSLIBD) $(RPFITSLIB) -L$(CASALIB) $(CORELIBS) -lgfortran
|
---|
[1877] | 61 |
|
---|
| 62 | OBJECTS := $(ATNFDIR)/pks/pks_maths.o \
|
---|
| 63 | $(ATNFDIR)/PKSIO/ASTEDataset.o \
|
---|
| 64 | $(ATNFDIR)/PKSIO/ASTEFXDataset.o \
|
---|
| 65 | $(ATNFDIR)/PKSIO/ASTEFXReader.o \
|
---|
| 66 | $(ATNFDIR)/PKSIO/ASTEReader.o \
|
---|
| 67 | $(ATNFDIR)/PKSIO/FITSreader.o \
|
---|
| 68 | $(ATNFDIR)/PKSIO/GBTFITSreader.o \
|
---|
| 69 | $(ATNFDIR)/PKSIO/MBFITSreader.o \
|
---|
| 70 | $(ATNFDIR)/PKSIO/MBrecord.o \
|
---|
| 71 | $(ATNFDIR)/PKSIO/NRO45FITSReader.o \
|
---|
| 72 | $(ATNFDIR)/PKSIO/NRO45Reader.o \
|
---|
| 73 | $(ATNFDIR)/PKSIO/NRODataset.o \
|
---|
| 74 | $(ATNFDIR)/PKSIO/NROFITSDataset.o \
|
---|
| 75 | $(ATNFDIR)/PKSIO/NROOTFDataset.o \
|
---|
| 76 | $(ATNFDIR)/PKSIO/NROReader.o \
|
---|
| 77 | $(ATNFDIR)/PKSIO/PKSFITSreader.o \
|
---|
| 78 | $(ATNFDIR)/PKSIO/PKSMS2reader.o \
|
---|
| 79 | $(ATNFDIR)/PKSIO/PKSMS2writer.o \
|
---|
| 80 | $(ATNFDIR)/PKSIO/PKSreader.o \
|
---|
| 81 | $(ATNFDIR)/PKSIO/PKSSDwriter.o \
|
---|
| 82 | $(ATNFDIR)/PKSIO/SDFITSreader.o \
|
---|
| 83 | $(ATNFDIR)/PKSIO/SDFITSwriter.o #\
|
---|
[1894] | 84 | # $(ATNFDIR)/PKSIO/PKSmsg.o
|
---|
[1877] | 85 |
|
---|
| 86 | HEADERS := $(ATNFDIR)/pks/pks_maths.h \
|
---|
| 87 | $(ATNFDIR)/PKSIO/ASTEDataset.h \
|
---|
| 88 | $(ATNFDIR)/PKSIO/ASTEFXDataset.h \
|
---|
| 89 | $(ATNFDIR)/PKSIO/ASTEFXReader.h \
|
---|
| 90 | $(ATNFDIR)/PKSIO/ASTEReader.h \
|
---|
| 91 | $(ATNFDIR)/PKSIO/FITSreader.h \
|
---|
| 92 | $(ATNFDIR)/PKSIO/GBTFITSreader.h \
|
---|
| 93 | $(ATNFDIR)/PKSIO/MBFITSreader.h \
|
---|
| 94 | $(ATNFDIR)/PKSIO/MBrecord.h \
|
---|
| 95 | $(ATNFDIR)/PKSIO/NRO45FITSReader.h \
|
---|
| 96 | $(ATNFDIR)/PKSIO/NRO45Reader.h \
|
---|
| 97 | $(ATNFDIR)/PKSIO/NRODataRecord.h \
|
---|
| 98 | $(ATNFDIR)/PKSIO/NRODataset.h \
|
---|
| 99 | $(ATNFDIR)/PKSIO/NROFITSDataset.h \
|
---|
| 100 | $(ATNFDIR)/PKSIO/NROOTFDataset.h \
|
---|
| 101 | $(ATNFDIR)/PKSIO/NROReader.h \
|
---|
| 102 | $(ATNFDIR)/PKSIO/PKSFITSreader.h \
|
---|
| 103 | $(ATNFDIR)/PKSIO/PKSMS2reader.h \
|
---|
| 104 | $(ATNFDIR)/PKSIO/PKSMS2writer.h \
|
---|
| 105 | $(ATNFDIR)/PKSIO/PKSreader.h \
|
---|
| 106 | $(ATNFDIR)/PKSIO/PKSrecord.h \
|
---|
| 107 | $(ATNFDIR)/PKSIO/PKSSDwriter.h \
|
---|
| 108 | $(ATNFDIR)/PKSIO/PKSwriter.h \
|
---|
| 109 | $(ATNFDIR)/PKSIO/SDFITSreader.h \
|
---|
| 110 | $(ATNFDIR)/PKSIO/SDFITSwriter.h \
|
---|
| 111 | $(ATNFDIR)/PKSIO/SrcType.h #\
|
---|
| 112 | # $(ATNFDIR)/PKSIO/PKSmsg.h
|
---|
| 113 |
|
---|
| 114 | .SUFFIXES: .o .cc
|
---|
| 115 | .cc.o:
|
---|
| 116 | -@ echo
|
---|
| 117 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 118 |
|
---|
| 119 | .PHONY : all clean objects realclean install
|
---|
| 120 |
|
---|
[1879] | 121 | all : $(TARGETLIB)
|
---|
[1877] | 122 |
|
---|
| 123 | objects : $(OBJECTS)
|
---|
| 124 |
|
---|
| 125 | $(TARGETLIB) : $(OBJECTS)
|
---|
| 126 | -@ echo
|
---|
| 127 | $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
|
---|
| 128 |
|
---|
| 129 | $(OBJECTS) : $(HEADERS)
|
---|
| 130 |
|
---|
| 131 | install :
|
---|
| 132 | @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
|
---|
| 133 |
|
---|
| 134 | clean :
|
---|
| 135 | -rm -f $(OBJECTS)
|
---|
| 136 |
|
---|
| 137 | cleanso :
|
---|
| 138 | -rm -f $(TARGETLIB)
|
---|
| 139 |
|
---|
| 140 | realclean : clean cleanso
|
---|
| 141 |
|
---|