source: trunk/external-alma/Makefile@ 1878

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

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): libatnf

Description: a bit more modifications to compile options.

+removed ineffective -DMACOSXBUILT and -s from mac build
+added -pipe option to g++


File size: 4.5 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 -pipe
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
40else # 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
45endif
46
47# casacore library dependencies
48CORELIBS := -lcasa_casa -lcasa_measures -lcasa_scimath -lcasa_ms -lcasa_tables
49
50# cfitsio
51CFITSIOROOT := /usr
52CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
53CFITSIOLIB := -lcfitsio
54
55#rpfits
56RPFITSROOT := /usr
57RPFITSLIB := -lrpfits
58
59# the linker
60LD := $(CXX)
61
62LDFLAGS := -Wl,--no-undefined -shared -Wl,-soname,$(TARGETLIB) -s -Xlinker -rpath -Xlinker $(CASALIB)
63ifeq "$(CASAARCH)" "darwin"
64 LDFLAGS := -dynamiclib -Wl,-undefined -Wl,error -install_name $(CASALIB)/$(TARGETLIB) -Xlinker -rpath -Xlinker $(CASALIB)
65endif
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
71INCDIRS := -I$(COREINCD) $(CFITSIOINC) -I$(EXTDIR)
72LIBS := $(CFITSIOLIB) $(RPFITSLIB) -L$(CASALIB) $(CORELIBS)
73
74OBJECTS := $(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
98HEADERS := $(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
133all : $(TARGETLIB) install
134
135objects : $(OBJECTS)
136
137$(TARGETLIB) : $(OBJECTS)
138 -@ echo
139 $(LD) $(CXXFLAGS) $(LDFLAGS) -o $(TARGETLIB) $(OBJECTS) $(LIBS)
140
141$(OBJECTS) : $(HEADERS)
142
143install :
144 @if ( test -f $(TARGETLIB) ) ; then cp -f $(TARGETLIB) $(CASALIB)/. ; fi
145
146clean :
147 -rm -f $(OBJECTS)
148
149cleanso :
150 -rm -f $(TARGETLIB)
151
152realclean : clean cleanso
153
Note: See TracBrowser for help on using the repository browser.