File: flavours

package info (click to toggle)
wcslib 7.4+ds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 9,752 kB
  • sloc: ansic: 32,656; lex: 9,281; fortran: 6,634; sh: 3,369; sed: 497; pascal: 188; makefile: 15
file content (213 lines) | stat: -rw-r--r-- 5,985 bytes parent folder | download
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
#-----------------------------------------------------------------------------
# Makefile overrides for various combinations of architecture, operating
# system and compiler.  Used for development and testing only, not required
# for building WCSLIB.
#
# Variables like CC and CFLAGS are exported into the environment so that they
# will be seen by 'configure'.  Thus, normal usage is as follows:
#
#   make distclean
#   make FLAVOUR=Linux configure
#   make
#
# Reminder: add '-d' to FLFLAGS for debugging.
#
# $Id: flavours,v 7.4 2021/01/31 02:24:52 mcalabre Exp $
#-----------------------------------------------------------------------------

# The list of FLAVOURs can be set on the command line.
F := $(shell echo $(FLAVOURS) | tr a-z A-Z)
ifeq "$F" ""
  F :=
  FLAVOURS := ""
endif

ifeq "$F" "LINUX"
  override FLAVOURS := "" Linux Linuxp
endif

ifeq "$F" "SUN"
  override FLAVOURS := "" SUN/GNU SUN/GNU3 SUN/GNUp SUN/ANSI
endif

ifeq "$F" "PURE"
  override FLAVOURS := SUN/Pure SUN/Quant
endif

F :=


# Quench warnings about padding in foreign structs, particularly in fitsio.h.
ifneq "$(findstring $(SUBDIR),C Fortran pgsbox)" ""
  WPADDED := -Wpadded
endif


# Linux with gcc/gfortran (also works for Darwin).
ifeq "$(FLAVOUR)" "Linux"
  F := $(FLAVOUR)
  CWARNINGS       := -Wall -Wextra -Wno-clobbered -Wno-long-long $(WPADDED)
  export CC       := gcc -std=c99 -pedantic
  export CPPFLAGS :=
  export CFLAGS   := -g -O0 $(CWARNINGS)
  export F77      := gfortran
  export FFLAGS   := -g -O0 -fimplicit-none -I. -Wall
  export LDFLAGS  :=
  ifdef VALGRIND
    override VALGRIND := valgrind -v --leak-check=full --show-leak-kinds=all
    override VALGRIND += --track-origins=yes
  endif
endif

ifeq "$(FLAVOUR)" "Linux9"
  F := $(FLAVOUR)
  SANITIZE        := -fsanitize=address -fsanitize=undefined
  CWARNINGS       := -Wall -Wextra -Wno-clobbered -Wno-long-long
  export CC       := gcc-9.2.0 -std=c99 -pedantic
  export CPPFLAGS := -D_FORTIFY_SOURCE=2
  export CFLAGS   := -g -O2 $(SANITIZE) $(CWARNINGS)
  export F77      := gfortran-9.2.0
  export FFLAGS   := -g -O2 -fimplicit-none -I. $(SANITIZE) -Wall
  export LDFLAGS  := $(SANITIZE)
  export LD_RUN_PATH := /usr/local/lib64
  ifdef VALGRIND
    override VALGRIND := valgrind -v --leak-check=full --show-leak-kinds=all
    override VALGRIND += --track-origins=yes
  endif
endif

ifeq "$(FLAVOUR)" "Linuxp"
  F := $(FLAVOUR)
  export CC       := gcc -std=c99 -pedantic
  export CPPFLAGS :=
  export CFLAGS   := -pg -g -O -Wall -Wextra -Wno-long-long $(WPADDED)
  export FFLAGS   := -pg -a -g -O -fimplicit-none -Wall -I.
  export LDFLAGS  := -pg -g $(filter -L%, $(LDFLAGS))
  override EXTRA_CLEAN := gmon.out bb.out
endif


# Solaris with gcc/gfortran 4.x (lynx).
ifeq "$(FLAVOUR)" "SUN/GNU"
  F := $(FLAVOUR)
  export CC       := gcc -std=c99
  export CPPFLAGS :=
  export CFLAGS   := -g -Wall -Wno-long-long $(WPADDED)
  export F77      := gfortran
  export FFLAGS   := -g -fimplicit-none -Wall -I.
  LD      := gcc
endif

