-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGNUmakefile
More file actions
1512 lines (1315 loc) · 53.8 KB
/
GNUmakefile
File metadata and controls
1512 lines (1315 loc) · 53.8 KB
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
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# RecursiveGNU makefile for Baselibs.
#
# NOTE: If you would like to add new packages, look at module
# supplibs under the opengrads CVS repository on sourceforge:
#
# http://sourceforge.net/cvs/?group_id=161773
#
# Packages such as NetCDF-4, HDF-5 and OPeNDAP have already been implemented
# there in a structure very similar to this one.
#
# !REVISION HISTORY:
#
# 25Jul2007 da Silva First implementation
# 11Aug2008 da Silva Aded Base.mk/Arch.mk to simplify CM.
#
#-------------------------------------------------------------------------
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(MKFILE_PATH))
MKFILE_DIRNAME := $(shell basename $(MKFILE_DIR))
PACKAGE = ESMA-Baselibs
VERSION = $(shell cat VERSION)
DATE = $(shell date +"%Y%b%d")
RELEASE_DIR = $(shell dirname $(MKFILE_DIR))
RELEASE_FILE = $(MKFILE_DIRNAME)-$(DATE)
MAKEJOBS = $(patsubst -j%,%,$(filter -j%,$(MFLAGS)))
# Note, if MAKEJOBS is blank, we need to set it to 1
MAKEJOBS := $(if $(MAKEJOBS),$(MAKEJOBS),1)
# System dependent defauls
# ------------------------
ifeq ($(origin FC),default)
undefine FC
endif
ifeq ($(origin CC),default)
undefine CC
endif
ifeq ($(origin CXX),default)
undefine CXX
endif
AUTORECONF_VERSION := $(shell autoreconf --version 2>/dev/null | head -1 | sed 's/[^0-9.]//g' | cut -d. -f1-2)
AUTORECONF_VERSION_OK := $(shell awk 'BEGIN { exit ($(AUTORECONF_VERSION) >= 2.72) ? 0 : 1 }' && echo yes || echo no)
ifneq ($(AUTORECONF_VERSION_OK),yes)
$(error autoreconf version $(AUTORECONF_VERSION) is too old. Version 2.72 or higher is required.)
endif
include Base.mk
include Arch.mk
include baselibs-config.mk
# Use these in recursive Makefiles
# --------------------------------
export prefix
export CC CXX F77 F90 FC MPICC MPICXX MPIFC ES_CC ES_CXX ES_FC
export ESMF_COMM ESMF_DIR ESMF_OS
# When HDF-5 is available, build NetCDF-4 with it,
# otherwise perform a vanilla NetCDF-4 build
# -----------------------------------------------
NC_LIBS = -lm
NC_CC = $(CC)
NC_CXX = $(CXX)
NC_FC = $(FC)
NC_F77 = $(FC)
H4_CC = $(prefix)/bin/h4cc-hdf4
H4_FC = $(prefix)/bin/h4fc-hdf4
H5_PARALLEL=--enable-parallel
ifeq ($(ESMF_COMM),mpiuni)
H5_PARALLEL=--disable-parallel
endif
INC_HDF5 = $(prefix)/include/hdf5
LIB_HDF5 = $(wildcard $(foreach lib, hdf5_hl hdf5 z sz,\
$(prefix)/lib/lib$(lib).a) )
NC_ENABLE_HDF5 = --enable-netcdf-4 --with-hdf5=$(prefix)
NC_LIBS = $(LIB_HDF5) $(LINK_GPFS) -lm
ifeq ($(H5_PARALLEL),--enable-parallel)
NC_CC = $(MPICC)
NC_FC = $(MPIFC)
NC_F77 = $(MPIFC)
NC_CXX = $(MPICXX)
NC_PAR_TESTS = --enable-parallel-tests
H5_CC = $(prefix)/bin/h5pcc
H5_FC = $(prefix)/bin/h5pfc
endif
ifeq ($(H5_PARALLEL),--disable-parallel)
H5_CC = $(prefix)/bin/h5cc
H5_FC = $(prefix)/bin/h5fc
endif
# Issue with NCO and nccmp with mpiuni and gcc
# --------------------------------------------
ifeq ($(findstring gcc,$(notdir $(CC))),gcc)
ifeq ($(ESMF_COMM),mpiuni)
PTHREAD_FLAG = -pthread
endif
endif
# Testing with MVAPICH2 and ifort showed this flag was needed
# -----------------------------------------------------------
#
ifeq ($(findstring ifort,$(notdir $(FC))),ifort)
ifeq ($(ESMF_COMM),mvapich2)
PTHREAD_FLAG = -pthread
endif
endif
# netCDF has an issue with Intel 15+. It must be compiled with -g -O0 to
# avoid the problem (which manifests as a crash in ESMF_cfio where in a
# FPE is thrown in an NF90_DEF_VAR for time!).
# ----------------------------------------------------------------------
ifeq ($(findstring ifort,$(notdir $(FC))),ifort)
NC_CFLAGS = -g -O0
endif
# HDF5, MVAPICH2 2.1rc1 (at least), and SLES 11 SP3 have an issue. Aaron
# Knister of NCCS determined that:
#
# If you set the environment variable RTLD_DEEPBIND to 0 then the
# segfault disappears. I'm trying to better understand this, but works by
# altering the behaviour of glibc when loading NSS modules. The symbol
# resolution order seems to change with it set (for the better in this
# case).
#
# So, we test if we are using mvapich2 and are on SP3.
# ---------------------------------------------------------------------
ifeq ($(ESMF_COMM), mvapich2)
IS_SLES11_SP3 = $(shell cat /etc/SuSE-release | awk '/PATCH/ {print $3}')
ifeq ($(findstring 3, $(IS_SLES11_SP3)), 3)
HDF5_DEEPBIND = "export RTLD_DEEPBIND=0"
endif
endif
# PGI 17.7+ has issues with ncap2. To correct,
# pass in -gopt -O2 instead of the usual -g -O2
# ---------------------------------------------
NCO_CXXFLAGS = -g -O2
ifeq ($(findstring pgfortran,$(notdir $(FC))),pgfortran)
NCO_CXXFLAGS = -gopt -O2
endif
# From Tom Clune: NAG is different. It has a different version and FPIC
# flag. It also needs extra flags to compile code that is not as string
# as it would like.
# ---------------------------------------------------------------------
FORTRAN_FPIC := -fPIC
FORTRAN_VERSION := --version
HDF5_ENABLE_F2003 := --enable-fortran2003
ifeq ($(findstring nagfor,$(notdir $(FC))),nagfor)
FORTRAN_FPIC := -PIC
FORTRAN_VERSION := -V
NAG_FCFLAGS := -fpp -mismatch_all
NAG_DUSTY := -dusty
endif
# Building with PGI on Darwin (Community Edition) does not quite work.
# Fixes are needed. NDEBUG from netcdf list
# -------------------------------------------------------------------
ifeq ($(findstring pgfortran,$(notdir $(FC))),pgfortran)
ifeq ($(ARCH),Darwin)
NC_CPPFLAGS = -DNDEBUG
FORTRAN_FPIC = -fpic
endif
endif
# HDF4 and netCDF-Fortran has a bug with GCC 10.1
# -----------------------------------------------
ifeq ($(findstring gfortran,$(notdir $(FC))),gfortran)
GFORTRAN_VERSION_GTE_10 := $(shell expr `$(FC) -dumpversion | cut -f1 -d.` \>= 10)
export GFORTRAN_VERSION_GTE_10
ifeq ($(GFORTRAN_VERSION_GTE_10),1)
ALLOW_ARGUMENT_MISMATCH := -fallow-argument-mismatch
ALLOW_INVALID_BOZ := -fallow-invalid-boz
COMMON_FLAG := -fcommon
export ALLOW_ARGUMENT_MISMATCH ALLOW_INVALID_BOZ
endif
# CDO needs C++20 standard
CDO_STD := -std=c++20
export CDO_STD
GFORTRAN_VERSION_GTE_14 := $(shell expr `$(FC) -dumpversion | cut -f1 -d.` \>= 14)
export GFORTRAN_VERSION_GTE_14
ifeq ($(GFORTRAN_VERSION_GTE_14),1)
NO_IMPLICIT_FUNCTION_ERROR := -Wno-error=implicit-function-declaration
export NO_IMPLICIT_FUNCTION_ERROR
NO_IMPLICIT_INT_ERROR := -Wno-error=implicit-int
export NO_IMPLICIT_INT_ERROR
NO_INT_CONVERSION_ERROR := -Wno-error=int-conversion
export NO_INT_CONVERSION_ERROR
endif
endif
# Clang has issues with some libraries due to strict C99
# ------------------------------------------------------
ifeq ($(CC_IS_CLANG),TRUE)
NO_IMPLICIT_FUNCTION_ERROR := -Wno-error=implicit-function-declaration
export NO_IMPLICIT_FUNCTION_ERROR
ifeq ($(ARCH),Darwin)
# There is an issue with clang and curl, need to pass in a macos version min
MACOS_VERSION := $(shell sw_vers -productVersion | awk -F . '{print $$1 "." $$2}')
export MACOS_VERSION
MMACOS_MIN := -mmacosx-version-min=$(MACOS_VERSION)
export MMACOS_MIN
# There is an issue with Apple clang++ and cdo
CDO_STD := -std=c++20
export CDO_STD
# There is an issue with netcdf-fortran and clang it seems we need
# to pass in -std=gnu17 to the CFLAGS to get it to compile.
# and udunits2
CLANG_STD_CFLAGS := -std=gnu17
export CLANG_STD_CFLAGS
# We might need to add -Wl,-ld_classic to LDFLAGS but only for certain versions of macOS/XCode
# which is 15 and up to 16.2, but not 16.3
# This command:
# pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | sed -n 's/version: \([0-9]*\)\..*/\1/p'
# will return the version of the Command Line Tools installed on the system and if it is 15 or greater
# then we need to add -Wl,-ld_classic to LDFLAGS
XCODE_VERSION_MAJOR := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | sed -n 's/version: \([0-9]*\)\..*/\1/p')
XCODE_VERSION_FULL := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version: | sed 's/version: //')
ifeq ($(XCODE_VERSION_MAJOR),15)
CLANG_LD_CLASSIC := -Wl,-ld_classic
export CLANG_LD_CLASSIC
endif
# Check if major version is 16
ifeq ($(XCODE_VERSION_MAJOR),16)
# Check if minor version is < 3
XCODE_VERSION_MINOR := $(shell echo $(XCODE_VERSION_FULL) | sed 's/16\.\([0-9]*\).*/\1/')
XCODE_VERSION_MINOR_LT_3 := $(shell expr $(XCODE_VERSION_MINOR) \< 3)
ifeq ($(XCODE_VERSION_MINOR_LT_3),1)
# Add the flag
CLANG_LD_CLASSIC := -Wl,-ld_classic
export CLANG_LD_CLASSIC
endif
endif
endif
ifeq ($(ARCH),Linux)
# There is an issue with LLVM clang++ and cdo
CDO_STD := -std=c++20 -stdlib=libc++
export CDO_STD
endif
endif
# CDO and flang have issues. For now, pass in
# --disable-fortran to CDO if flang
# -------------------------------------------
ifeq ($(findstring flang,$(notdir $(FC))),flang)
CDO_DISABLE_FORTRAN := --disable-fortran
export CDO_DISABLE_FORTRAN
endif
# icx also needs the strict C99 flags
# -----------------------------------
ifeq ($(findstring icx,$(notdir $(CC))),icx)
NO_IMPLICIT_FUNCTION_ERROR := -Wno-implicit-function-declaration
export NO_IMPLICIT_FUNCTION_ERROR
NO_IMPLICIT_INT_ERROR := -Wno-implicit-int
export NO_IMPLICIT_INT_ERROR
NO_INT_CONVERSION_ERROR := -Wno-int-conversion
export NO_INT_CONVERSION_ERROR
# CDO needs C++20 standard
CDO_STD := -std=c++20
export CDO_STD
endif
# HDF4 plus ifx does not work with Fortran bindings
# -------------------------------------------------
ifeq ($(findstring ifx,$(notdir $(FC))),ifx)
HDF4_ENABLE_FORTRAN := --disable-fortran
export HDF4_ENABLE_FORTRAN
else
HDF4_ENABLE_FORTRAN := --enable-fortran
export HDF4_ENABLE_FORTRAN
endif
# HDF5 and MPT at NCCS have an "issue" that needs an extra flag
# -------------------------------------------------------------
ifeq ($(SITE),NCCS)
ifeq ($(ESMF_COMM),mpt)
HDF5_NCCS_MPT_CFLAG := -Wno-error=redundant-decls
endif
endif
# Intel C on Darwin needs extra CFLAGS
# http://intel.ly/3ioNecp
# ------------------------------------
ifeq ($(findstring icc,$(notdir $(CC))),icc)
ifeq ($(ARCH),Darwin)
CFLAGS += -diag-error=147 -stdlib=libc++
export CFLAGS
endif
endif
# cURL is now more complicated with SSL
# -------------------------------------
ifeq ($(ARCH),Linux)
# On Linux, assume standard OpenSSL (works at NCCS, NAS, GMAO)
CURL_SSL := --with-openssl
export CURL_SSL
endif
ifeq ($(ARCH),Darwin)
# Check if we have Homebrew and OpenSSL formula
BREW_OPENSSL_PREFIX := $(shell \
if command -v brew >/dev/null 2>&1; then \
brew --prefix openssl@3 2>/dev/null || brew --prefix openssl 2>/dev/null || echo ""; \
else \
echo ""; \
fi)
ifneq ($(BREW_OPENSSL_PREFIX),)
# Use the stable Homebrew prefix path
CURL_SSL = --with-openssl=$(BREW_OPENSSL_PREFIX)
BREW_OPENSSL_LIBDIR := -L$(BREW_OPENSSL_PREFIX)/lib
else
# Fall back to pkg-config or system OpenSSL
OPENSSL_AVAILABLE := $(shell pkg-config --exists openssl && echo "yes" || echo "no")
ifeq ($(OPENSSL_AVAILABLE),yes)
CURL_SSL = --with-openssl
else
CURL_SSL = --without-ssl
endif
BREW_OPENSSL_LIBDIR := ""
endif
export CURL_SSL
export BREW_OPENSSL_PREFIX BREW_OPENSSL_LIBDIR
ifeq ($(ARCH)-$(findstring flang,$(notdir $(FC))),Darwin-flang)
# Pass frameworks directly to the Apple linker to prevent Flang from choking
DARWIN_ST_LIBS := -Wl,-framework,CoreFoundation -Wl,-framework,SystemConfiguration
else
DARWIN_ST_LIBS := -framework CoreFoundation -framework SystemConfiguration
endif
export DARWIN_ST_LIBS
endif
# Dynamically discover Homebrew's flang prefix, regardless of install location
# HDF4 and HDF5 configure script trips over flang's LTO flags on macOS
ifeq ($(ARCH)-$(findstring flang,$(notdir $(FC))),Darwin-flang)
# Force the Fortran library paths to bypass the broken auto-detection
FLANG_BREW_PREFIX := $(shell command -v brew >/dev/null 2>&1 && brew --prefix flang)
ifneq ($(FLANG_BREW_PREFIX),)
FLANG_LTO_LIBS = FCLIBS="-L$(FLANG_BREW_PREFIX)/lib -lflang_rt.runtime" FLIBS="-L$(FLANG_BREW_PREFIX)/lib -lflang_rt.runtime"
endif
export FLANG_LTO_LIBS
endif
# Flang via homebrew does not support quad precision, so we need to disable for FMS
# This is done via CMake as -DENABLE_QUAD_PRECISION=OFF
ifeq ($(ARCH)-$(findstring flang,$(notdir $(FC))),Darwin-flang)
FMS_QUAD_PRECISION := OFF
else
FMS_QUAD_PRECISION := ON
endif
export FMS_QUAD_PRECISION
#-------------------------------------------------------------------------
# --------------------------------
# Recurse Make in Sub-directories
# --------------------------------
ALLDIRS = antlr2 gsl jpeg zlib libaec curl hdf4 hdf5 netcdf netcdf-fortran netcdf-cxx4 \
udunits2 nco cdo nccmp libyaml FMS esmf xgboost \
GFE fftw \
hdfeos hdfeos5 SDPToolkit
ESSENTIAL_DIRS = jpeg zlib libaec hdf4 hdf5 netcdf netcdf-fortran libyaml FMS \
udunits2 nccmp esmf GFE fftw
MAPL_DIRS = jpeg zlib libaec hdf5 netcdf netcdf-fortran \
udunits2 nccmp esmf GFE
ifeq ($(ARCH),Darwin)
NO_DARWIN_DIRS = netcdf-cxx4 hdfeos hdfeos5 SDPToolkit
ALLDIRS := $(filter-out $(NO_DARWIN_DIRS),$(ALLDIRS))
endif
# NAG cannot build cdo
# https://code.mpimet.mpg.de/boards/1/topics/9337
# or FMS due to cray pointers
ifeq ($(findstring nagfor,$(notdir $(FC))),nagfor)
NO_NAG_DIRS = cdo FMS
ALLDIRS := $(filter-out $(NO_NAG_DIRS),$(ALLDIRS))
ESSENTIAL_DIRS := $(filter-out $(NO_NAG_DIRS),$(ESSENTIAL_DIRS))
MAPL_DIRS := $(filter-out $(NO_NAG_DIRS),$(MAPL_DIRS))
endif
# NVHPC seems to have issues with SDPToolkit and cdo
ifeq ($(findstring nvfortran,$(notdir $(FC))),nvfortran)
NO_NVHPC_DIRS = cdo SDPToolkit
ALLDIRS := $(filter-out $(NO_NVHPC_DIRS),$(ALLDIRS))
endif
# flang also seems to have issues with SDPToolkit
ifeq ($(findstring flang,$(notdir $(FC))),flang)
NO_FLANG_DIRS = SDPToolkit
ALLDIRS := $(filter-out $(NO_FLANG_DIRS),$(ALLDIRS))
endif
ifeq ($(MACH),aarch64)
NO_ARM_DIRS = hdf4 hdfeos hdfeos5 SDPToolkit
ALLDIRS := $(filter-out $(NO_ARM_DIRS),$(ALLDIRS))
ESSENTIAL_DIRS := $(filter-out hdf4,$(ESSENTIAL_DIRS))
endif
ifeq ('$(BUILD)','ESSENTIALS')
SUBDIRS = $(ESSENTIAL_DIRS)
INC_SUPP := $(foreach subdir, \
/ /zlib /libaec /jpeg /hdf5 /hdf /netcdf,\
-I$(prefix)/include$(subdir) $(INC_EXTRA) )
else
ifeq ('$(BUILD)','MAPL')
SUBDIRS = $(MAPL_DIRS)
INC_SUPP := $(foreach subdir, \
/ /zlib /libaec /jpeg /hdf5 /netcdf,\
-I$(prefix)/include$(subdir) $(INC_EXTRA) )
else
ifeq ('$(BUILD)','GFE')
SUBDIRS = GFE
else
SUBDIRS = $(ALLDIRS)
INC_SUPP := $(foreach subdir, \
/ /zlib /libaec /jpeg /hdf5 /hdf /netcdf /udunits2 /gsl /antlr2,\
-I$(prefix)/include$(subdir) $(INC_EXTRA) )
endif
endif
endif
ifeq ($(findstring hdf4,$(SUBDIRS)),hdf4)
ENABLE_HDF4 = --enable-hdf4
LIB_HDF4 = -lmfhdf -ldf
else
ENABLE_HDF4 = --disable-hdf4
LIB_HDF4 =
# Also need to remove hdfeos if no hdf4
SUBDIRS := $(filter-out hdfeos,$(SUBDIRS))
# and remove SDPToolkit
SUBDIRS := $(filter-out SDPToolkit,$(SUBDIRS))
endif
# Since we do not build the Fortran interface
# to HDF4 with ifx, we cannot build hdf-eos2
# or SDPToolkit
ifeq ($(findstring ifx,$(notdir $(FC))),ifx)
SUBDIRS := $(filter-out hdfeos,$(SUBDIRS))
SUBDIRS := $(filter-out SDPToolkit,$(SUBDIRS))
endif
# NVHPC and ESMF seem to have issues with zlib in Baselibs
# So we need to filter it out. We will use a special
# build variable to do this
ifeq ('$(SYSTEM_ZLIB)','YES')
SUBDIRS := $(filter-out zlib,$(SUBDIRS))
ZLIB_INSTALL =
WITH_ZLIB =
WITH_ZLIB_SHORT =
CURL_ZLIB = --without-zlib
# We also need to filter out zlib from INC_SUPP
INC_SUPP := $(filter-out -I$(prefix)/include/zlib,$(INC_SUPP))
else
ZLIB_INSTALL = zlib.install
WITH_ZLIB := --with-zlib=$(prefix)/include/zlib,$(prefix)/lib
WITH_ZLIB_SHORT := --with-zlib=$(prefix)
CURL_ZLIB := $(WITH_ZLIB_SHORT)
endif
TARGETS = all lib install
download: gsl.download cdo.download hdfeos.download hdfeos5.download SDPToolkit.download fftw.download
dist: download
tar -czf $(RELEASE_DIR)/$(RELEASE_FILE).tar.gz -C $(RELEASE_DIR) $(MKFILE_DIRNAME)
verify:
@echo MKFILE_PATH = $(MKFILE_PATH)
@echo MKFILE_DIR = $(MKFILE_DIR)
@echo MKFILE_DIRNAME = $(MKFILE_DIRNAME)
@echo SUBDIRS = $(SUBDIRS)
@echo BUILD_DAP = $(BUILD_DAP)
@echo GFORTRAN_VERSION_GTE_10 = $(GFORTRAN_VERSION_GTE_10)
@echo MACOS_VERSION = $(MACOS_VERSION)
@echo MMACOS_MIN = $(MMACOS_MIN)
@echo XCODE_VERSION_FULL = $(XCODE_VERSION_FULL)
@echo XCODE_VERSION_MAJOR = $(XCODE_VERSION_MAJOR)
@echo XCODE_VERSION_MINOR = $(XCODE_VERSION_MINOR)
@echo XCODE_VERSION_MINOR_LT_3 = $(XCODE_VERSION_MINOR_LT_3)
@echo CLANG_LD_CLASSIC = $(CLANG_LD_CLASSIC)
@echo ALLOW_ARGUMENT_MISMATCH = $(ALLOW_ARGUMENT_MISMATCH)
@echo CC_IS_CLANG = $(CC_IS_CLANG)
@echo NO_IMPLICIT_FUNCTION_ERROR = $(NO_IMPLICIT_FUNCTION_ERROR)
@echo LIB_EXTRA = $(LIB_EXTRA)
@echo SYSTEM_ZLIB = $(SYSTEM_ZLIB)
@echo ZLIB_INSTALL = $(ZLIB_INSTALL)
@echo WITH_ZLIB = $(WITH_ZLIB)
@echo WITH_ZLIB_SHORT = $(WITH_ZLIB_SHORT)
@echo CURL_ZLIB = $(CURL_ZLIB)
@echo BREW_OPENSSL_PREFIX = $(BREW_OPENSSL_PREFIX)
@echo CURL_SSL = $(CURL_SSL)
@echo INC_SUPP = $(INC_SUPP)
@echo NAG_FCFLAGS = $(NAG_FCFLAGS)
@echo FC_FROM_ENV = $(FC_FROM_ENV)
@echo CC_FROM_ENV = $(CC_FROM_ENV)
@echo CXX_FROM_ENV = $(CXX_FROM_ENV)
@echo FC = $(FC)
@echo CC = $(CC)
@echo CXX = $(CXX)
@echo MPIFC = $(MPIFC)
@echo MPICC = $(MPICC)
@echo MPICXX = $(MPICXX)
@echo NC_FC = $(NC_FC)
@echo NC_CC = $(NC_CC)
@echo NC_CXX = $(NC_CXX)
@echo ES_FC = $(ES_FC)
@echo ES_CC = $(ES_CC)
@echo ES_CXX = $(ES_CXX)
@echo FORTRAN_VERSION = $(FORTRAN_VERSION)
@echo ESMF_COMM = $(ESMF_COMM)
@echo ESMF_COMPILER = $(ESMF_COMPILER)
@echo ENABLE_HDF4 = $(ENABLE_HDF4)
@echo LIB_HDF4 = $(LIB_HDF4)
@echo AUTORECONF_VERSION = $(AUTORECONF_VERSION)
@echo MAKEJOBS = $(MAKEJOBS)
@echo SITE = $(SITE)
@ argv="$(SUBDIRS)" ;\
( echo "-------+---------+---------+--------------" ); \
( echo "Config | Install | Check | Package" ); \
( echo "-------+---------+---------+--------------" ); \
for d in $$argv; do \
if test -e $$d.config ; then \
cfg=' ok ' ;\
else \
cfg=' -- ' ;\
fi ;\
if test -e $$d.install ; then \
inst=' ok ' ;\
else \
inst=' -- ' ;\
fi ;\
if test -e $$d.check ; then \
chck=' ok ' ;\
else \
chck=' -- ' ;\
fi ;\
( echo "$$cfg | $$inst | $$chck | $$d" ); \
done ; \
( echo "-------+---------+---------+--------------" )
.PHONY: $(TARGETS) baselibs-config versions prelim
.NOTPARALLEL: baselibs-config
prelim: echo-compilers baselibs-config versions
echo-compilers:
@mkdir -p $(prefix)/etc
$(warning Using $(FC) for Fortran compiler)
$(warning Using $(MPIFC) for MPI Fortran compiler)
$(warning Using $(ES_FC) for ESMF Fortran compiler)
$(warning Using $(CC) for C compiler)
$(warning Using $(MPICC) for MPI C compiler)
$(warning Using $(ES_CC) for ESMF C compiler)
$(warning Using $(CXX) for C++ compiler)
$(warning Using $(MPICXX) for MPIC++ compiler)
$(warning Using $(ES_CXX) for ESMF C++ compiler)
baselibs-config: baselibs-config.mk
@echo "Building: $(SUBDIRS)"
@echo "Doing preliminaries"
@mkdir -p $(prefix)/etc
@cp VERSION $(prefix)/etc
@cp CHANGELOG.md $(prefix)/etc
@cp ChangeLog-preV6 $(prefix)/etc
@cp README.md $(prefix)/etc
@$(if $(LOADEDMODULES),$(shell echo $(LOADEDMODULES) | tr ':' ' ' >& $(prefix)/etc/MODULES),echo "Modules not found")
@rm -f $(prefix)/etc/CONFIG
@echo "CC: $(CC)" >> $(prefix)/etc/CONFIG
@echo "CC --version: $(shell $(CC) --version 2>&1)" >> $(prefix)/etc/CONFIG
@echo "CXX: $(CXX)" >> $(prefix)/etc/CONFIG
@echo "CXX --version: $(shell $(CXX) --version 2>&1)" >> $(prefix)/etc/CONFIG
@echo "FC: $(FC)" >> $(prefix)/etc/CONFIG
@echo "FC --version: $(shell $(FC) $(FORTRAN_VERSION) 2>&1)" >> $(prefix)/etc/CONFIG
@echo "F77: $(F77)" >> $(prefix)/etc/CONFIG
@echo "F77 --version: $(shell $(F77) $(FORTRAN_VERSION) 2>&1)" >> $(prefix)/etc/CONFIG
@echo "FC: $(FC)" >> $(prefix)/etc/CONFIG
@echo "FC --version: $(shell $(FC) $(FORTRAN_VERSION) 2>&1)" >> $(prefix)/etc/CONFIG
@echo "" >> $(prefix)/etc/CONFIG
@echo "MPICC: $(MPICC)" >> $(prefix)/etc/CONFIG
@echo "MPICXX: $(MPICXX)" >> $(prefix)/etc/CONFIG
@echo "MPIFC: $(MPIFC)" >> $(prefix)/etc/CONFIG
@echo "" >> $(prefix)/etc/CONFIG
@echo "ESMF_COMM: $(ESMF_COMM)" >> $(prefix)/etc/CONFIG
@echo "ESMF_COMPILER: $(ESMF_COMPILER)" >> $(prefix)/etc/CONFIG
@echo "ES_CC: $(ES_CC)" >> $(prefix)/etc/CONFIG
@echo "ES_CXX: $(ES_CXX)" >> $(prefix)/etc/CONFIG
@echo "ES_FC: $(ES_FC)" >> $(prefix)/etc/CONFIG
@echo "" >> $(prefix)/etc/CONFIG
@echo "CONFIG_SETUP: $(CONFIG_SETUP)" >> $(prefix)/etc/CONFIG
@echo "SYSNAME: $(SYSNAME)" >> $(prefix)/etc/CONFIG
@echo "ARCH: $(ARCH)" >> $(prefix)/etc/CONFIG
@echo "SITE: $(SITE)" >> $(prefix)/etc/CONFIG
@echo "MACH: $(MACH)" >> $(prefix)/etc/CONFIG
@echo "Kernel: $(shell uname -r)" >> $(prefix)/etc/CONFIG
@echo "Hostname: $(shell hostname)" >> $(prefix)/etc/CONFIG
@echo "USER: $(USER)" >> $(prefix)/etc/CONFIG
@echo "Making baselibs-config script"
@sed -e "$$CONFIG_SEDFILE_BODY" baselibs-config.bsub > $(prefix)/etc/baselibs-config
@chmod +x $(prefix)/etc/baselibs-config
versions: make_versions.sh
$(shell ./make_versions.sh $(prefix))
make_baselibs_mk: make_baselibs_mk.sh versions
$(shell ./make_baselibs_mk.sh $(prefix))
$(TARGETS): prelim
@ t=$@; argv="$(SUBDIRS)" ;\
for d in $$argv; do \
( echo Building $$t ... ); \
( $(MAKE) $$d.config ); \
( $(MAKE) $$d.$$t ); \
done
$(MAKE) make_baselibs_mk
clean:
@ t=$@; argv="$(SUBDIRS)" ;\
for d in $$argv; do \
( $(MAKE) $$d.$$t ) \
done
distclean:
@/bin/rm -rf *.config *.install *.check *.python
@ t=$@; argv="$(SUBDIRS)" ;\
for d in $$argv; do \
( $(MAKE) $$d.$$t ) \
done
check:
@ t=$@; argv="$(SUBDIRS)" ;\
for d in $$argv; do \
( echo Checking $$d ... ); \
( $(MAKE) $$d.$$t ); \
done
realclean:
@$(MAKE) distclean
@/bin/rm -rf $(prefix)
# ----------------
# Customized rules
# ----------------
# Config
# ......
jpeg.config: jpeg/configure
@echo "Configuring jpeg"
@(cd jpeg; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(INC_SUPP)";\
export LIBS="-lm";\
autoreconf -f -v -i ;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/jpeg \
--disable-shared \
CFLAGS="$(CFLAGS)" CC=$(CC) CXX=$(CXX) FC=$(FC) )
@touch $@
hdf4.config: hdf4/README.md jpeg.install $(ZLIB_INSTALL) libaec.install
@echo Configuring hdf4
@(cd hdf4; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(INC_SUPP)";\
export LIBS="-L$(prefix)/lib -lsz -laec -lm $(LIB_EXTRA)" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--program-suffix="-hdf4"\
--includedir=$(prefix)/include/hdf \
--with-jpeg=$(prefix)/include/jpeg,$(prefix)/lib \
--with-szlib=$(prefix)/include/libaec,$(prefix)/lib \
$(WITH_ZLIB) \
--disable-netcdf \
--enable-hdf4-xdr \
$(HDF4_ENABLE_FORTRAN) \
CFLAGS="$(CFLAGS) $(NO_IMPLICIT_FUNCTION_ERROR) $(NO_IMPLICIT_INT_ERROR)" FFLAGS="$(NAG_FCFLAGS) $(NAG_DUSTY) $(ALLOW_ARGUMENT_MISMATCH)" CC=$(CC) FC=$(FC) CXX=$(CXX) $(FLANG_LTO_LIBS) )
touch $@
# We need to patch HDF5 for gcc15. Based on https://github.com/HDFGroup/hdf5/pull/4924
# Should be in next HDF5 version (1.14.7)
hdf5.config :: hdf5/README.md libaec.install $(ZLIB_INSTALL)
@echo Patching hdf5
patch -f -p1 < ./patches/hdf5/gcc15.patch
patch -f -p1 < ./patches/hdf5/nvhpc_Mnoframe.patch
hdf5.config :: hdf5/README.md libaec.install $(ZLIB_INSTALL)
echo Configuring hdf5
(cd hdf5; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export LIBS="-L$(prefix)/lib -lsz -laec -lm $(LIB_EXTRA)" ;\
export LDFLAGS="$(CLANG_LD_CLASSIC)" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/hdf5 \
--with-szlib=$(prefix)/include/libaec,$(prefix)/lib \
$(WITH_ZLIB) \
--disable-shared --disable-cxx \
--enable-hl --enable-fortran --disable-sharedlib-rpath \
$(ENABLE_GPFS) $(H5_PARALLEL) $(HDF5_ENABLE_F2003) \
CFLAGS="$(CFLAGS) $(HDF5_NCCS_MPT_CFLAG)" FCFLAGS="$(NAG_FCFLAGS)" CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) $(FLANG_LTO_LIBS) )
touch $@
hdf5.config :: hdf5/README.md libaec.install $(ZLIB_INSTALL)
@echo Unpatching hdf5
patch -f -p1 -R < ./patches/hdf5/gcc15.patch
patch -f -p1 -R < ./patches/hdf5/nvhpc_Mnoframe.patch
NETCDF_BYTERANGE = --enable-byterange
ifneq ("$(wildcard $(prefix)/bin/curl-config)","")
BUILD_DAP = --enable-dap
LIB_CURL = $(BREW_OPENSSL_LIBDIR) $(shell $(prefix)/bin/curl-config --libs) $(DARWIN_ST_LIBS)
ifeq ($(findstring nagfor,$(notdir $(FC))),nagfor)
LIB_CURL := $(filter-out -pthread,$(LIB_CURL))
endif
else
BUILD_DAP = --disable-dap
LIB_CURL =
NETCDF_BYTERANGE = --disable-byterange
endif
netcdf.config : netcdf/configure
@echo "Configuring netcdf $*"
@(cd netcdf; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS) $(NC_CPPFLAGS) $(INC_SUPP)";\
export CFLAGS="$(CFLAGS) $(NC_CFLAGS) $(PTHREAD_FLAG)";\
export LIBS="-L$(prefix)/lib -lsz -laec -ljpeg $(LINK_GPFS) $(LIB_CURL) -ldl -lm $(LIB_EXTRA)" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/netcdf \
$(ENABLE_HDF4) \
$(BUILD_DAP) \
$(NC_PAR_TESTS) \
$(NETCDF_BYTERANGE) \
--disable-shared \
--disable-examples \
--enable-netcdf-4 \
CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
LIB_NETCDF = $(shell $(prefix)/bin/nc-config --libs)
ifeq ($(findstring nagfor,$(notdir $(FC))),nagfor)
LIB_NETCDF := $(filter-out -pthread,$(LIB_NETCDF))
endif
netcdf-fortran.config : netcdf-fortran/configure netcdf.install
@echo "Configuring netcdf-fortran $*"
@(cd netcdf-fortran; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS) -I$(prefix)/include/netcdf $(INC_SUPP)";\
export CFLAGS="$(CFLAGS) $(NC_CFLAGS) $(PTHREAD_FLAG) $(CLANG_STD_CFLAGS)";\
export LIBS="-L$(prefix)/lib $(LIB_NETCDF) $(LIB_CURL)" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/netcdf \
$(NC_PAR_TESTS) \
--disable-shared \
--enable-f90 \
FFLAGS="$(FORTRAN_FPIC) $(NAG_FCFLAGS) $(ALLOW_ARGUMENT_MISMATCH)" FCFLAGS="$(FORTRAN_FPIC) $(NAG_FCFLAGS) $(ALLOW_ARGUMENT_MISMATCH)" \
CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
netcdf-cxx4.config : netcdf-cxx4/configure netcdf.install
@echo "Configuring netcdf-cxx4 $*"
@mkdir -p ./netcdf-cxx4/build
@(cd netcdf-cxx4/build; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS) -I$(prefix)/include/netcdf $(INC_SUPP)";\
export LIBS="-L$(prefix)/lib $(LIB_NETCDF) $(LIB_CURL)" ;\
autoreconf -f -v -i;\
../configure --prefix=$(prefix) \
--includedir=$(prefix)/include/netcdf \
--disable-shared \
CXXFLAGS="-fPIC" CFLAGS="-fPIC" \
CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
udunits2.config : udunits2/configure.ac
@echo "Configuring udunits2 $*"
@(cd udunits2; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS)";\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/udunits2 \
--disable-shared \
CFLAGS="$(CFLAGS) $(NO_IMPLICIT_FUNCTION_ERROR) $(NO_IMPLICIT_INT_ERROR) $(CLANG_STD_CFLAGS)" CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
INC_HDF5 = $(prefix)/include/hdf5
LIB_HDF5 = $(wildcard $(foreach lib, hdf5_hl hdf5 z sz curl,\
$(prefix)/lib/lib$(lib).a) )
nco.config : nco/configure
@echo "Configuring nco $*"
@(cd nco; \
export NETCDF_ROOT="$(prefix)/"; \
export NETCDF_LIB="$(prefix)/lib"; \
export NETCDF_INC="$(prefix)/include/netcdf"; \
export ANTLR_ROOT="$(prefix)/"; \
export ANTLR_LIB="$(prefix)/lib"; \
export ANTLR_INC="$(prefix)/include/antlr2"; \
export GSL_ROOT="$(prefix)/"; \
export GSL_LIB="$(prefix)/lib"; \
export GSL_INC="$(prefix)/include/gsl"; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS) $(INC_SUPP) -I$(prefix)/include/netcdf";\
export CXXFLAGS="$(NCO_CXXFLAGS)";\
export CFLAGS="$(CFLAGS) $(PTHREAD_FLAG)";\
export LIBS="-L$(prefix)/lib $(LIB_NETCDF) $(LIB_HDF5) $(LIB_HDF4) -lsz -laec -ljpeg $(LINK_GPFS) $(LIB_CURL) -ldl -lm $(LIB_EXTRA)" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/nco \
--enable-ncoxx \
--enable-ncap2 --enable-gsl \
--disable-shared --enable-static \
--disable-nco_cplusplus \
--disable-mpi \
--enable-openmp \
--enable-netcdf4 \
--disable-doc \
CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
libaec.config : libaec/configure.ac
@echo "Configuring libaec"
@(cd libaec; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(INC_SUPP)";\
export LIBS="-lm";\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/libaec \
--disable-shared \
CFLAGS="$(CFLAGS)" CC=$(CC) CXX=$(CXX) FC=$(FC) )
@touch $@
libaec.install :: libaec.config
@echo "Installing libaec"
@(cd libaec; \
export PATH="$(prefix)/bin:$(PATH)" ;\
$(MAKE) install )
touch $@
zlib.config : zlib/configure
@echo Configuring zlib
@(cd zlib; \
export PATH="$(prefix)/bin:$(PATH)" ;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/zlib \
--libdir=$(prefix)/lib )
touch $@
curl.config : curl/configure.ac $(ZLIB_INSTALL)
@echo "Configuring curl"
@(cd curl; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(INC_SUPP)";\
export LIBS="-lm";\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/ \
--libdir=$(prefix)/lib \
$(CURL_ZLIB) \
--disable-ldap \
--enable-manual \
--disable-shared \
--enable-static \
--without-libidn \
--without-libidn2 \
--without-nghttp2 \
--without-nghttp3 \
--without-libpsl \
$(CURL_SSL) \
CFLAGS="$(CFLAGS) $(MMACOS_MIN)" CC=$(CC) CXX=$(CXX) FC=$(FC) )
@touch $@
cdo.download : scripts/download_cdo.bash
@echo "Downloading cdo"
@./scripts/download_cdo.bash
@touch $@
cdo.config: cdo.download cdo/configure netcdf.install udunits2.install
@echo "Configuring cdo $*"
@(cd cdo; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS) $(INC_SUPP)";\
export LIBS="-L$(prefix)/lib $(LIB_NETCDF) $(LIB_CURL) -lexpat $(LIB_HDF4) -lsz -laec -ljpeg $(LINK_GPFS) -ldl -lm" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/cdo \
--with-szlib=$(prefix) \
$(WITH_ZLIB_SHORT) \
--with-hdf5=$(prefix) \
--with-netcdf=$(prefix) \
--with-udunits2=$(prefix) \
--disable-grib --disable-openmp \
--disable-shared --enable-static $(CDO_DISABLE_FORTRAN) \
CXXFLAGS="$(CDO_STD)" FCFLAGS="$(NAG_FCFLAGS)" CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
fftw.download : scripts/download_fftw.bash
@echo "Downloading fftw"
@./scripts/download_fftw.bash
@touch $@
fftw.config : fftw.download fftw/configure
@echo "Configuring fftw"
@(cd fftw; \
export PATH="$(prefix)/bin:$(PATH)" ;\
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/fftw \
--enable-mpi --enable-float --enable-shared \
CFLAGS="$(CFLAGS)" CC=$(NC_CC) CXX=$(NC_CXX) FC=$(NC_FC) F77=$(NC_F77) )
@touch $@
nccmp.config: nccmp/configure netcdf.install
@echo "Configuring nccmp $*"
@(cd nccmp; \
autoreconf -f -v -i;\
chmod +x configure ;\
export PATH="$(prefix)/bin:$(PATH)" ;\
export CPPFLAGS="$(CPPFLAGS) $(INC_SUPP)";\
export LIBS="-L$(prefix)/lib $(LIB_NETCDF) $(LIB_CURL) -lexpat $(LIB_HDF4) -lsz -laec -ljpeg $(LINK_GPFS) -ldl -lm" ;\
export CFLAGS="$(CFLAGS) $(PTHREAD_FLAG)";\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/nccmp \
--with-netcdf=$(MKFILE_DIR)/netcdf \
FCFLAGS="$(NAG_FCFLAGS)" CC=$(NC_CC) FC=$(NC_FC) CXX=$(NC_CXX) F77=$(NC_F77) )
@touch $@
xgboost.config:
@echo "Configuring xgboost"
@mkdir -p ./xgboost/build
@(cd ./xgboost; \
cmake -B build -S . --install-prefix=$(prefix) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 )
@touch $@
GFE.config:
@echo "Configuring GFE"
@mkdir -p ./GFE/build
@(cd ./GFE; \
export LDFLAGS="$(CLANG_LD_CLASSIC)" ;\
cmake -B build -S . --install-prefix=$(prefix) -DCMAKE_PREFIX_PATH=$(prefix) -DSKIP_OPENMP=YES )
@touch $@
libyaml.config:
@echo "Configuring libyaml"
@mkdir -p ./libyaml/build
@(cd ./libyaml; \
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=$(prefix) -DCMAKE_PREFIX_PATH=$(prefix) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 )
@touch $@
# We need to patch FMS for LLVM testing support
# NOTE: Because we patch CMake, we need to patch before
# configuring and unpatch after installing
FMS.config :: netcdf.install netcdf-fortran.install libyaml.install
@echo Patching FMS
patch -f -p1 < ./patches/FMS/llvm.patch
FMS.config :: netcdf.install netcdf-fortran.install libyaml.install
@echo "Configuring FMS"