1## Process this file with automake to produce Makefile.in 2## 3## Hand written file: used as input into Autotools. 4## This is part of GNU Astronomy Utilities (gnuastro). 5## 6## Original author: 7## Mohammad Akhlaghi <mohammad@akhlaghi.org> 8## Contributing author(s): 9## Copyright (C) 2015-2021, Free Software Foundation, Inc. 10## 11## Gnuastro is free software: you can redistribute it and/or modify it 12## under the terms of the GNU General Public License as published by 13## the Free Software Foundation, either version 3 of the License, or 14## (at your option) any later version. 15## 16## Gnuastro is distributed in the hope that it will be useful, but 17## WITHOUT ANY WARRANTY; without even the implied warranty of 18## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19## General Public License for more details. 20## 21## You should have received a copy of the GNU General Public License 22## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>. 23 24 25 26 27 28## Sources to be created before everything else 29## ============================================ 30## 31## These target(s) will be created before anything else when running 32## 'make', 'make check', or 'make install', see the "Built sources" section 33## of the AUTOMAKE manual and the git-version-gen script comments for more 34## information. Note that AUTHORS depends on '$(top_srcdir)/.version', and 35## '$(top_srcdir)/.version' depends on $(top_srcdir)/configure'. So any 36## time the version is updated, both of these will be re-built. But during 37## usual utility and library development, '$(top_srcdir)/configure' is not 38## commonly updated, so this will not slow down the process. 39BUILT_SOURCES = $(top_srcdir)/AUTHORS 40 41 42 43 44 45## Directories to check: 46## ===================== 47## 48## Gnulib is intentionally compiled and tested prior to the gnuastro 49## progams. With this configuration, the user can confirm if the 50## problem is internal to gnulib or still persists after all the 51## Gnulib tests have been done. 52if COND_ARITHMETIC 53 MAYBE_ARITHMETIC = bin/arithmetic 54 MAYBE_COMPLETE_ARITHMETIC = bin/arithmetic/astarithmetic-complete.bash 55endif 56if COND_BUILDPROG 57 MAYBE_BUILDPROG = bin/buildprog 58 MAYBE_COMPLETE_BUILDPROG = bin/buildprog/astbuildprog-complete.bash 59endif 60if COND_CONVERTT 61 MAYBE_CONVERTT = bin/convertt 62 MAYBE_COMPLETE_CONVERTT = bin/convertt/astconvertt-complete.bash 63endif 64if COND_CONVOLVE 65 MAYBE_CONVOLVE = bin/convolve 66 MAYBE_COMPLETE_CONVOLVE = bin/convolve/astconvolve-complete.bash 67endif 68if COND_COSMICCAL 69 MAYBE_COSMICCAL = bin/cosmiccal 70 MAYBE_COMPLETE_COSMICCAL = bin/cosmiccal/astcosmiccal-complete.bash 71endif 72if COND_CROP 73 MAYBE_CROP = bin/crop 74 MAYBE_COMPLETE_CROP = bin/crop/astcrop-complete.bash 75endif 76if COND_FITS 77 MAYBE_FITS = bin/fits 78 MAYBE_COMPLETE_FITS = bin/fits/astfits-complete.bash 79endif 80if COND_MATCH 81 MAYBE_MATCH = bin/match 82endif 83if COND_MKCATALOG 84 MAYBE_MKCATALOG = bin/mkcatalog 85endif 86if COND_MKNOISE 87 MAYBE_MKNOISE = bin/mknoise 88endif 89if COND_MKPROF 90 MAYBE_MKPROF = bin/mkprof 91endif 92if COND_NOISECHISEL 93 MAYBE_NOISECHISEL = bin/noisechisel 94endif 95if COND_QUERY 96 MAYBE_QUERY = bin/query 97endif 98if COND_SEGMENT 99 MAYBE_SEGMENT = bin/segment 100endif 101if COND_STATISTICS 102 MAYBE_STATISTICS = bin/statistics 103endif 104if COND_TABLE 105 MAYBE_TABLE = bin/table 106 MAYBE_COMPLETE_TABLE = bin/table/asttable-complete.bash 107endif 108#if COND_TEMPLATE 109# MAYBE_TEMPLATE = bin/TEMPLATE 110#endif 111if COND_WARP 112 MAYBE_WARP = bin/warp 113endif 114if COND_GNULIBCHECK 115 MAYBE_GNULIBCHECK = bootstrapped/tests 116endif 117 118 119 120 121 122## Subdirectories to build 123## ======================= 124## 125## Note that by default 'COND_TEMPLATE' is not set in configure, it is 126## commented, and exists only as a template for you to copy and paste to 127## name your new utility. The same rule is applied here (in the 'if' 128## conditions above). When 'MAYBE_TEMPLATE' is not defined, then Make will 129## see it as a blank string and igonore it, so there is no problem with 130## having an uncommented 'MAYBE_TEMPLATE' as a value in 'SUBDIRS'. 131SUBDIRS = bootstrapped/lib $(MAYBE_GNULIBCHECK) lib $(MAYBE_ARITHMETIC) \ 132 $(MAYBE_BUILDPROG) $(MAYBE_CONVERTT) $(MAYBE_CONVOLVE) \ 133 $(MAYBE_COSMICCAL) $(MAYBE_CROP) $(MAYBE_FITS) $(MAYBE_MATCH) \ 134 $(MAYBE_MKCATALOG) $(MAYBE_MKNOISE) $(MAYBE_MKPROF) $(MAYBE_NOISECHISEL) \ 135 $(MAYBE_QUERY) $(MAYBE_SEGMENT) $(MAYBE_STATISTICS) $(MAYBE_TABLE) \ 136 $(MAYBE_TEMPLATE) $(MAYBE_WARP) bin/script doc tests 137 138 139 140 141 142## Add m4/ to the list of directories to search for m4 files 143## ========================================================= 144ACLOCAL_AMFLAGS = -I bootstrapped/m4 145 146 147 148 149 150## Files that are installed (and distributed) 151## ========================================= 152dist_doc_DATA = README 153 154 155 156 157 158# Installed system configuration files 159# ==================================== 160dist_sysconf_DATA = bin/gnuastro.conf 161 162 163 164 165 166## Files that are only distributed 167## =============================== 168## 169## Note that 'COPYING' (containing the GNU GPL) is included in the 170## distribution tarball by default in Automake, but not other license 171## files, so we have to manually add 'COPYING.FDL'. 172## 173## The completion files for each program ('*-complete.bash') are added to 174## EXTRA_DIST within each program's directory. 175EXTRA_DIST = COPYING.FDL genauthors .dir-locals.el .version \ 176 developer-build bootstrapped/README .autom4te.cfg \ 177 bin/completion.bash.in 178 179 180 181 182 183# Files that must be cleaned 184# ========================== 185# 186# When the user runs 'make clean' no built products should remain. Since 187# the Bash TAB completion feature is not a standard C program, we need to 188# specify the files to clean manually. 189CLEANFILES = bin/completion.bash bin/completion.bash.built 190 191 192 193 194 195## Bash auto-completion 196## ==================== 197## 198## Besides the default '.bash.in' files, for some programs (like 199## Arithmetic), its necessary to parse the source (for list of all 200## operators). 201pkgdata_DATA = bin/completion.bash 202bin/completion.bash: $(top_srcdir)/bin/completion.bash.in 203 # Delete any existing output file. 204 rm -f $@ $@.built $@.tmp 205 206 # Extract the arithmetic library operators into a '.built' file. 207 echo "" >> $@.built 208 for op in $$($(AWK) '/^gal_arithmetic_operator_string/{parse=1} \ 209 /^\}/{parse=0} \ 210 parse==1 && /GAL_ARITHMETIC_OP/{print $$NF}' \ 211 $(top_srcdir)/lib/arithmetic.c \ 212 | $(SED) -e's|"||g' -e's|;||'); do \ 213 ops="$$ops $$op"; \ 214 done; \ 215 echo "_gnuastro_autocomplete_compreply_arithmetic_lib(){" >> $@.built; \ 216 echo "arithmetic_lib_operators=\"$$ops\"" >> $@.built; \ 217 echo "}" >> $@.built 218 219 # Extract the arithmetic program operators into the '.built' file. 220 echo "" >> $@.built 221 for op in $$($(AWK) '/^arithmetic_set_operator/{parse=1} \ 222 /^\}/{parse=0} \ 223 parse==1 && /strcmp\(string/{print $$NF}' \ 224 $(top_srcdir)/bin/arithmetic/arithmetic.c \ 225 | $(SED) -e's|"||g' -e's|))||'); do \ 226 ops="$$ops $$op"; \ 227 done; \ 228 echo "_gnuastro_autocomplete_compreply_arithmetic_prog(){" >> $@.built; \ 229 echo "arithmetic_prog_operators=\"$$ops\"" >> $@.built; \ 230 echo "}" >> $@.built 231 232 # Extract recognized file-format suffixes. 233 for form in jpeg tiff; do \ 234 sufs=""; \ 235 echo "" >> $@.built; \ 236 for suf in $$($(AWK) '/^gal_'$$form'_name_is_'$$form'/{parse=1} \ 237 /^\}/{parse=0} \ 238 parse==1 && /strcmp\(&name/{ \ 239 for(i=1;i<=NF;++i) if($$i ~ /^"/) print $$i; \ 240 }' $(top_srcdir)/lib/$$form.c \ 241 | $(SED) -e's|"||g' -e's|)||g'); do \ 242 sufs="$$sufs $$suf"; \ 243 done; \ 244 echo "_gnuastro_autocomplete_compreply_suffixes_$$form(){" >> $@.built; \ 245 echo "suffixes_$$form=\"$$sufs\"" >> $@.built; \ 246 echo "}" >> $@.built; \ 247 done 248 249 # Extract color-map values for ConvertType. 250 vals="" 251 echo "" >> $@.built 252 for val in $$($(AWK) '/^ui_colormap_sanity_check/{parse=1} \ 253 /^\}/{parse=0} \ 254 parse==1 && /strcmp\(strarr/{ \ 255 for(i=1;i<=NF;++i) if($$i ~ /^"/) { \ 256 print $$i; break} \ 257 }' $(top_srcdir)/bin/convertt/ui.c \ 258 | $(SED) -e's|"||g' -e's|)\+||'); do \ 259 vals="$$vals $$val"; \ 260 done; \ 261 echo "_gnuastro_autocomplete_compreply_convertt_colormap(){" >> $@.built; \ 262 echo "convertt_colormaps=\"$$vals\"" >> $@.built; \ 263 echo "}" >> $@.built 264 265 # Extract the spectral line names for CosmicCalculator. 266 names="" 267 echo "" >> $@.built 268 for name in $$($(AWK) '/GAL_SPECLINES_NAME/{print $$NF}' \ 269 $(top_srcdir)/lib/gnuastro/speclines.h \ 270 | $(SED) -e's|"||g'); do \ 271 names="$$names $$name"; \ 272 done; \ 273 echo "_gnuastro_autocomplete_compreply_specline_names(){" >> $@.built; \ 274 echo "specline_names=\"$$names\"" >> $@.built; \ 275 echo "}" >> $@.built 276 277 # Extract the WCS coordinate system strings for Fits. 278 vals="" 279 echo "" >> $@.built 280 for val in $$($(AWK) '/^gal_wcs_coordsys_from_string/{parse=1} \ 281 /^\}/{parse=0} \ 282 parse==1 && /strcmp\(coordsys/{ \ 283 for(i=1;i<=NF;++i) if($$i ~ /"/) { \ 284 print $$i; break} \ 285 }' $(top_srcdir)/lib/wcs.c \ 286 | $(SED) -e's|"||g' -e's|)||' \ 287 | $(AWK) 'BEGIN{FS=","} {print $$NF}' ); do \ 288 vals="$$vals $$val"; \ 289 done; \ 290 echo "_gnuastro_autocomplete_compreply_wcs_coordsys(){" >> $@.built; \ 291 echo "wcs_coordsys=\"$$vals\"" >> $@.built; \ 292 echo "}" >> $@.built 293 294 # Copy the low-level common functions to all programs, then put the 295 # arithmetic functions inside of it. We are keeping the arithmetic 296 # operators separate to help in debugging when necessary (they can 297 # be 'source'd into each program's completion script). 298 cat $(top_srcdir)/bin/completion.bash.in $@.built > $@.tmp 299 300 # Copy each program's source. 301 for f in $(MAYBE_COMPLETE_ARITHMETIC) \ 302 $(MAYBE_COMPLETE_BUILDPROG) \ 303 $(MAYBE_COMPLETE_CONVERTT) \ 304 $(MAYBE_COMPLETE_CONVOLVE) \ 305 $(MAYBE_COMPLETE_COSMICCAL) \ 306 $(MAYBE_COMPLETE_CROP) \ 307 $(MAYBE_COMPLETE_FITS) \ 308 $(MAYBE_COMPLETE_TABLE); do \ 309 $(SED) -e 's|@PREFIX[@]|$(bindir)|g' $(top_srcdir)/$$f >> $@.tmp; \ 310 done 311 chmod a-w $@.tmp 312 mv $@.tmp $@ 313 314 315 316 317 318## Print the completion messages 319## ============================= 320## 321## After the jobs in all the subdirectories are done, print the following 322## messages to confirm that everything is complete and guide the users on 323## what they should do next. 324## 325## When running ./configure, the user can opt-out of these messages using 326## the GUIDEMESSAGE variable that is set when they run ./configure with the 327## '--distable-guide-message' option. 328## 329## Note that all-local is a prerequisite of 'make check' too, so we will 330## only print its message when 'make' was called with no options. Make will 331## set MAKECMDGOALS to blank if there are no arguments, however, the way 332## Automake works, its value is set to "all-am". 333## 334## 'bin/completion.bash' has been set as a pre-requisite of this because if 335## we don't do this, the completion script will be created after printing 336## the message (making the message hard to notice for a user). 337all-local: bin/completion.bash 338 339 # If we are in static linking mode, correct the 'dependency_libs' 340 # variable of 'libgnuastro.la'. Because by default it will not 341 # include static libraries! 342 @if [ "X$(MAKECMDGOALS)" = "Xall-am" ] && [ "X$(ENABLE_SHARED)" = "Xno" ]; then \ 343 $(AWK) '/^dependency_libs/{print "dependency_libs='\''$(CONFIG_LDADD)'\''"} \ 344 !/^dependency_libs/{print}' $(top_builddir)/lib/libgnuastro.la \ 345 > $(top_builddir)/lib/libgnuastro_tmp.la; \ 346 mv $(top_builddir)/lib/libgnuastro_tmp.la \ 347 $(top_builddir)/lib/libgnuastro.la; \ 348 fi 349 350 # Print a message if requested. 351 @if [ "X$(MAKECMDGOALS)" = "Xall-am" ] && [ x$(GUIDEMESSAGE) = xyes ]; then \ 352 echo; \ 353 echo "==================================================================="; \ 354 echo "==================================================================="; \ 355 echo "Gnuastro $(VERSION), was successfully built."; \ 356 echo "Please check the build on your system by running:"; \ 357 echo; \ 358 echo " make check -j8"; \ 359 echo; \ 360 echo "(You can change the 8 to the number of CPU threads available.)"; \ 361 echo "(The following \"Leaving directory\" notices can be ignored.)"; \ 362 echo "==================================================================="; \ 363 echo "==================================================================="; \ 364 echo; \ 365 fi 366 367 368 369 370 371## We cannot do the writing persmission test at configure time. Here is a 372## quote from the generated ./configure script: The prefix variables... 373## 374## "... are left unexpanded so users can "make install exec_prefix=/foo" 375## and all the variables that are supposed to be based on exec_prefix by 376## default will actually change." 377## 378## So actually, they can also do that after 'make check'. Usually 379## professional users would want to do such a thing, so they can ignore the 380## NOTE. This note is mostly for beginners and it is not written to convey 381## that this is the ONLY solution. 382check-local: 383 @if [ x$(GUIDEMESSAGE) = xyes ]; then \ 384 echo; \ 385 echo "==================================================================="; \ 386 echo "==================================================================="; \ 387 echo "Your build of Gnuastro $(VERSION) didn't fail on any tests."; \ 388 echo "To install Gnuastro, please run the command(s) below:"; \ 389 echo; \ 390 if [ ! -w $(prefix) ] ; then \ 391 echo "(NOTE: As the user $$USER, you don't have writing permissions"; \ 392 echo "in \"$(prefix)\". To install Gnuastro there, you must get "; \ 393 echo "privileges first, as described below. If you can't, configure "; \ 394 echo "Gnuastro again, for example: \"./configure --prefix ~/.local\".)"; \ 395 echo; \ 396 echo " sudo make install"; \ 397 echo "or"; \ 398 echo " su"; \ 399 fi; \ 400 echo " make install"; \ 401 if [ ! -w $(prefix) ] ; then \ 402 echo " exit"; \ 403 fi; \ 404 echo; \ 405 echo "(The following \"Leaving directory\" notices can be ignored.)"; \ 406 echo "==================================================================="; \ 407 echo "==================================================================="; \ 408 echo; \ 409 fi 410 411 412 413 414 415## Note that the '\' characters in the GNU head here are not printed on the 416## command line. So we have to consider them. The ASCII GNU head is taken 417## from: https://www.gnu.org/graphics/gnu-ascii.html 418install-data-hook: 419 @if [ x$(GUIDEMESSAGE) = xyes ]; then \ 420 echo; \ 421 echo "==================================================================="; \ 422 echo "==================================================================="; \ 423 echo " , , "; \ 424 echo " / \ "; \ 425 echo " ((__-^^-,-^^-__)) Congratulations!"; \ 426 echo " \`-_---' \`---_-' GNU Astronomy Utilities (Gnuastro),"; \ 427 echo " \`--|o\` 'o|--' Version $(VERSION)"; \ 428 echo " \ \` / "; \ 429 echo " ): :( Successfully installed on this system."; \ 430 echo " :o_o: "; \ 431 echo " \"-\" "; \ 432 echo; \ 433 echo "More information Command to run "; \ 434 echo "---------------- -------------- "; \ 435 echo "Complete official Gnuastro book: ' info gnuastro '"; \ 436 echo "Entertaining tutorials: ' info gnuastro Tutorials '"; \ 437 echo "Dedicated help mailing list: ' info help-gnuastro '"; \ 438 echo "Instructions for reporting bugs: ' info bug-gnuastro '"; \ 439 echo "Effectively use Info: ' info info '"; \ 440 echo; \ 441 echo; \ 442 echo "Environment variables to check: "; \ 443 echo " - '$(prefix)/bin' in PATH."; \ 444 echo " - '$(prefix)/lib' in LD_LIBRARY_PATH."; \ 445 echo "(for an intro, run 'info gnuastro \"Installation directory\"')"; \ 446 echo; \ 447 echo; \ 448 echo "Bash completion (auto-fill arguments and options with TAB):"; \ 449 echo " - 'source $(pkgdatadir)/completion.bash' in '~/.bashrc':"; \ 450 echo; \ 451 echo; \ 452 echo "To stay up to date with future releases, please subscribe to: "; \ 453 echo " https://lists.gnu.org/mailman/listinfo/info-gnuastro"; \ 454 echo; \ 455 echo; \ 456 echo "(Any lines following this message can be ignored.)"; \ 457 echo "==================================================================="; \ 458 echo "==================================================================="; \ 459 echo; \ 460 fi 461 462 463 464 465 466## $(top_srcdir)/.version 467## ====================== 468## 469## This file is created from the $(VERSION) variable which was defined by 470## the 'git-version-gen' script (located at address below), which is run 471## when the '$(top_srcdir)/configure' script is being built by Autoconf. 472## 473## $(top_srcdir)/bootstrapped/build-aux/git-version-gen 474## 475## Note that contrary to what is proposed by 'git-version-gen', here the 476## creation of '$(top_srcdir)/.version' depends on the 477## '$(top_srcdir)/configure' script. Therefore, anytime a the VERSION 478## variable is updated there, '$(top_srcdir)/.version' is also 479## updated. During development, of the main functionality of Gnuastro 480## (utilities and libraries), the '$(top_srcdir/configure' script is rarely 481## updated, so '$(top_srcdir)/.version' will not be rebuilt and thus it 482## won't harm the speed of tests during development. 483$(top_srcdir)/.version: $(top_srcdir)/configure 484 echo $(VERSION) > $@-t && mv $@-t $@ 485 486 487 488 489 490## $(top_srcdir)/AUTHORS 491## ===================== 492## 493## This file is generated automatically from the version controlled 494## history. Note the following: 495## 496## - '$(top_srcdir)/AUTHORS' is defined as a BUILT_SOURCES variable, so 497## it is the first thing that is built (even in multi-threaded runs). 498## 499## - '$(top_srcdir)/AUTHORS' is updated only when 500## '$(top_srcdir)/.version' is updated. '$(top_srcdir)/.version' its 501## self is only updated when '$(top_srcdir)/configure' is updated. But 502## generally, the '$(top_srcdir)/configure' script is not updated 503## regularly during development and outside of version control. 504## 505## - The '$(top_srcdir)/genauthors' script will not do anything 506## (make/update the '$(top_srcdir)AUTHORS' file) when there is no git 507## repository. '$(top_srcdir)/AUTHORS' is only necessary when building 508## a tarball distribution. 509$(top_srcdir)/AUTHORS: $(top_srcdir)/.version 510 $(top_srcdir)/genauthors $(top_srcdir) 511 512 513 514 515 516## Run when building a distribution 517## ================================ 518## 519## These targets will be created when building a (tarball) 520## distribution. Note that AUTHORS depends on '.version'. 521dist-hook: $(top_srcdir)/AUTHORS 522 echo $(VERSION) > $(distdir)/.tarball-version 523 524 525 526 527## Nice joke 528## ========= 529## 530## This joke is taken from the "The art of unix programming", and a quote 531## by Stuart Feldman (creator of Make): "One of the older Unix jokes is 532## "Make love" which results in "Don’t know how to make love"." 533love: 534 @echo "Don't know how to make love!" 535