ifeq "$(FLAVOUR)" "SUN/GNU3"
  F := $(FLAVOUR)
  export CC       := gcc-3.1.1 -std=c99
  export CPPFLAGS :=
  export CFLAGS   := -g -Wall -Wno-long-long $(WPADDED)
  export F77      := g77-3.1.1
  export FFLAGS   := -g -Wimplicit -Wunused -Wno-globals -I.
  LD      := gcc-3.1.1
endif

ifeq "$(FLAVOUR)" "SUN/GNUp"
  F := $(FLAVOUR)
  export CC       := gcc -std=c99 -pedantic
  export CPPFLAGS :=
  export CFLAGS   := -pg -a -g -O -Wall -Wno-long-long $(WPADDED)
  export FFLAGS   := -pg -a -g -O -fimplicit-none -Wall -I.
  export LDFLAGS  := -pg -a -g $(filter -L%, $(LDFLAGS))
  override EXTRA_CLEAN := gmon.out bb.out
endif


# Solaris with SUN cc/f77.
ifeq "$(FLAVOUR)" "SUN/ANSI"
  F := $(FLAVOUR)
  WCSTRIG := NATIVE
  export CC       := cc
  export CFLAGS   := -g -I/usr/local/include
  export F77      := f77
  export FFLAGS   := -g -erroff=WDECL_LOCAL_NOTUSED
  LD      := f77
endif


# Purify and quantify in Solaris.
ifeq "$(FLAVOUR)" "SUN/Pure"
  F := $(FLAVOUR)
  WCSTRIG := NATIVE
  export CC       := purify gcc
  export CFLAGS   := -g
  export F77      := purify gcc
  export FFLAGS   := -g -Wimplicit -Wno-globals -I.
  export LDFLAGS  := $(filter -L%, $(LDFLAGS))
  override EXTRA_CLEAN := *_pure_p*.[ao] *.pcv .pure ../C/*_pure_p*.[ao]
endif

ifeq "$(FLAVOUR)" "SUN/Quant"
  F := $(FLAVOUR)
  WCSTRIG := NATIVE
  export CC       := quantify gcc
  export CFLAGS   := -g
  export F77      := quantify gcc
  export FFLAGS   := -g -Wimplicit -Wno-globals -I.
  export LDFLAGS  := $(filter -L%, $(LDFLAGS))
  override EXTRA_CLEAN := *_pure_q*.[ao] .pure
endif


# Check FLAVOUR.
ifneq "$F" "$(FLAVOUR)"
  override FLAVOUR := unrecognised
endif

# Check VALGRIND.
ifeq "$(findstring valgrind, $(VALGRIND))" "valgrind"
  override MODE := interactive
else
  # Unrecognised.
  override VALGRIND :=
endif

# Check MODE.
ifeq "$(MODE)" "interactive"
  # Important not to have output batched when running the test programs.
  MAKEFLAGS := $(filter-out -Otarget,$(MAKEFLAGS)) -Onone
else
  # Unrecognised.
  override MODE :=
endif


# gmake uses FC in place of configure's F77.
ifdef F77
  FC := $(F77)
endif

ifndef TIMER
  TIMER := date +"%a %Y/%m/%d %X %z, executing on $$HOST"
endif

ifdef FLAVOUR
  TIMER := $(TIMER) ; echo "    with $(FLAVOUR) FLAVOUR."
endif

# Experimental (see http://upstream-tracker.org/versions/wcslib.html).
api-sanity-check :
	-@ $(RM) -r $@/
	 @ mkdir $@/
	 @ cp C/*.h C/$(SHRLIB) $@/
	 @ echo "<version>$(LIBVER)</version>" > $@/opts.xml
	 @ echo "<headers>.</headers>" >> $@/opts.xml
	 @ echo "<libs>.</libs>" >> $@/opts.xml
	 @ echo "<gcc_options>-Dwtbarr=wtbarr_s</gcc_options>" >> $@/opts.xml
	   cd $@ && api-sanity-checker -lib WCSLIB -d opts.xml \
	     -show-retval -gen -build -run

show ::
	-@ echo 'For code development...'
	-@ echo '  FLAVOURS    := $(FLAVOURS)'
	-@ echo '  FLAVOUR     := $(FLAVOUR)'
	-@ echo '  MODE        := $(MODE)'
	-@ echo '  VALGRIND    := $(VALGRIND)'
	-@ echo '  EXTRA_CLEAN := $(EXTRA_CLEAN)'
	-@ echo ''