forked from twillis449/ALBUS_ionosphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
218 lines (138 loc) · 4.02 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#
# JMA_code.rules
#
# Example Makefile for JMA coding
# 2004 Feb 13 James M Anderson --NRAO reorganize from various places
# 2006 Jul 05 JMA --JIVE more changes for better installation stuff
# 2008 Feb 15 JMA --MPIfR updates for generalizing build
# 2008 Feb 18 JMA --MPIfR updates for generalizing build
# 2013 May AGW -- improved generalized building a whole lot!
# customize the following four lines to your configuration
# note that we make no use of the real parseltongue - its just a place
# holder for python - this will be cleaned up
export SHELL=/bin/bash
export INSTALLDIR = /home/twillis/albus
# ancient legacy stuff
export CURRENT_PYTHON = python
# modify the following line to point to where Python include files are kept
export PYTHONINCLUDEDIR = /usr/include/python3.10
# Version numbering for the libiri library
export VER_MAJOR = 1
export VER_MINOR = 0
export VER_SUBSUB = 0
# use debugging by default? - under linux Ubuntu 10.04 there seems to be some
# problems with gfortran and multiprocessing. Under ubuntu 12.04 things seem
# to work OK
export DEBUG=0
# do make a shared library by default
export SHARED = 1
# define the compiler
export CC = gcc
export F77 = gfortran -std=legacy
export F77_COMPILER_LIB = m
export F77_COMPILER_LIB = gfortran
export F77_RECL_UNIT = bytes
export HAVE_G2C_H_FILE=0
export C++ = g++
export CPP = cpp -P
export INCLUDES = -I. -I$(INSTALLDIR)/include
export DEFINES = -DINSTALLDIR=\"$(INSTALLDIR)\"
ifeq ($(HAVE_G2C_H_FILE),1)
DEFINES += -DHAVE_G2C_H_FILE=$(HAVE_G2C_H_FILE)
endif
ifeq ($(OSTYPE),linux)
ifeq ($(DEBUG),0)
CFLAGS = -O2 -Wall $(INCLUDES) $(DEFINES)
FFLAGS = -O2 -Wall $(INCLUDES) $(DEFINES)
else
CFLAGS = -g -Wall $(INCLUDES) $(DEFINES)
FFLAGS = -g -Wall $(INCLUDES) $(DEFINES)
endif
endif
ifeq ($(OSTYPE),Solaris)
export F77 = f77
export MAKE = gmake
ifeq ($(DEBUG),0)
CFLAGS = -pipe -O2 -msupersparc -Wall $(INCLUDES) $(DEFINES)
FFLAGS = -O $(INCLUDES) $(DEFINES)
else
CFLAGS = -g -Wall $(INCLUDES) $(DEFINES)
FFLAGS = -g $(INCLUDES) $(DEFINES)
endif
endif
ifeq ($(SHARED),0)
EXT = a
else
CFLAGS += -fPIC
FFLAGS += -fPIC
EXT = so
endif
export CFLAGS
export FFLAGS
export EXT
#export MAKEDEPENDREAL = .dependencies.mk
#export MAKEDEPENDTEMP = .dependencies.mk.temp
#export MAKEDEPEND = gcc -MM -MF $(MAKEDEPENDTEMP)
# set up a postfix to use for file and directory names
ifeq ($(DEBUG),0)
POSTFIX=$(OSTYPE)
else
POSTFIX=$(OSTYPE)_debug
endif
export POSTFIX
export RM = /bin/rm -f
export RMDIR = /bin/rm -rf
export CP = /bin/cp
export MKDIR = /bin/mkdir -p
export MV = /bin/mv
SUBDIRS = \
C++ \
FORTRAN \
Python \
include
.PHONY: subdirs $(SUBDIRS)
all: subdirs
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
C: include
C++: C FORTRAN include
Python: C C++ FORTRAN include
# This will probably work best with C and C++ code. Modify
# If you want to do this for FORTRAN too.
.PHONY : depend clean distclean install
depend:
$(RM) $(MAKEDEPENDREAL)
$(foreach i,$(SRCS), $(MAKEDEPEND) $(CFLAGS) $i;cat $(MAKEDEPENDTEMP) >> $(MAKEDEPENDREAL);)
$(RM) $(MAKEDEPENDTEMP)
$(foreach i,$(SUBDIRS), $(MAKE) -C $i $@;)
clean:
$(RM) $(OBJS) $(PROG)
$(foreach i,$(SUBDIRS), $(MAKE) -C $i $@;)
#note: first delete old directory and make a new one
$(RMDIR) $(INSTALLDIR)
$(MKDIR) $(INSTALLDIR)
distclean: clean
$(RM) *~
$(foreach i,$(SUBDIRS), $(MAKE) -C $i $@;)
install: $(SUBDIRS)
$(foreach i,$(SUBDIRS), $(MAKE) -C $i $@;)
chmod -R ugo+rX $(INSTALLDIR)/bin
chmod -R ugo+rX $(INSTALLDIR)/include
chmod -R ugo+rX $(INSTALLDIR)/lib
chmod -R ugo+rX $(INSTALLDIR)/libdata
$(MKDIR) $(INSTALLDIR)/man
chmod -R ugo+rX $(INSTALLDIR)/man
chmod -R ugo+rX $(INSTALLDIR)/share
# make sure we can compile C++ stuff
.SUFFIXES:
.SUFFIXES: .cxx $(SUFFIXES)
# declare our own default compilation rules
.cxx.o:
$(CC) $(CFLAGS) -c $<
.F.o:
$(F77) $(FFLAGS) -c $<
.f.o:
$(F77) $(FFLAGS) -c $<
# If you are going to use MAKEDEPEND with GCC, uncomment the following
#include .dependencies.mk