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 | #for mac
|
---|
6 | #PREFIX := /opt/casa/darwin
|
---|
7 | #for linux
|
---|
8 | PREFIX := $(word 1, $(CASAPATH))/$(word 2,$(CASAPATH))
|
---|
9 | PYTHONVER := $(shell $(shell make -s -f $(PREFIX)/makedefs VARS=PYTHONVER eval_vars) && echo $$PYTHONVER)
|
---|
10 | PYDIR := $(PREFIX)/python/$(PYTHONVER)
|
---|
11 |
|
---|
12 | ifndef ASAPROOT
|
---|
13 | ASAPROOT := $(shell pwd)
|
---|
14 | endif
|
---|
15 | ATNFD := external-alma
|
---|
16 | PYRAPD := external/libpyrap
|
---|
17 |
|
---|
18 | #PY := $(wildcard python/*.py)
|
---|
19 | PY := $(wildcard python/*.py python/svninfo.txt)
|
---|
20 | LIBS := /tmp/_asap.so
|
---|
21 | BINS := bin/asap
|
---|
22 | APPS := apps/asap2to3
|
---|
23 |
|
---|
24 | CASAROOT := $(word 1, $(CASAPATH))
|
---|
25 | PLATFORM := $(word 2, $(CASAPATH))
|
---|
26 | DISTDIR := asap_$(PLATFORM)
|
---|
27 |
|
---|
28 | all: module #doc
|
---|
29 |
|
---|
30 | module:
|
---|
31 | @if ( test -f getsvnrev.sh ) ; then /bin/bash getsvnrev.sh ; fi
|
---|
32 | @cd $(ASAPROOT)/$(PYRAPD); make
|
---|
33 | @cd $(ASAPROOT)/$(ATNFD); make
|
---|
34 | @cd $(ASAPROOT)/src; make
|
---|
35 | @cd $(ASAPROOT)/apps; make
|
---|
36 |
|
---|
37 | doc:
|
---|
38 | @cd $(ASAPROOT)/doc; make
|
---|
39 |
|
---|
40 |
|
---|
41 | install:
|
---|
42 | @if ( test -f getsvnrev.sh ) ; then /bin/bash getsvnrev.sh ; fi
|
---|
43 | @if ( test ! -d $(PYDIR)/asap ) ; then mkdir -p $(PYDIR)/asap ; fi
|
---|
44 | @if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
|
---|
45 | @cd $(ASAPROOT)/$(ATNFD); make install
|
---|
46 | @cd $(ASAPROOT)/$(PYRAPD); make install
|
---|
47 | @for file in $(LIBS) ; do cp -f $$file $(PYDIR)/asap ; done
|
---|
48 | @for file in $(BINS) ; do cp -f $$file $(PREFIX)/bin ; done
|
---|
49 | @for file in $(PY) ; do cp -f $$file $(PYDIR)/asap ; done
|
---|
50 | @if ( test ! -d $(PREFIX)/share/asap ) ; then mkdir -p $(PREFIX)/share/asap ; fi
|
---|
51 | @cp -f share/ipythonrc-asap $(PREFIX)/share/asap/
|
---|
52 | @for file in $(APPS) ; do cp -f $$file $(PREFIX)/bin ; done
|
---|
53 | @echo "Successfully installed asap module to" $(PYDIR)
|
---|
54 |
|
---|
55 | clean:
|
---|
56 | @cd $(ASAPROOT)/src; make clean
|
---|
57 | # @cd $(ASAPROOT)/doc; make clean
|
---|
58 | @cd $(ASAPROOT)/$(ATNFD); make realclean
|
---|
59 | @cd $(ASAPROOT)/apps; make clean
|
---|
60 | @cd $(ASAPROOT)/$(PYRAPD); make clean
|
---|
61 |
|
---|
62 | datadist:
|
---|
63 | @echo "Generating ASAP data archive from aips++ installation..."
|
---|
64 | @cd $(CASAROOT); tar cfj $(ASAPROOT)/$(DISTDIR)/share/data.tar.bz2 data/ephemerides data/geodetic
|
---|
65 | @echo "...done."
|
---|
66 |
|
---|
67 |
|
---|
68 | dist: module doc
|
---|
69 | @cd $(ASAPROOT)
|
---|
70 | @if ( test -d $(DISTDIR) ) ; then rm -rf $(DISTDIR) ; fi
|
---|
71 | @mkdir $(DISTDIR)
|
---|
72 | @mkdir $(DISTDIR)/build $(DISTDIR)/bin $(DISTDIR)/share
|
---|
73 | @for file in $(LIBS) ; do cp -f $$file $(DISTDIR)/build/ ; done
|
---|
74 | @for file in $(PY) ; do cp -f $$file $(DISTDIR)/build/ ; done
|
---|
75 | @for file in $(BINS) ; do cp -f $$file $(DISTDIR)/bin/ ; done
|
---|
76 | @cp -f share/ipythonrc-asap $(DISTDIR)/share/
|
---|
77 | make datadist
|
---|
78 | @cp -f doc/README $(DISTDIR)/
|
---|
79 | @cp -f doc/CHANGELOG $(DISTDIR)/
|
---|
80 | @cp -f bin/install.sh $(DISTDIR)/bin/
|
---|
81 | @echo "Creating compressed archive..."
|
---|
82 | @tar jcf $(DISTDIR).tar.bz2 $(DISTDIR)
|
---|
83 | @rm -rf $(DISTDIR)/
|
---|
84 | @echo "Successfully created binary package" $(DISTDIR).tar.bz2
|
---|
85 |
|
---|
86 | .PHONY: install clean
|
---|