-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
569 lines (479 loc) · 22.8 KB
/
Makefile.am
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
## Process this file with automake to produce Makefile.in
##
## Hand written file: used as input into Autotools.
## This is part of GNU Astronomy Utilities (gnuastro).
##
## Original author:
## Mohammad Akhlaghi <[email protected]>
## Contributing author(s):
## Copyright (C) 2015-2024 Free Software Foundation, Inc.
##
## Gnuastro is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## Gnuastro is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
## Sources to be created before everything else
## ============================================
##
## These target(s) will be created before anything else when running
## 'make', 'make check', or 'make install', see the "Built sources" section
## of the AUTOMAKE manual and the git-version-gen script comments for more
## information. Note that AUTHORS depends on '$(top_srcdir)/.version', and
## '$(top_srcdir)/.version' depends on $(top_srcdir)/configure'. So any
## time the version is updated, both of these will be re-built. But during
## usual utility and library development, '$(top_srcdir)/configure' is not
## commonly updated, so this will not slow down the process.
BUILT_SOURCES = $(top_srcdir)/AUTHORS
## Directories to check:
## =====================
##
## Gnulib is intentionally compiled and tested prior to the gnuastro
## progams. With this configuration, the user can confirm if the
## problem is internal to gnulib or still persists after all the
## Gnulib tests have been done.
if COND_ARITHMETIC
MAYBE_ARITHMETIC = bin/arithmetic
MAYBE_COMPLETE_ARITHMETIC = bin/arithmetic/astarithmetic-complete.bash
endif
if COND_BUILDPROG
MAYBE_BUILDPROG = bin/buildprog
MAYBE_COMPLETE_BUILDPROG = bin/buildprog/astbuildprog-complete.bash
endif
if COND_CONVERTT
MAYBE_CONVERTT = bin/convertt
MAYBE_COMPLETE_CONVERTT = bin/convertt/astconvertt-complete.bash
endif
if COND_CONVOLVE
MAYBE_CONVOLVE = bin/convolve
MAYBE_COMPLETE_CONVOLVE = bin/convolve/astconvolve-complete.bash
endif
if COND_COSMICCAL
MAYBE_COSMICCAL = bin/cosmiccal
MAYBE_COMPLETE_COSMICCAL = bin/cosmiccal/astcosmiccal-complete.bash
endif
if COND_CROP
MAYBE_CROP = bin/crop
MAYBE_COMPLETE_CROP = bin/crop/astcrop-complete.bash
endif
if COND_FITS
MAYBE_FITS = bin/fits
MAYBE_COMPLETE_FITS = bin/fits/astfits-complete.bash
endif
if COND_MATCH
MAYBE_MATCH = bin/match
endif
if COND_MKCATALOG
MAYBE_MKCATALOG = bin/mkcatalog
endif
if COND_MKPROF
MAYBE_MKPROF = bin/mkprof
endif
if COND_NOISECHISEL
MAYBE_NOISECHISEL = bin/noisechisel
endif
if COND_QUERY
MAYBE_QUERY = bin/query
endif
if COND_SEGMENT
MAYBE_SEGMENT = bin/segment
endif
if COND_STATISTICS
MAYBE_STATISTICS = bin/statistics
endif
if COND_TABLE
MAYBE_TABLE = bin/table
MAYBE_COMPLETE_TABLE = bin/table/asttable-complete.bash
endif
#if COND_TEMPLATE
# MAYBE_TEMPLATE = bin/TEMPLATE
#endif
if COND_WARP
MAYBE_WARP = bin/warp
endif
if COND_GNULIBCHECK
MAYBE_GNULIBCHECK = bootstrapped/tests
endif
## Subdirectories to build
## =======================
## In the list below, ORDER MATTERS:
## 1. Build Gnulib (and its tests if requested)
## 2. Build Gnuastro's library.
## 3. Build the programs (order doesn't matter within the programs, so
## they are sorted alphabetically).
## 4. Build the installed scripts.
## 5. Build the documentation.
## 6. Build the tests.
#
## Note that by default 'COND_TEMPLATE' is not set in configure, it is
## commented, and exists only as a template for you to copy and paste to
## name your new utility. The same rule is applied here (in the 'if'
## conditions above). When 'MAYBE_TEMPLATE' is not defined, then Make will
## see it as a blank string and igonore it, so there is no problem with
## having an uncommented 'MAYBE_TEMPLATE' as a value in 'SUBDIRS'.
SUBDIRS = bootstrapped/lib \
$(MAYBE_GNULIBCHECK) \
lib \
$(MAYBE_ARITHMETIC) \
$(MAYBE_BUILDPROG) \
$(MAYBE_CONVERTT) \
$(MAYBE_CONVOLVE) \
$(MAYBE_COSMICCAL) \
$(MAYBE_CROP) \
$(MAYBE_FITS) \
$(MAYBE_MATCH) \
$(MAYBE_MKCATALOG) \
$(MAYBE_MKPROF) \
$(MAYBE_NOISECHISEL) \
$(MAYBE_QUERY) \
$(MAYBE_SEGMENT) \
$(MAYBE_STATISTICS) \
$(MAYBE_TABLE) \
$(MAYBE_TEMPLATE) \
$(MAYBE_WARP) \
bin/script \
doc \
tests
## Add m4/ to the list of directories to search for m4 files
## =========================================================
ACLOCAL_AMFLAGS = -I bootstrapped/m4
## Files that are installed (and distributed)
## =========================================
dist_doc_DATA = README
# Installed system configuration files
# ====================================
pkgsysconfdir = $(sysconfdir)/$(PACKAGE)
dist_pkgsysconf_DATA = bin/gnuastro.conf
## Files that are only distributed
## ===============================
##
## Note that 'COPYING' (containing the GNU GPL) is included in the
## distribution tarball by default in Automake, but not other license
## files, so we have to manually add 'COPYING.FDL'.
##
## The completion files for each program ('*-complete.bash') are added to
## EXTRA_DIST within each program's directory.
EXTRA_DIST = COPYING.FDL genauthors .dir-locals.el .version \
developer-build bootstrapped/README .autom4te.cfg \
bin/completion.bash.in
# Files that must be cleaned
# ==========================
#
# When the user runs 'make clean' no built products should remain. Since
# the Bash TAB completion feature is not a standard C program, we need to
# specify the files to clean manually.
CLEANFILES = bin/completion.bash bin/completion.bash.built
## Bash auto-completion
## ====================
##
## Besides the default '.bash.in' files, for some programs (like
## Arithmetic), its necessary to parse the source (for list of all
## operators).
pkgdata_DATA = bin/completion.bash
bin/completion.bash: $(top_srcdir)/bin/completion.bash.in
# Delete any existing output file.
rm -f $@ [email protected] [email protected]
# Extract the arithmetic library operators into a '.built' file.
echo "" >> [email protected]
for op in $$($(AWK) '/^gal_arithmetic_operator_string/{parse=1} \
/^\}/{parse=0} \
parse==1 && /GAL_ARITHMETIC_OP/{print $$NF}' \
$(top_srcdir)/lib/arithmetic.c \
| $(SED) -e's|"||g' -e's|;||'); do \
ops="$$ops $$op"; \
done; \
echo "_gnuastro_autocomplete_compreply_arithmetic_lib(){" >> [email protected]; \
echo "arithmetic_lib_operators=\"$$ops\"" >> [email protected]; \
echo "}" >> [email protected]
# Extract the arithmetic program operators into the '.built' file.
echo "" >> [email protected]
for op in $$($(AWK) '/^arithmetic_set_operator/{parse=1} \
/^\}/{parse=0} \
parse==1 && /strcmp\(string/{print $$NF}' \
$(top_srcdir)/bin/arithmetic/arithmetic.c \
| $(SED) -e's|"||g' -e's|))||'); do \
ops="$$ops $$op"; \
done; \
echo "_gnuastro_autocomplete_compreply_arithmetic_prog(){" >> [email protected]; \
echo "arithmetic_prog_operators=\"$$ops\"" >> [email protected]; \
echo "}" >> [email protected]
# Extract recognized file-format suffixes.
for form in jpeg tiff; do \
sufs=""; \
echo "" >> [email protected]; \
for suf in $$($(AWK) '/^gal_'$$form'_name_is_'$$form'/{parse=1} \
/^\}/{parse=0} \
parse==1 && /strcmp\(&name/{ \
for(i=1;i<=NF;++i) if($$i ~ /^"/) print $$i; \
}' $(top_srcdir)/lib/$$form.c \
| $(SED) -e's|"||g' -e's|)||g'); do \
sufs="$$sufs $$suf"; \
done; \
echo "_gnuastro_autocomplete_compreply_suffixes_$$form(){" >> [email protected]; \
echo "suffixes_$$form=\"$$sufs\"" >> [email protected]; \
echo "}" >> [email protected]; \
done
# Extract color-map values for ConvertType.
vals=""
echo "" >> [email protected]
for val in $$($(AWK) '/^ui_colormap_sanity_check/{parse=1} \
/^\}/{parse=0} \
parse==1 && /strcmp\(strarr/{ \
for(i=1;i<=NF;++i) if($$i ~ /^"/) { \
print $$i; break} \
}' $(top_srcdir)/bin/convertt/ui.c \
| $(SED) -e's|"||g' -e's|)\+||'); do \
vals="$$vals $$val"; \
done; \
echo "_gnuastro_autocomplete_compreply_convertt_colormap(){" >> [email protected]; \
echo "convertt_colormaps=\"$$vals\"" >> [email protected]; \
echo "}" >> [email protected]
# Extract the spectral line names for CosmicCalculator.
names=""
echo "" >> [email protected]
for name in $$($(AWK) '/GAL_SPECLINES_NAME/{print $$NF}' \
$(top_srcdir)/lib/gnuastro/speclines.h \
| $(SED) -e's|"||g'); do \
names="$$names $$name"; \
done; \
echo "_gnuastro_autocomplete_compreply_specline_names(){" >> [email protected]; \
echo "specline_names=\"$$names\"" >> [email protected]; \
echo "}" >> [email protected]
# Extract the WCS coordinate system strings for Fits.
vals=""
echo "" >> [email protected]
for val in $$($(AWK) '/^gal_wcs_coordsys_from_string/{parse=1} \
/^\}/{parse=0} \
parse==1 && /strcmp\(coordsys/{ \
for(i=1;i<=NF;++i) if($$i ~ /"/) { \
print $$i; break} \
}' $(top_srcdir)/lib/wcs.c \
| $(SED) -e's|"||g' -e's|)||' \
| $(AWK) 'BEGIN{FS=","} {print $$NF}' ); do \
vals="$$vals $$val"; \
done; \
echo "_gnuastro_autocomplete_compreply_wcs_coordsys(){" >> [email protected]; \
echo "wcs_coordsys=\"$$vals\"" >> [email protected]; \
echo "}" >> [email protected]
# Copy the low-level common functions to all programs, then put the
# arithmetic functions inside of it. We are keeping the arithmetic
# operators separate to help in debugging when necessary (they can
# be 'source'd into each program's completion script).
cat $(top_srcdir)/bin/completion.bash.in [email protected] > [email protected]
# Copy each program's source.
for f in $(MAYBE_COMPLETE_ARITHMETIC) \
$(MAYBE_COMPLETE_BUILDPROG) \
$(MAYBE_COMPLETE_CONVERTT) \
$(MAYBE_COMPLETE_CONVOLVE) \
$(MAYBE_COMPLETE_COSMICCAL) \
$(MAYBE_COMPLETE_CROP) \
$(MAYBE_COMPLETE_FITS) \
$(MAYBE_COMPLETE_TABLE); do \
$(SED) -e 's|@PREFIX[@]|$(bindir)|g' $(top_srcdir)/$$f >> [email protected]; \
done
chmod a-w [email protected]
mv [email protected] $@
## Print the completion messages
## =============================
##
## After the jobs in all the subdirectories are done, print the following
## messages to confirm that everything is complete and guide the users on
## what they should do next.
##
## When running ./configure, the user can opt-out of these messages using
## the GUIDEMESSAGE variable that is set when they run ./configure with the
## '--distable-guide-message' option.
##
## Note that all-local is a prerequisite of 'make check' too, so we will
## only print its message when 'make' was called with no options. Make will
## set MAKECMDGOALS to blank if there are no arguments, however, the way
## Automake works, its value is set to "all-am".
##
## 'bin/completion.bash' has been set as a pre-requisite of this because if
## we don't do this, the completion script will be created after printing
## the message (making the message hard to notice for a user).
all-local: bin/completion.bash
# If we are in static linking mode, correct the 'dependency_libs'
# variable of 'libgnuastro.la'. Because by default it will not
# include static libraries!
@if [ "X$(MAKECMDGOALS)" = "Xall-am" ] && [ "X$(ENABLE_SHARED)" = "Xno" ]; then \
$(AWK) '/^dependency_libs/{print "dependency_libs='\''$(CONFIG_LDADD)'\''"} \
!/^dependency_libs/{print}' $(top_builddir)/lib/libgnuastro.la \
> $(top_builddir)/lib/libgnuastro_tmp.la; \
mv $(top_builddir)/lib/libgnuastro_tmp.la \
$(top_builddir)/lib/libgnuastro.la; \
fi
# Print a message if requested.
@if [ "X$(MAKECMDGOALS)" = "Xall-am" ] && [ x$(GUIDEMESSAGE) = xyes ]; then \
echo; \
echo "==================================================================="; \
echo "==================================================================="; \
echo "Gnuastro $(VERSION), was successfully built."; \
echo "Please check the build on your system by running:"; \
echo; \
echo " make check -j$(SUGGESTEDJOBS)"; \
echo; \
echo "(You can change the $(SUGGESTEDJOBS) to any number of CPU threads.)"; \
echo "(The following \"Leaving directory\" notices can be ignored.)"; \
echo "==================================================================="; \
echo "==================================================================="; \
echo; \
fi
## We cannot do the writing persmission test at configure time. Here is a
## quote from the generated ./configure script: The prefix variables...
##
## "... are left unexpanded so users can "make install exec_prefix=/foo"
## and all the variables that are supposed to be based on exec_prefix by
## default will actually change."
##
## So actually, they can also do that after 'make check'. Usually
## professional users would want to do such a thing, so they can ignore the
## NOTE. This note is mostly for beginners and it is not written to convey
## that this is the ONLY solution.
check-local:
@if [ x$(GUIDEMESSAGE) = xyes ]; then \
echo; \
echo "==================================================================="; \
echo "==================================================================="; \
echo "Your build of Gnuastro $(VERSION) didn't fail on any tests."; \
echo "To install Gnuastro, please run the command(s) below:"; \
echo; \
if [ ! -w $(prefix) ] ; then \
echo "(NOTE: As the user $$USER, you don't have writing permissions"; \
echo "in \"$(prefix)\". To install Gnuastro there, you must get "; \
echo "privileges first, as described below. If you can't, configure "; \
echo "Gnuastro again, for example: \"./configure --prefix ~/.local\".)"; \
echo; \
echo " sudo make install"; \
echo "or"; \
echo " su"; \
fi; \
echo " make install"; \
if [ ! -w $(prefix) ] ; then \
echo " exit"; \
fi; \
echo; \
echo "(The following \"Leaving directory\" notices can be ignored.)"; \
echo "==================================================================="; \
echo "==================================================================="; \
echo; \
fi
## Note that the '\' characters in the GNU head here are not printed on the
## command line. So we have to consider them. The ASCII GNU head is taken
## from: https://www.gnu.org/graphics/gnu-ascii.html
install-data-hook:
@if [ x$(GUIDEMESSAGE) = xyes ]; then \
echo; \
echo "==================================================================="; \
echo "==================================================================="; \
echo " , , "; \
echo " / \ "; \
echo " ((__-^^-,-^^-__)) Congratulations!"; \
echo " \`-_---' \`---_-' GNU Astronomy Utilities (Gnuastro),"; \
echo " \`--|o\` 'o|--' Version $(VERSION)"; \
echo " \ \` / "; \
echo " ): :( Successfully installed on this system."; \
echo " :o_o: "; \
echo " \"-\" "; \
echo; \
echo "More information Command to run "; \
echo "---------------- -------------- "; \
echo "Complete official Gnuastro book: ' info gnuastro '"; \
echo "Entertaining tutorials: ' info gnuastro Tutorials '"; \
echo "Dedicated help mailing list: ' info help-gnuastro '"; \
echo "Instructions for reporting bugs: ' info bug-gnuastro '"; \
echo "Effectively use Info: ' info info '"; \
echo; \
echo; \
echo "Environment variables to check: "; \
echo " - '$(prefix)/bin' in PATH."; \
echo " - '$(prefix)/lib' in LD_LIBRARY_PATH."; \
echo "(for an intro, run 'info gnuastro \"Installation directory\"')"; \
echo; \
echo; \
echo "Customization scripts for manual installation:"; \
echo " - Open FITS files in DS9 or TOPCAT depending on contents by "; \
echo " double-clicking on the selected file(s), usable in GNOME, KDE, "; \
echo " or Xfce (freedesktop.org standards):"; \
echo " - ln -sf $(pkgdatadir)/astscript-fits-view.desktop ~/.local/share/applications/";\
echo " - Right-click on a FITS file, and follow these menus:"; \
echo " --> Open with other application"; \
echo " --> View all applications"; \
echo " --> astscript-fits-view"; \
echo; \
echo; \
echo "To stay up to date with future releases, please subscribe to: "; \
echo " https://lists.gnu.org/mailman/listinfo/info-gnuastro"; \
echo; \
echo; \
echo "(Any lines following this message can be ignored.)"; \
echo "==================================================================="; \
echo "==================================================================="; \
echo; \
fi
# Ignored from 'install-data-hook' to avoid confusing users (due to
# https://savannah.gnu.org/bugs/?60618 )
# echo " - Bash completion (auto-fill arguments and options with TAB):";
# echo " 'source $(pkgdatadir)/completion.bash' in '~/.bashrc':";
## $(top_srcdir)/.version
## ======================
##
## This file is created from the $(VERSION) variable which was defined by
## the 'git-version-gen' script (located at address below), which is run
## when the '$(top_srcdir)/configure' script is being built by Autoconf.
##
## $(top_srcdir)/bootstrapped/build-aux/git-version-gen
##
## Note that contrary to what is proposed by 'git-version-gen', here the
## creation of '$(top_srcdir)/.version' depends on the
## '$(top_srcdir)/configure' script. Therefore, anytime a the VERSION
## variable is updated there, '$(top_srcdir)/.version' is also
## updated. During development, of the main functionality of Gnuastro
## (utilities and libraries), the '$(top_srcdir/configure' script is rarely
## updated, so '$(top_srcdir)/.version' will not be rebuilt and thus it
## won't harm the speed of tests during development.
$(top_srcdir)/.version: $(top_srcdir)/configure
echo $(VERSION) > $@-t && mv $@-t $@
## $(top_srcdir)/AUTHORS
## =====================
##
## This file is generated automatically from the version controlled
## history. Note the following:
##
## - '$(top_srcdir)/AUTHORS' is defined as a BUILT_SOURCES variable, so
## it is the first thing that is built (even in multi-threaded runs).
##
## - '$(top_srcdir)/AUTHORS' is updated only when
## '$(top_srcdir)/.version' is updated. '$(top_srcdir)/.version' its
## self is only updated when '$(top_srcdir)/configure' is updated. But
## generally, the '$(top_srcdir)/configure' script is not updated
## regularly during development and outside of version control.
##
## - The '$(top_srcdir)/genauthors' script will not do anything
## (make/update the '$(top_srcdir)AUTHORS' file) when there is no git
## repository. '$(top_srcdir)/AUTHORS' is only necessary when building
## a tarball distribution.
$(top_srcdir)/AUTHORS: $(top_srcdir)/.version
$(top_srcdir)/genauthors $(top_srcdir)
## Run when building a distribution
## ================================
##
## These targets will be created when building a (tarball)
## distribution. Note that AUTHORS depends on '.version'.
dist-hook: $(top_srcdir)/AUTHORS
echo $(VERSION) > $(distdir)/.tarball-version
## Nice joke
## =========
##
## This joke is taken from the "The art of unix programming", and a quote
## by Stuart Feldman (creator of Make): "One of the older Unix jokes is
## "Make love" which results in "Don’t know how to make love"."
love:
@echo "Don't know how to make love!"