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 -pipe
|
---|
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 | else # so far CASAARCH is either darwin, linux_gnu, or linux_64b (Aug.2010)
|
---|
41 | CXXFLAGS += -ansi
|
---|
42 | CXXOPTS += -DAIPS_LINUX
|
---|
43 | # platform dependent casacore flags
|
---|
44 | CXXOPTS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
---|
45 | endif
|
---|
46 |
|
---|
47 | # casacore library dependencies
|
---|
48 | CORELIBS := -lcasa_casa -lcasa_measures -lcasa_scimath -lcasa_ms -lcasa_tables
|
---|
49 |
|
---|
50 | # cfitsio
|
---|
51 | CFITSIOROOT := /usr
|
---|
52 | CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
|
---|
53 | CFITSIOLIB := -lcfitsio
|
---|
54 |
|
---|
55 | #rpfits
|
---|
56 | RPFITSROOT := /usr
|
---|
57 | RPFITSLIB := -lrpfits
|
---|
58 |
|
---|
59 | # the linker
|
---|
60 | LD := $(CXX)
|
---|
61 |
|
---|
62 | LDFLAGS := -Wl,--no-undefined -shared -Wl,-soname,$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(CASALIB)
|
---|
63 | ifeq "$(CASAARCH)" "darwin"
|
---|
64 | LDFLAGS := -dynamiclib -Wl,-undefined -Wl,error -install_name $(CASALIB)/$(TARGETLIB) -Xlinker -rpath -Xlinker $(CASALIB)
|
---|
65 | endif
|
---|
66 |
|
---|
67 | # resoleve dependencies on external package
|
---|
68 | # pks: -lcasa_casa, atnf/pks/pks_math.h
|
---|
69 | # PKSIO: -lcfitsio, -lrpfits, atnf/pks/pks_maths.h, atnf/PKSIO/****.h
|
---|
70 | # -lcasa_casa, -lcasa_measures, -lcasa_scimath, -lcasa_ms, -lcasa_tables
|
---|
71 | INCDIRS := -I$(COREINCD) $(CFITSIOINC) -I$(EXTDIR)
|
---|
72 | LIBS := $(CFITSIOLIB) $(RPFITSLIB) -L$(CASALIB) $(CORELIBS)
|
---|
73 |
|
---|
74 | OBJECTS := $(ATNFDIR)/pks/pks_maths.o \
|
---|
75 | $(ATNFDIR)/PKSIO/ASTEDataset.o \
|
---|
76 | $(ATNFDIR)/PKSIO/ASTEFXDataset.o \
|
---|
77 | $(ATNFDIR)/PKSIO/ASTEFXReader.o \
|
---|
78 | $(ATNFDIR)/PKSIO/ASTEReader.o \
|
---|
79 | $(ATNFDIR)/PKSIO/FITSreader.o \
|
---|
80 | $(ATNFDIR)/PKSIO/GBTFITSreader.o \
|
---|
81 | $(ATNFDIR)/PKSIO/MBFITSreader.o \
|
---|
82 | $(ATNFDIR)/PKSIO/MBrecord.o \
|
---|
83 | $(ATNFDIR)/PKSIO/NRO45FITSReader.o \
|
---|
84 | $(ATNFDIR)/PKSIO/NRO45Reader.o \
|
---|
85 | $(ATNFDIR)/PKSIO/NRODataset.o \
|
---|
86 | $(ATNFDIR)/PKSIO/NROFITSDataset.o \
|
---|
87 | $(ATNFDIR)/PKSIO/NROOTFDataset.o \
|
---|
88 | $(ATNFDIR)/PKSIO/NROReader.o \
|
---|
89 | $(ATNFDIR)/PKSIO/PKSFITSreader.o \
|
---|
90 | $(ATNFDIR)/PKSIO/PKSMS2reader.o \
|
---|
91 | $(ATNFDIR)/PKSIO/PKSMS2writer.o \
|
---|
92 | $(ATNFDIR)/PKSIO/PKSreader.o \
|
---|
93 | $(ATNFDIR)/PKSIO/PKSSDwriter.o \
|
---|
94 | $(ATNFDIR)/PKSIO/SDFITSreader.o \
|
---|
95 | $(ATNFDIR)/PKSIO/SDFITSwriter.o #\
|
---|
96 | # $(ATNFDIR)/PKSIO/PKSmsg.cc
|
---|
97 |
|
---|
98 | HEADERS := $(ATNFDIR)/pks/pks_maths.h \
|
---|
99 | $(ATNFDIR)/PKSIO/ASTEDataset.h \
|
---|
100 | $(ATNFDIR)/PKSIO/ASTEFXDataset.h \
|
---|
101 | $(ATNFDIR)/PKSIO/ASTEFXReader.h \
|
---|
102 | $(ATNFDIR)/PKSIO/ASTEReader.h \
|
---|
103 | $(ATNFDIR)/PKSIO/FITSreader.h \
|
---|
104 | $(ATNFDIR)/PKSIO/GBTFITSreader.h \
|
---|
105 | $(ATNFDIR)/PKSIO/MBFITSreader.h \
|
---|
106 | $(ATNFDIR)/PKSIO/MBrecord.h \
|
---|
107 | $(ATNFDIR)/PKSIO/NRO45FITSReader.h \
|
---|
108 | $(ATNFDIR)/PKSIO/NRO45Reader.h \
|
---|
109 | $(ATNFDIR)/PKSIO/NRODataRecord.h \
|
---|
110 | $(ATNFDIR)/PKSIO/NRODataset.h \
|
---|
111 | $(ATNFDIR)/PKSIO/NROFITSDataset.h \
|
---|
112 | $(ATNFDIR)/PKSIO/NROOTFDataset.h \
|
---|
113 | $(ATNFDIR)/PKSIO/NROReader.h \
|
---|
114 | $(ATNFDIR)/PKSIO/PKSFITSreader.h \
|
---|
115 | $(ATNFDIR)/PKSIO/PKSMS2reader.h \
|
---|
116 | $(ATNFDIR)/PKSIO/PKSMS2writer.h \
|
---|
117 | $(ATNFDIR)/PKSIO/PKSreader.h \
|
---|
118 | $(ATNFDIR)/PKSIO/PKSrecord.h \
|
---|
119 | $(ATNFDIR)/PKSIO/PKSSDwriter.h \
|
---|
120 | $(ATNFDIR)/PKSIO/PKSwriter.h \
|
---|
121 | $(ATNFDIR)/PKSIO/SDFITSreader.h \
|
---|
122 | $(ATNFDIR)/PKSIO/SDFITSwriter.h \
|
---|
123 | $(ATNFDIR)/PKSIO/SrcType.h #\
|
---|
124 | # $(ATNFDIR)/PKSIO/PKSmsg.h
|
---|
125 |
|
---|
126 | .SUFFIXES: .o .cc
|
---|
127 | .cc.o:
|
---|
128 | -@ echo
|
---|
129 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
130 |
|
---|
131 | .PHONY : all clean objects realclean install
|
---|
132 |
|
---|
133 | all : $(TARGETLIB)
|
---|
134 |
|
---|
135 | objects : $(OBJECTS)
|
---|
136 |
|
---|
137 | $(TARGETLIB) : $(OBJECTS)
|
---|
138 | -@ echo
|
---|
139 | $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
|
---|
140 |
|
---|
141 | $(OBJECTS) : $(HEADERS)
|
---|
142 |
|
---|
143 | install :
|
---|
144 | @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
|
---|
145 |
|
---|
146 | clean :
|
---|
147 | -rm -f $(OBJECTS)
|
---|
148 |
|
---|
149 | cleanso :
|
---|
150 | -rm -f $(TARGETLIB)
|
---|
151 |
|
---|
152 | realclean : clean cleanso
|
---|
153 |
|
---|