-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
153 lines (136 loc) · 4.2 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Commander Makefile for use with EITHER the planck
# module build system OR a set of stand-alone
# config files. Default make target prints help.
#
# This makefile requires the use of GNU make or
# compatible tools that allow the substitution
# operator ":=".
#
NOW := $(shell date +%Y%m%d-%H%M)
DIR := commander_$(NOW)
TOPDIR := $(shell pwd)
export TOPDIR
ifdef COMMANDER
include $(TOPDIR)/config/config.$(COMMANDER)
ifndef INSTALL
INSTALL := $(TOPDIR)/install_$(COMMANDER)
endif
else
$(error COMMANDER undefined)UNDEFINED
endif
ifndef MAKE
export MAKE := make
endif
ifndef AR
export AR := ar
endif
ifndef ARFLAGS
export ARFLAGS := crv
endif
ifndef RANLIB
export RANLIB := ranlib
endif
ifndef CTAR
export CTAR := tar czvf
endif
ifndef F90
export F90 := f90
endif
ifndef MPF90
export MPF90 := mpif90
endif
ifndef F90FLAGS
export F90FLAGS := -g -O2
endif
ifndef MPF77
export MPF77 := mpif77
endif
ifndef FFLAGS
export FFLAGS := -g -O2
endif
ifndef MPCC
export MPCC := cc
endif
ifndef CFLAGS
export CFLAGS := -g -O2
endif
ifndef MPCXX
export MPCXX := c++
endif
ifndef CXXFLAGS
export CXXFLAGS := -g -O2
endif
ifndef LDFLAGS
export LDFLAGS := -lm
endif
ifndef FORTRAN_UPPER
export FORTRAN_UPPER := 0
endif
ifndef CFITSIO_LINK
export CFITSIO_LINK := -L/usr/local/lib -lcfitsio
endif
ifndef LAPACK_LINK
export LAPACK_LINK := -L/usr/local/lib -llapack -lblas
endif
export F90COMP := $(F90FLAGS) -I../include $(LAPACK_INCLUDE) $(CFITSIO_INCLUDE) $(HEALPIX_INCLUDE)
export FCOMP := $(FFLAGS) $(LAPACK_INCLUDE) $(CFITSIO_INCLUDE) $(HEALPIX_INCLUDE)
export CCOMP := $(CFLAGS) $(LAPACK_INCLUDE) $(CFITSIO_INCLUDE) $(HEALPIX_INCLUDE)
export LINK := -L../commander -L../include -lcommander -lcommander_healpix $(HEALPIX_LINK) $(CFITSIO_LINK) $(LAPACK_LINK) $(LDFLAGS) $(F90OMPFLAGS)
all : commander comm_process_resfiles
help :
@echo ' '
@echo ' This Makefile is used to build Commander in a way that is'
@echo ' customized to your system. You must export the COMMANDER'
@echo ' environment variable and set it to the name of your platform.'
@echo ' Then you must create a config file named config/config.<$COMMANDER>.'
@echo ' I suggest copying the example config file and modifying the'
@echo ' parameters for your platform.'
@echo ' '
@echo ' The following make targets are supported:'
@echo ' '
@echo ' make : build everything'
@echo ' make help : print this help screen'
@echo ' make install : install everything'
@echo ' make clean : remove build files'
@echo ' make dist : construct a date-stamped source tarball'
@echo ' '
install : all
@echo 'installing into:' $(INSTALL)
@mkdir -p $(INSTALL)/lib
@mkdir -p $(INSTALL)/include
@mkdir -p $(INSTALL)/bin
@cp src/include/libcommander_healpix.a $(INSTALL)/lib
@cp src/commander/libcommander.a $(INSTALL)/lib
@cp src/commander/commander $(INSTALL)/bin
@cp src/comm_process_resfiles/comm_process_resfiles $(INSTALL)/bin
@cp src/comm_process_resfiles/comm_like_tools $(INSTALL)/bin
@cp src/comm_process_resfiles/comm_like_sampler $(INSTALL)/bin
@if test $(FORTRAN_UPPER) = 1; then \
cp src/commander/*.MOD $(INSTALL)/include; \
cp src/include/*.MOD $(INSTALL)/include; \
else \
cp src/commander/*.mod $(INSTALL)/include; \
cp src/include/*.mod $(INSTALL)/include; \
fi
commander : libcommander_healpix
@cd src/commander; $(MAKE)
libcommander_healpix :
@cd src/include; $(MAKE)
comm_process_resfiles :
@cd src/comm_process_resfiles; $(MAKE)
clean :
@cd src/commander; $(MAKE) clean
@cd src/comm_process_resfiles; $(MAKE) clean
@cd src/include; $(MAKE) clean
dist : clean
@mkdir $(DIR)
@mkdir -p $(DIR)/src/commander
@mkdir -p $(DIR)/src/comm_process_resfiles
@mkdir -p $(DIR)/src/include
@cp -r commander_test.tar.gz config Makefile $(DIR)
@cp src/commander/*.f90 src/commander/Makefile $(DIR)/src/commander
@cp src/comm_process_resfiles/*.f90 src/comm_process_resfiles/Makefile $(DIR)/src/comm_process_resfiles
@cp src/include/*.f90 src/include/*.f src/include/*.c src/include/Makefile $(DIR)/src/include
@rm -rf $(DIR)/config/.svn
@$(CTAR) $(DIR).tar.gz $(DIR)
@rm -rf $(DIR)