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 CASAPATH has to be defined
|
---|
9 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
10 | CASAARCH := $(word 2, $(CASAPATH))
|
---|
11 |
|
---|
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)
|
---|
15 | COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
|
---|
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
|
---|
23 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
24 |
|
---|
25 | CASALIB := $(CASAROOT)/$(CASAARCH)/lib
|
---|
26 | #USELIB := lib64
|
---|
27 |
|
---|
28 | ifeq ($(shell uname), Darwin)
|
---|
29 | TARGETLIB := libatnf.dylib
|
---|
30 | else
|
---|
31 | TARGETLIB := libatnf.so
|
---|
32 | endif
|
---|
33 |
|
---|
34 | # the compiler
|
---|
35 | ifndef CXX
|
---|
36 | CXX := g++
|
---|
37 | endif
|
---|
38 |
|
---|
39 | # compiler flags
|
---|
40 | CXXFLAGS += -fPIC
|
---|
41 |
|
---|
42 | # cfitsio
|
---|
43 | CFITSIOLIB := -lcfitsio
|
---|
44 |
|
---|
45 | #rpfits
|
---|
46 | RPFITSLIB := -lrpfits
|
---|
47 |
|
---|
48 | # the linker
|
---|
49 | LD := $(CXX)
|
---|
50 |
|
---|
51 | LDFLAGS += -shared
|
---|
52 | ifeq ($(shell uname), Darwin)
|
---|
53 | LDFLAGS += -headerpad_max_install_names -install_name $(CASAROOT)/$(CASAARCH)/lib/$(TARGETLIB)
|
---|
54 | endif
|
---|
55 |
|
---|
56 | INCDIRS := -I$(COREINCD) -I$(CFITSIOINCD) -I$(EXTDIR)
|
---|
57 | LIBS := -L$(CFITSIOLIBD) $(CFITSIOLIB) -L$(RPFITSLIBD) $(RPFITSLIB) -L$(CASALIB) $(CORELIB) -lgfortran
|
---|
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 #\
|
---|
81 | # $(ATNFDIR)/PKSIO/PKSmsg.o
|
---|
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 |
|
---|
111 | .SUFFIXES: .o .cc
|
---|
112 | .cc.o:
|
---|
113 | -@ echo
|
---|
114 | $(CXX) $(CXXOPTS) -c $(CXXFLAGS) $(INCDIRS) -o $@ $<
|
---|
115 |
|
---|
116 | .PHONY : all clean objects realclean install
|
---|
117 |
|
---|
118 | all : $(TARGETLIB)
|
---|
119 |
|
---|
120 | objects : $(OBJECTS)
|
---|
121 |
|
---|
122 | $(TARGETLIB) : $(OBJECTS)
|
---|
123 | -@ echo
|
---|
124 | $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
|
---|
125 |
|
---|
126 | $(OBJECTS) : $(HEADERS)
|
---|
127 |
|
---|
128 | install :
|
---|
129 | @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
|
---|
130 |
|
---|
131 | clean :
|
---|
132 | -rm -f $(OBJECTS)
|
---|
133 |
|
---|
134 | cleanso :
|
---|
135 | -rm -f $(TARGETLIB)
|
---|
136 |
|
---|
137 | realclean : clean cleanso
|
---|
138 |
|
---|