-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
356 lines (301 loc) · 11.9 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#
# Makefile for Yet Another Pulsar Processor
#
# Created by Jayanth Chennamangalam on 2008.11.17
#
# C compiler and flags
# this may need to be changed to g77 in some cases
CC = gcc
# include path for other libraries
ifeq ($(shell uname), Darwin)
CFLAGS_INC_PGPLOT =-I/opt/local/include# define if needed (as -I[...])
else
CFLAGS_INC_PGPLOT =# define if needed (as -I[...])
endif
CFLAGS_INC_FFTW3 =# define if needed (as -I[...])
CFLAGS_INC_HDF5 =-I/usr/local/hdf5/include
ifeq ($(shell uname), Darwin)
CFLAGS_INC_CFITSIO =-I/opt/local/include# define if needed (as -I[...])
else
CFLAGS_INC_CFITSIO =# define if needed (as -I[...])
endif
CFLAGS = -std=gnu99 -pedantic -Wall $(CFLAGS_INC_PGPLOT) $(CFLAGS_INC_FFTW3) \
$(CFLAGS_INC_CFITSIO)
ifeq ($(HDF5), yes)
CFLAGS += $(CFLAGS_INC_HDF5)
endif
CFLAGS_C_DEBUG = $(CFLAGS) -g -c
CFLAGS_C_RELEASE = $(CFLAGS) -O3 -c
ifeq ($(DEBUG), yes)
CFLAGS_C = $(CFLAGS_C_DEBUG)
else
CFLAGS_C = $(CFLAGS_C_RELEASE)
endif
CFLAGS_L_DEBUG = $(CFLAGS) -g
CFLAGS_L_RELEASE = $(CFLAGS) -O3
ifeq ($(DEBUG), yes)
CFLAGS_L = $(CFLAGS_L_DEBUG)
else
CFLAGS_L = $(CFLAGS_L_RELEASE)
endif
# enable/disable HDF5 compilation
ifeq ($(HDF5), yes)
DHDF5 = -DHDF5
endif
# enable/disable the debug flag
ifeq ($(DEBUG), yes)
DDEBUG = -DDEBUG
endif
# linker flags
ifeq ($(shell uname), Darwin)
LFLAGS_PGPLOT_DIR =-L/opt/local/lib# define if not in $PATH (as -L[...])
else
LFLAGS_PGPLOT_DIR =# define if not in $PATH (as -L[...])
endif
LFLAGS_FFTW3_DIR =# define if not in $PATH (as -L[...])
ifeq ($(HDF5), yes)
LFLAGS_HDF5_DIR =-L/usr/local/hdf5/lib
endif
ifeq ($(shell uname), Darwin)
LFLAGS_CFITSIO_DIR =-L/opt/local/lib# define if not in $PATH (as -L[...])
else
LFLAGS_CFITSIO_DIR =# define if not in $PATH (as -L[...])
endif
LFLAGS_FFTW3 = $(LFLAGS_FFTW3_DIR) -lfftw3f
LFLAGS_CFITSIO = $(LFLAGS_CFITSIO_DIR) -lcfitsio
ifeq ($(HDF5), yes)
LFLAGS_HDF5 = $(LFLAGS_HDF5_DIR) -lhdf5
endif
# in some cases, linking needs to be done with the X11 library, in which case
# append '-lX11' (and possibly the path to the library) to the line below, as
# shown in the commented out example. the commented example also shows other
# libraries that may be needed.
# libgfortran may also be needed in some cases, in which case append
# '-lgfortran' (and possibly the path to the library) to the line below.
LFLAGS_PGPLOT = $(LFLAGS_PGPLOT_DIR) -lcpgplot
#LFLAGS_PGPLOT = $(LFLAGS_PGPLOT_DIR) -lpgplot -lcpgplot -lX11 -lpng
LFLAGS_MATH = -lm
# directories
SRCDIR = src
SCRIPTDIR = scripts
UTILDIR = utilities
MANDIR = man
IDIR = src
BINDIR = bin
# binary installation directory - modify if needed
BININSTALLDIR = /usr/local/bin
# man page installation directory - modify if needed
MANINSTALLDIR = /usr/local/share/man/man1
# command definitions
DELCMD = rm
all: yapp_makever \
yapp_version.o \
yapp_erflookup.o \
yapp_common.o \
yapp_viewmetadata.o \
yapp_viewmetadata \
colourmap.o \
yapp_showinfo.o \
yapp_showinfo \
yapp_viewdata.o \
yapp_viewdata \
yapp_ft.o \
yapp_ft \
yapp_dedisperse.o \
yapp_dedisperse \
yapp_smooth.o \
yapp_smooth \
yapp_decimate.o \
yapp_decimate \
yapp_filter.o \
yapp_filter \
yapp_fold.o \
yapp_fold \
yapp_add.o \
yapp_add \
yapp_fits2fil.o \
yapp_fits2fil \
yapp_dat2tim.o \
yapp_dat2tim \
yapp_tim2dat.o \
yapp_tim2dat \
yapp_fil2h5.o \
yapp_fil2h5 \
yapp_subtract.o \
yapp_subtract \
yapp_siftpulses.o \
yapp_siftpulses \
yapp_stacktim.o \
yapp_stacktim \
yapp_split.o \
yapp_split \
yapp_ym2fil.o \
yapp_ym2fil \
yapp_makever: $(SRCDIR)/yapp_makever.c
$(CC) $(CFLAGS_L) $< -o $(IDIR)/$@
$(IDIR)/$@
$(DELCMD) $(IDIR)/$@
yapp_version.o: $(SRCDIR)/yapp_version.c
$(CC) $(CFLAGS_C) $< -o $(IDIR)/$@
yapp_erflookup.o: $(SRCDIR)/yapp_erflookup.c $(SRCDIR)/yapp.h
$(CC) $(CFLAGS_C) $< -o $(IDIR)/$@
yapp_common.o: $(SRCDIR)/yapp_common.c $(SRCDIR)/yapp.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_viewmetadata.o: $(SRCDIR)/yapp_viewmetadata.c $(SRCDIR)/yapp.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_viewmetadata: $(IDIR)/yapp_viewmetadata.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
colourmap.o: $(SRCDIR)/colourmap.c $(SRCDIR)/colourmap.h
$(CC) $(CFLAGS_C) $< -o $(IDIR)/$@
yapp_showinfo.o: $(SRCDIR)/yapp_showinfo.c $(SRCDIR)/yapp.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_showinfo: $(IDIR)/yapp_showinfo.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_viewdata.o: $(SRCDIR)/yapp_viewdata.c $(SRCDIR)/yapp.h \
$(SRCDIR)/yapp_erflookup.c
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_viewdata: $(IDIR)/yapp_viewdata.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_ft.o: $(SRCDIR)/yapp_ft.c $(SRCDIR)/yapp.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_ft: $(IDIR)/yapp_ft.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_FFTW3) \
$(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_dedisperse.o: $(SRCDIR)/yapp_dedisperse.c $(SRCDIR)/yapp.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $(DFC) $(SRCDIR)/yapp_dedisperse.c \
-o $(IDIR)/$@
yapp_dedisperse: $(IDIR)/yapp_dedisperse.o
$(CC) $(IDIR)/yapp_dedisperse.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o \
$(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_smooth.o: $(SRCDIR)/yapp_smooth.c $(SRCDIR)/yapp.h \
$(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_smooth: $(IDIR)/yapp_smooth.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_decimate.o: $(SRCDIR)/yapp_decimate.c $(SRCDIR)/yapp.h \
$(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_decimate: $(IDIR)/yapp_decimate.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_filter.o: $(SRCDIR)/yapp_filter.c $(SRCDIR)/yapp.h \
$(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_filter: $(IDIR)/yapp_filter.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_FFTW3) \
$(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_fold.o: $(SRCDIR)/yapp_fold.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_fold: $(IDIR)/yapp_fold.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_add.o: $(SRCDIR)/yapp_add.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_add: $(IDIR)/yapp_add.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_subtract.o: $(SRCDIR)/yapp_subtract.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_subtract: $(IDIR)/yapp_subtract.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_fits2fil.o: $(UTILDIR)/yapp_fits2fil.c $(UTILDIR)/yapp_fits2fil.h \
$(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h $(SRCDIR)/yapp_psrfits.h
$(CC) $(CFLAGS_C) -I$(SRCDIR) $(DDEBUG) $(DHDF5) $< -o $(UTILDIR)/$@
yapp_fits2fil: $(UTILDIR)/yapp_fits2fil.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_dat2tim.o: $(UTILDIR)/yapp_dat2tim.c $(UTILDIR)/yapp_dat2tim.h \
$(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) -I$(SRCDIR) $(DDEBUG) $(DHDF5) $< -o $(UTILDIR)/$@
yapp_dat2tim: $(UTILDIR)/yapp_dat2tim.o $(SRCDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_tim2dat.o: $(UTILDIR)/yapp_tim2dat.c $(UTILDIR)/yapp_tim2dat.h \
$(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) -I$(SRCDIR) $(DDEBUG) $(DHDF5) $< -o $(UTILDIR)/$@
yapp_tim2dat: $(UTILDIR)/yapp_tim2dat.o $(SRCDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
ifeq ($(HDF5), yes)
yapp_fil2h5.o: $(UTILDIR)/yapp_fil2h5.c $(UTILDIR)/yapp_fil2h5.h \
$(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) -I$(SRCDIR) $(DDEBUG) $(DHDF5) $< -o $(UTILDIR)/$@
else
yapp_fil2h5.o:
@echo "WARNING: yapp_fil2h5.o will not be compiled (HDF5=no)"
endif
ifeq ($(HDF5), yes)
yapp_fil2h5: $(UTILDIR)/yapp_fil2h5.o $(SRCDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
else
yapp_fil2h5:
@echo "WARNING: yapp_fil2h5 will not be compiled (HDF5=no)"
endif
yapp_siftpulses.o: $(SRCDIR)/yapp_siftpulses.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_siftpulses: $(IDIR)/yapp_siftpulses.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_stacktim.o: $(SRCDIR)/yapp_stacktim.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_stacktim: $(IDIR)/yapp_stacktim.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_split.o: $(SRCDIR)/yapp_split.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) $(DDEBUG) $(DHDF5) $< -o $(IDIR)/$@
yapp_split: $(IDIR)/yapp_split.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
yapp_ym2fil.o: $(UTILDIR)/yapp_ym2fil.c $(SRCDIR)/yapp.h $(SRCDIR)/yapp_sigproc.h
$(CC) $(CFLAGS_C) -I$(SRCDIR) $(DDEBUG) $(DHDF5) $< -o $(UTILDIR)/$@
yapp_ym2fil: $(UTILDIR)/yapp_ym2fil.o $(IDIR)/yapp_version.o \
$(IDIR)/yapp_erflookup.o $(IDIR)/yapp_common.o $(IDIR)/colourmap.o
$(CC) $^ $(LFLAGS_PGPLOT) $(LFLAGS_MATH) $(LFLAGS_CFITSIO) $(LFLAGS_HDF5) -o $(BINDIR)/$@
# install the man pages
install:
@echo Copying binaries...
cp $(BINDIR)/* $(BININSTALLDIR)
@echo DONE
@echo Copying scripts...
cp $(SCRIPTDIR)/* $(BININSTALLDIR)
@echo DONE
@echo Copying man pages...
mkdir -p $(MANINSTALLDIR)
cp $(MANDIR)/*.1 $(MANINSTALLDIR)
@echo DONE
clean:
$(DELCMD) $(SRCDIR)/yapp_version.c
$(DELCMD) $(IDIR)/yapp_version.o
$(DELCMD) $(IDIR)/yapp_erflookup.o
$(DELCMD) $(IDIR)/yapp_common.o
$(DELCMD) $(IDIR)/yapp_viewmetadata.o
$(DELCMD) $(IDIR)/colourmap.o
$(DELCMD) $(IDIR)/yapp_showinfo.o
$(DELCMD) $(IDIR)/yapp_viewdata.o
$(DELCMD) $(IDIR)/yapp_ft.o
$(DELCMD) $(IDIR)/yapp_dedisperse.o
$(DELCMD) $(IDIR)/yapp_smooth.o
$(DELCMD) $(IDIR)/yapp_decimate.o
$(DELCMD) $(IDIR)/yapp_filter.o
$(DELCMD) $(IDIR)/yapp_fold.o
$(DELCMD) $(IDIR)/yapp_add.o
$(DELCMD) $(UTILDIR)/yapp_fits2fil.o
$(DELCMD) $(UTILDIR)/yapp_dat2tim.o
$(DELCMD) $(UTILDIR)/yapp_tim2dat.o
ifeq ($(HDF5), yes)
$(DELCMD) $(UTILDIR)/yapp_fil2h5.o
endif
$(DELCMD) $(IDIR)/yapp_subtract.o
$(DELCMD) $(IDIR)/yapp_siftpulses.o
$(DELCMD) $(IDIR)/yapp_stacktim.o
$(DELCMD) $(IDIR)/yapp_split.o
$(DELCMD) $(UTILDIR)/yapp_ym2fil.o