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