[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 |
|
---|
| 8 | # the casa environment AIPSPATH has to be defined
|
---|
| 9 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
| 10 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
| 11 |
|
---|
| 12 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
| 13 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
| 14 | USELIB := lib64
|
---|
| 15 |
|
---|
| 16 | TARGETLIB := libatnf.so
|
---|
| 17 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 18 | TARGETLIB := libatnf.dylib
|
---|
| 19 | endif
|
---|
| 20 |
|
---|
| 21 | # the compiler
|
---|
| 22 | ifndef CXX
|
---|
| 23 | CXX := g++
|
---|
| 24 | endif
|
---|
| 25 |
|
---|
| 26 | # compiler flags
|
---|
| 27 | CXXFLAGS := -fPIC -O2 -g -fno-omit-frame-pointer
|
---|
| 28 | CXXFLAGS += -Wall -Wextra -Wcast-align -Wno-comment
|
---|
| 29 | # passing flags to codes for casacore
|
---|
| 30 | CXXOPTS := -DCASA_USECASAPATH -DCASACORE_NEEDS_RETHROW -DAIPS_STDLIB \
|
---|
| 31 | -DAIPS_AUTO_STL -D_GNU_SOURCE
|
---|
| 32 | # for little endian cpu (casacore + atnf flag)
|
---|
| 33 | CXXOPTS += -DAIPS_LITTLE_ENDIAN
|
---|
| 34 | # for 64-bit platforms
|
---|
| 35 | CXXOPTS += -DAIPS_64B
|
---|
| 36 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 37 | CXXFLAGS += -mmacosx-version-min=10.5 -dynamic -mtune=nocona \
|
---|
| 38 | -mfpmath=sse -ftree-vectorize -ffast-math -fasm-blocks
|
---|
| 39 | CXXOPTS += -DAIPS_DARWIN
|
---|
| 40 | CXXOPTS += -DMACOSXBUILT
|
---|
| 41 | else # so far CASAARCH is either darwin, linux_gnu, or linux_64b (Aug.2010)
|
---|
| 42 | CXXFLAGS += -ansi
|
---|
| 43 | CXXOPTS += -DAIPS_LINUX
|
---|
| 44 | # platform dependent casacore flags
|
---|
| 45 | CXXOPTS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
---|
| 46 | endif
|
---|
| 47 |
|
---|
| 48 | # casacore library dependencies
|
---|
| 49 | CORELIBS := -lcasa_casa -lcasa_measures -lcasa_scimath -lcasa_ms -lcasa_tables
|
---|
| 50 |
|
---|
| 51 | # cfitsio
|
---|
| 52 | CFITSIOROOT := /usr
|
---|
| 53 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
| 54 | CFITSIOLIB := -lcfitsio
|
---|
| 55 |
|
---|
| 56 | #rpfits
|
---|
| 57 | RPFITSROOT := /usr
|
---|
| 58 | RPFITSLIB := -lrpfits
|
---|
| 59 |
|
---|
| 60 | # the linker
|
---|
| 61 | LD := $(CXX)
|
---|
| 62 |
|
---|
| 63 | #LDFLAGS := -shared -Wl$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
|
---|
| 64 | LDFLAGS := -pipe -Wl,--no-undefined -shared -Wl,-soname,$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(CASALIB)
|
---|
| 65 | ifeq "$(CASAARCH)" "darwin"
|
---|
| 66 | LDFLAGS := -dynamiclib -Wl,-undefined -Wl,error -install_name $(CASALIB)/$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(CASALIB)
|
---|
| 67 | #LDFLAGS += -headerpad_max_install_names -compatibility_version 3.1.0
|
---|
| 68 | endif
|
---|
| 69 |
|
---|
| 70 | # resoleve dependencies on external package
|
---|
| 71 | # pks: -lcasa_casa, atnf/pks/pks_math.h
|
---|
| 72 | # PKSIO: -lcfitsio, -lrpfits, atnf/pks/pks_maths.h, atnf/PKSIO/****.h
|
---|
| 73 | # -lcasa_casa, -lcasa_measures, -lcasa_scimath, -lcasa_ms, -lcasa_tables
|
---|
| 74 | INCDIRS := -I$(COREINCD) $(CFITSIOINC) -I$(EXTDIR)
|
---|
| 75 | LIBS := $(CFITSIOLIB) $(RPFITSLIB) -L$(CASALIB) $(CORELIBS)
|
---|
| 76 |
|
---|
| 77 | OBJECTS := $(ATNFDIR)/pks/pks_maths.o \
|
---|
| 78 | $(ATNFDIR)/PKSIO/ASTEDataset.o \
|
---|
| 79 | $(ATNFDIR)/PKSIO/ASTEFXDataset.o \
|
---|
| 80 | $(ATNFDIR)/PKSIO/ASTEFXReader.o \
|
---|
| 81 | $(ATNFDIR)/PKSIO/ASTEReader.o \
|
---|
| 82 | $(ATNFDIR)/PKSIO/FITSreader.o \
|
---|
| 83 | $(ATNFDIR)/PKSIO/GBTFITSreader.o \
|
---|
| 84 | $(ATNFDIR)/PKSIO/MBFITSreader.o \
|
---|
| 85 | $(ATNFDIR)/PKSIO/MBrecord.o \
|
---|
| 86 | $(ATNFDIR)/PKSIO/NRO45FITSReader.o \
|
---|
| 87 | $(ATNFDIR)/PKSIO/NRO45Reader.o \
|
---|
| 88 | $(ATNFDIR)/PKSIO/NRODataset.o \
|
---|
| 89 | $(ATNFDIR)/PKSIO/NROFITSDataset.o \
|
---|
| 90 | $(ATNFDIR)/PKSIO/NROOTFDataset.o \
|
---|
| 91 | $(ATNFDIR)/PKSIO/NROReader.o \
|
---|
| 92 | $(ATNFDIR)/PKSIO/PKSFITSreader.o \
|
---|
| 93 | $(ATNFDIR)/PKSIO/PKSMS2reader.o \
|
---|
| 94 | $(ATNFDIR)/PKSIO/PKSMS2writer.o \
|
---|
| 95 | $(ATNFDIR)/PKSIO/PKSreader.o \
|
---|
| 96 | $(ATNFDIR)/PKSIO/PKSSDwriter.o \
|
---|
| 97 | $(ATNFDIR)/PKSIO/SDFITSreader.o \
|
---|
| 98 | $(ATNFDIR)/PKSIO/SDFITSwriter.o #\
|
---|
| 99 | # $(ATNFDIR)/PKSIO/PKSmsg.cc
|
---|
| 100 |
|
---|
| 101 | HEADERS := $(ATNFDIR)/pks/pks_maths.h \
|
---|
| 102 | $(ATNFDIR)/PKSIO/ASTEDataset.h \
|
---|
| 103 | $(ATNFDIR)/PKSIO/ASTEFXDataset.h \
|
---|
| 104 | $(ATNFDIR)/PKSIO/ASTEFXReader.h \
|
---|
| 105 | $(ATNFDIR)/PKSIO/ASTEReader.h \
|
---|
| 106 | $(ATNFDIR)/PKSIO/FITSreader.h \
|
---|
| 107 | $(ATNFDIR)/PKSIO/GBTFITSreader.h \
|
---|
| 108 | $(ATNFDIR)/PKSIO/MBFITSreader.h \
|
---|
| 109 | $(ATNFDIR)/PKSIO/MBrecord.h \
|
---|
| 110 | $(ATNFDIR)/PKSIO/NRO45FITSReader.h \
|
---|
| 111 | $(ATNFDIR)/PKSIO/NRO45Reader.h \
|
---|
| 112 | $(ATNFDIR)/PKSIO/NRODataRecord.h \
|
---|
| 113 | $(ATNFDIR)/PKSIO/NRODataset.h \
|
---|
| 114 | $(ATNFDIR)/PKSIO/NROFITSDataset.h \
|
---|
| 115 | $(ATNFDIR)/PKSIO/NROOTFDataset.h \
|
---|
| 116 | $(ATNFDIR)/PKSIO/NROReader.h \
|
---|
| 117 | $(ATNFDIR)/PKSIO/PKSFITSreader.h \
|
---|
| 118 | $(ATNFDIR)/PKSIO/PKSMS2reader.h \
|
---|
| 119 | $(ATNFDIR)/PKSIO/PKSMS2writer.h \
|
---|
| 120 | $(ATNFDIR)/PKSIO/PKSreader.h \
|
---|
| 121 | $(ATNFDIR)/PKSIO/PKSrecord.h \
|
---|
| 122 | $(ATNFDIR)/PKSIO/PKSSDwriter.h \
|
---|
| 123 | $(ATNFDIR)/PKSIO/PKSwriter.h \
|
---|
| 124 | $(ATNFDIR)/PKSIO/SDFITSreader.h \
|
---|
| 125 | $(ATNFDIR)/PKSIO/SDFITSwriter.h \
|
---|
| 126 | $(ATNFDIR)/PKSIO/SrcType.h #\
|
---|
| 127 | # $(ATNFDIR)/PKSIO/PKSmsg.h
|
---|
| 128 |
|
---|
| 129 | .SUFFIXES: .o .cc
|
---|
| 130 | .cc.o:
|
---|
| 131 | -@ echo
|
---|
| 132 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
| 133 |
|
---|
| 134 | .PHONY : all clean objects realclean install
|
---|
| 135 |
|
---|
| 136 | all : $(TARGETLIB) install
|
---|
| 137 |
|
---|
| 138 | objects : $(OBJECTS)
|
---|
| 139 |
|
---|
| 140 | $(TARGETLIB) : $(OBJECTS)
|
---|
| 141 | -@ echo
|
---|
| 142 | $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
|
---|
| 143 |
|
---|
| 144 | $(OBJECTS) : $(HEADERS)
|
---|
| 145 |
|
---|
| 146 | install :
|
---|
| 147 | @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
|
---|
| 148 |
|
---|
| 149 | clean :
|
---|
| 150 | -rm -f $(OBJECTS)
|
---|
| 151 |
|
---|
| 152 | cleanso :
|
---|
| 153 | -rm -f $(TARGETLIB)
|
---|
| 154 |
|
---|
| 155 | realclean : clean cleanso
|
---|
| 156 |
|
---|