source: trunk/external-alma/Makefile@ 1877

Last change on this file since 1877 was 1877, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): libatnf

Description:

Added make file in external-alma so that libatnf will be built from the codes there.


File size: 4.7 KB
Line 
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).
5EXTDIR := $(shell pwd)
6ATNFDIR := $(EXTDIR)/atnf
7
8# the casa environment AIPSPATH has to be defined
9CASAROOT := $(word 1, $(CASAPATH))
10CASAARCH := $(word 2, $(CASAPATH))
11
12COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
13CASALIB := $(CASAROOT)/$(CASAARCH)/lib
14USELIB := lib64
15
16TARGETLIB := libatnf.so
17ifeq "$(CASAARCH)" "darwin"
18 TARGETLIB := libatnf.dylib
19endif
20
21# the compiler
22ifndef CXX
23 CXX := g++
24endif
25
26# compiler flags
27CXXFLAGS := -fPIC -O2 -g -fno-omit-frame-pointer
28CXXFLAGS += -Wall -Wextra -Wcast-align -Wno-comment
29# passing flags to codes for casacore
30CXXOPTS := -DCASA_USECASAPATH -DCASACORE_NEEDS_RETHROW -DAIPS_STDLIB \
31 -DAIPS_AUTO_STL -D_GNU_SOURCE
32# for little endian cpu (casacore + atnf flag)
33CXXOPTS += -DAIPS_LITTLE_ENDIAN
34# for 64-bit platforms
35CXXOPTS += -DAIPS_64B
36ifeq "$(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
41else # 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
46endif
47
48# casacore library dependencies
49CORELIBS := -lcasa_casa -lcasa_measures -lcasa_scimath -lcasa_ms -lcasa_tables
50
51# cfitsio
52CFITSIOROOT := /usr
53CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
54CFITSIOLIB := -lcfitsio
55
56#rpfits
57RPFITSROOT := /usr
58RPFITSLIB := -lrpfits
59
60# the linker
61LD := $(CXX)
62
63#LDFLAGS := -shared -Wl$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
64LDFLAGS := -pipe -Wl,--no-undefined -shared -Wl,-soname,$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(CASALIB)
65ifeq "$(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
68endif
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
74INCDIRS := -I$(COREINCD) $(CFITSIOINC) -I$(EXTDIR)
75LIBS := $(CFITSIOLIB) $(RPFITSLIB) -L$(CASALIB) $(CORELIBS)
76
77OBJECTS := $(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
101HEADERS := $(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
136all : $(TARGETLIB) install
137
138objects : $(OBJECTS)
139
140$(TARGETLIB) : $(OBJECTS)
141 -@ echo
142 $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
143
144$(OBJECTS) : $(HEADERS)
145
146install :
147 @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
148
149clean :
150 -rm -f $(OBJECTS)
151
152cleanso :
153 -rm -f $(TARGETLIB)
154
155realclean : clean cleanso
156
Note: See TracBrowser for help on using the repository browser.