-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
128 lines (102 loc) · 2.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# -*- mode: Makefile -*-
#
# NOTES:
#
# - To use virtualenv in a make file:
#
# . test-env/bin/activate; pip install grako
#
# I don't think we want to do that because we want to use a
# requirements.txt file.
#
# - On machine without virtualenv
#
# pip install --user virtualenv
# export PATH=$(PATH):$(HOME)/.local/bin
# virtualenv --system-site-packages ENVNAME
#
ENVNAME=cesm-env2
SUBDIRS = \
cesm_utils \
diag_utils \
mpi_utils \
reshaper \
averager \
timeseries \
conformer \
conform \
ilamb \
diagnostics \
ocean_remap
# MAKECMDGOALS is the make option: make 'clobber' or 'all'
TARGET = $(MAKECMDGOALS)
# if target is undefined (i.e. MAKECMDGOALS is undefined), target = all
ifeq (,$(TARGET))
TARGET = all
endif
#
# macro for executing TARGET in all SUBDIRS
#
ifdef SUBDIRS
$(SUBDIRS) : FORCE
@if [ -d $@ ]; then \
$(MAKE) --directory=$@ $(TARGET); \
fi
@echo Build complete: $@ : $(TARGET) : $(shell date)
endif
#
# all - Make everything in the listed sub directories
#
all : $(SUBDIRS)
test : all py-unit
py-unit : FORCE
python -m unittest discover
PYTHONPATH="${PYTHONPATH}:.." python -m unittest discover
#
# virtual environments and installation
#
#env : cesm-env2 cesm-env3
env : $(ENVNAME)/bin/activate
$(ENVNAME)/bin/activate :
virtualenv --system-site-packages -p python2 $(ENVNAME)
cesm-env2 :
virtualenv -p python2 $@
cesm-env3 :
virtualenv -p python3 $@
#env-conda : anaconda python version installation of virtaul env
env-conda :
conda create -p ./$(ENVNAME) python=2.7 anaconda
cesm-env2-conda :
# virtualenv -p python2 $@
cesm-env3-conda :
# virtualenv -p python3 $@
develop : $(SUBDIRS)
install : $(SUBDIRS)
#
# release info
#
#version : FORCE
# @git describe --always 2>/dev/null > VERSION
#
# clean - Clean up the directory.
#
clean : $(SUBDIRS)
-rm -f *~ *.CKP *.ln *.BAK *.bak .*.bak \
core errs \
,* .emacs_* \
tags TAGS \
make.log MakeOut \
*.tmp tmp.txt
#
# clobber - Really clean up the directory.
#
clobber : clean $(SUBDIRS)
-rm -f .Makedepend *.o *.mod *.il *.pyc *.so
-rm -rf *.egg-info build
clobber-env : FORCE
-rm -rf cesm-env2
# -rm -rf cesm-env2 cesm-env3
#
# FORCE - Null rule to force things to happen.
#
FORCE :