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
|
#-----------------------------------------------------------------------------
# Variable definitions for various combinations of architecture, operating
# system, compiler, and purpose. Used for development and testing only, not
# required for building WCSLIB.
#
# Definitions in this file are only used when running 'configure'. Variables
# such as CC and CFLAGS are exported to the environment so that they will be
# seen by 'configure' and from there passed to makedefs. Thus, normal usage
# is as follows:
#
# make distclean
# make FLAVOUR=dev configure
#
# At that point the definitions here should have propagated to makedefs.
#
# WARNING: configure may ignore compiler options added to the CC or F77
# environment variables. They must be added to CFLAGS or FFLAGS.
#
# Reminder: add '-d' to FLFLAGS for debugging.
#
# $Id: flavours,v 8.5 2025/12/06 13:47:42 mcalabre Exp $
#-----------------------------------------------------------------------------
F :=
ifeq "$(FLAVOUR)" ""
F := default
override FLAVOUR := default
endif
ifeq "$(FLAVOUR)" "dev"
# Currently gcc 11.4.0.
F := development
CC := gcc
F77 := gfortran
endif
ifeq "$(FLAVOUR)" "dev12"
# Currently gcc 12.3.0.
F := development
CC := gcc-12
F77 := gfortran-12
endif
# Compiler optimization level.
ifndef OPT
OPT := 0
endif
# Quench warnings about padding in foreign structs, particularly in fitsio.h.
ifneq "$(findstring $(SUBDIR),C Fortran pgsbox)" ""
WPADDED := -Wpadded
endif
ifeq "$F" "development"
# Options for code development with gcc/gfortran.
# INSTRUMENT := -fsanitize=address # appears to be broken.
INSTRUMENT := -fsanitize=undefined
INSTRUMENT += -fstack-protector-strong
CWARNINGS := -Wall -Wextra -Wno-clobbered -Wno-long-long
ifeq "$(INSTRUMENT)" ""
# The instrumentation options produce copious "padding" warnings.
CWARNINGS += $(WPADDED)
endif
FWARNINGS := -Wall -Wno-surprising
export CC := $(CC)
export CPPFLAGS := -D_FORTIFY_SOURCE=2
export CFLAGS := -std=c99 -pedantic
export CFLAGS += -g -O$(OPT) $(INSTRUMENT) $(CWARNINGS)
export F77 := $(F77)
export FFLAGS := -g -O$(OPT) -fimplicit-none -I. $(INSTRUMENT) $(FWARNINGS)
export LDFLAGS := $(INSTRUMENT)
ifdef VALGRIND
override VALGRIND := valgrind -v --leak-check=full --show-leak-kinds=all
override VALGRIND += --track-origins=yes
endif
endif
ifeq "$(FLAVOUR)" "lto"
# For LTO development.
F := $(FLAVOUR)
export BINDC := yes
CWARNINGS := -Wall -Wextra -Wno-clobbered -Wno-long-long
FWARNINGS := -Wall -Wno-surprising
LTOFLAGS := -O1 -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
export CC := gcc-12
export CPPFLAGS := -D_FORTIFY_SOURCE=2
export CFLAGS := -std=c99 -pedantic
export CFLAGS += $(LTOFLAGS) $(CWARNINGS)
export F77 := gfortran-12
export FFLAGS := -fimplicit-none -I. $(LTOFLAGS) $(FWARNINGS)
export LDFLAGS := $(LTOFLAGS)
endif
ifeq "$(FLAVOUR)" "profile"
# gcc with profiling (gprof).
F := $(FLAVOUR)
export CC := gcc
export CPPFLAGS :=
export CFLAGS := -std=c99 -pedantic
export CFLAGS += -pg -g -O -Wall -Wextra -Wno-long-long $(WPADDED)
export FFLAGS := -pg -g -O -fimplicit-none -Wall -I.
export LDFLAGS := -pg -g $(filter -L%, $(LDFLAGS))
override EXTRA_CLEAN := gmon.out bb.out
endif
# Check FLAVOUR.
ifeq "$F" ""
override FLAVOUR := unrecognised
endif
# Check VALGRIND.
ifeq "$(findstring valgrind, $(VALGRIND))" "valgrind"
override MODE := interactive
else
# Unrecognised.
override VALGRIND :=
endif
# Check MODE.
ifneq "$(MODE)" "interactive"
# Unrecognised.
override MODE :=
endif
# Check EXTRA_CLEAN.
ifeq "$(EXTRA_CLEAN)" ""
EXTRA_CLEAN :=
endif
# Pass to configure though the environment.
export FLAVOUR
export VALGRIND
export MODE
export EXTRA_CLEAN
|