forked from MPAS-Dev/MPAS-Model
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
1365 lines (1260 loc) · 45.3 KB
/
Makefile
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
MODEL_FORMULATION =
ifneq "${MPAS_SHELL}" ""
SHELL = ${MPAS_SHELL}
endif
dummy:
( $(MAKE) error )
gnu: # BUILDTARGET GNU Fortran, C, and C++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = gfortran" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
"FFLAGS_OPT = -std=f2008 -O3 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -g -ffree-line-length-none -fconvert=big-endian -ffree-form -fcheck=all -fbacktrace -ffpe-trap=invalid,zero,overflow" \
"CFLAGS_DEBUG = -g" \
"CXXFLAGS_DEBUG = -g" \
"LDFLAGS_DEBUG = -g" \
"FFLAGS_OMP = -fopenmp" \
"CFLAGS_OMP = -fopenmp" \
"FFLAGS_ACC =" \
"CFLAGS_ACC =" \
"PICFLAG = -fPIC" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
xlf: # BUILDTARGET IBM XL compilers
( $(MAKE) all \
"FC_PARALLEL = mpifort" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpic++" \
"FC_SERIAL = xlf2003_r" \
"CC_SERIAL = xlc_r" \
"CXX_SERIAL = xlc++_r" \
"FFLAGS_PROMOTION = -qrealsize=8" \
"FFLAGS_OPT = -O3 -qufmt=be -WF,-qnotrigraph" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -O0 -g -C -qufmt=be -WF,-qnotrigraph" \
"CFLAGS_DEBUG = -O0 -g" \
"CXXFLAGS_DEBUG = -O0 -g" \
"LDFLAGS_DEBUG = -O0 -g" \
"FFLAGS_OMP = -qsmp=omp" \
"CFLAGS_OMP = -qsmp=omp" \
"PICFLAG = -qpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
xlf-summit-omp-offload: # BUILDTARGET IBM XL compilers w/OpenMP offloading on ORNL Summit
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpiCC" \
"FC_SERIAL = xlf90_r" \
"CC_SERIAL = xlc_r" \
"CXX_SERIAL = xlc++_r" \
"FFLAGS_PROMOTION = -qrealsize=8" \
"FFLAGS_OPT = -g -qfullpath -qmaxmem=-1 -qphsinfo -qzerosize -qfree=f90 -qxlf2003=polymorphic -qspillsize=2500 -qextname=flush -O2 -qstrict -Q" \
"CFLAGS_OPT = -g -qfullpath -qmaxmem=-1 -qphsinfo -O3" \
"CXXFLAGS_OPT = -g -qfullpath -qmaxmem=-1 -qphsinfo -O3" \
"LDFLAGS_OPT = -Wl,--relax -Wl,--allow-multiple-definition -qsmp -qoffload -lcudart -L$(CUDA_DIR)/lib64" \
"FFLAGS_GPU = -qsmp -qoffload" \
"LDFLAGS_GPU = -qsmp -qoffload -lcudart -L$(CUDA_DIR)/lib64" \
"FFLAGS_DEBUG = -O0 -g -qinitauto=7FF7FFFF -qflttrap=ov:zero:inv:en" \
"CFLAGS_DEBUG = -O0 -g" \
"CXXFLAGS_DEBUG = -O0 -g" \
"LDFLAGS_DEBUG = -O0 -g" \
"FFLAGS_OMP = -qsmp=omp" \
"CFLAGS_OMP = -qsmp=omp" \
"PICFLAG = -qpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENMP_OFFLOAD = $(OPENMP_OFFLOAD)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DFORTRAN_SAME -DCPRIBM -DLINUX" )
ftn: # BUILDTARGET Cray compilers
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -i4 -gopt -O2 -Mvect=nosse -Kieee -convert big_endian" \
"CFLAGS_OPT = -fast" \
"CXXFLAGS_OPT = -fast" \
"LDFLAGS_OPT = " \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"FFLAGS_ACC =" \
"CFLAGS_ACC =" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
titan-cray: # BUILDTARGET (deprecated) Cray compilers with options for ORNL Titan
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"FC_SERIAL = ftn" \
"CC_SERIAL = gcc" \
"FFLAGS_PROMOTION = -default64" \
"FFLAGS_OPT = -s integer32 -O3 -f free -N 255 -em -ef" \
"CFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_OMP = " \
"CFLAGS_OMP = " \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
nvhpc: # BUILDTARGET NVIDIA HPC SDK
( $(MAKE) all \
"FC_PARALLEL = mpifort" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpic++" \
"FC_SERIAL = nvfortran" \
"CC_SERIAL = nvc" \
"CXX_SERIAL = nvc++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -gopt -O4 -byteswapio -Mfree" \
"CFLAGS_OPT = -gopt -O3" \
"CXXFLAGS_OPT = -gopt -O3" \
"LDFLAGS_OPT = -gopt -O3" \
"FFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -byteswapio -Mfree -Ktrap=divz,fp,inv,ovf -traceback" \
"CFLAGS_DEBUG = -O0 -g -traceback" \
"CXXFLAGS_DEBUG = -O0 -g -traceback" \
"LDFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -Ktrap=divz,fp,inv,ovf -traceback" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"FFLAGS_ACC = -Mnofma -acc -gpu=cc70,cc80 -Minfo=accel" \
"CFLAGS_ACC =" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )
pgi: # BUILDTARGET PGI compiler suite
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = pgf90" \
"CC_SERIAL = pgcc" \
"CXX_SERIAL = pgc++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -O3 -byteswapio -Mfree" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -byteswapio -Mfree -Ktrap=divz,fp,inv,ovf -traceback" \
"CFLAGS_DEBUG = -O0 -g -traceback" \
"CXXFLAGS_DEBUG = -O0 -g -traceback" \
"LDFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -Ktrap=divz,fp,inv,ovf -traceback" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"FFLAGS_ACC = -Mnofma -acc -Minfo=accel" \
"CFLAGS_ACC =" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )
pgi-summit: # BUILDTARGET PGI compiler suite w/OpenACC options for ORNL Summit
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = pgf90" \
"CC_SERIAL = pgcc" \
"CXX_SERIAL = pgc++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -g -O3 -byteswapio -Mfree" \
"CFLAGS_OPT = -O3 " \
"CXXFLAGS_OPT = -O3 " \
"LDFLAGS_OPT = -O3 " \
"FFLAGS_ACC = -acc -Minfo=accel -ta=tesla:cc70,cc60,deepcopy,nollvm " \
"CFLAGS_ACC = -acc -Minfo=accel -ta=tesla:cc70,cc60,deepcopy,nollvm " \
"FFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -byteswapio -Mfree -Ktrap=divz,fp,inv,ovf -traceback" \
"CFLAGS_DEBUG = -O0 -g -traceback" \
"CXXFLAGS_DEBUG = -O0 -g -traceback" \
"LDFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -Ktrap=divz,fp,inv,ovf -traceback" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = -DpgiFortran -D_MPI -DUNDERSCORE" )
pgi-nersc: # BUILDTARGET (deprecated) PGI compilers on NERSC machines
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -O3 -byteswapio -Mfree" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )
pgi-llnl: # BUILDTARGET (deprecated) PGI compilers on LLNL machines
( $(MAKE) all \
"FC_PARALLEL = mpipgf90" \
"CC_PARALLEL = pgcc" \
"CXX_PARALLEL = mpipgcxx" \
"FC_SERIAL = pgf90" \
"CC_SERIAL = pgcc" \
"CXX_SERIAL = pgc++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -i4 -g -O2 -byteswapio" \
"CFLAGS_OPT = -fast" \
"CXXFLAGS_OPT = -fast" \
"LDFLAGS_OPT = " \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )
ifort: # BUILDTARGET Intel Fortran, C, and C++ compiler suite
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = ifort" \
"CC_SERIAL = icc" \
"CXX_SERIAL = icpc" \
"FFLAGS_PROMOTION = -real-size 64" \
"FFLAGS_OPT = -O3 -convert big_endian -free -align array64byte" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -g -convert big_endian -free -check all -fpe0 -traceback" \
"CFLAGS_DEBUG = -g -traceback" \
"CXXFLAGS_DEBUG = -g -traceback" \
"LDFLAGS_DEBUG = -g -fpe0 -traceback" \
"FFLAGS_OMP = -qopenmp" \
"CFLAGS_OMP = -qopenmp" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
ifort-scorep: # BUILDTARGET Intel compiler suite with ScoreP profiling library
( $(MAKE) all \
"FC_PARALLEL = scorep --compiler mpif90" \
"CC_PARALLEL = scorep --compiler mpicc" \
"CXX_PARALLEL = scorep --compiler mpicxx" \
"FC_SERIAL = ifort" \
"CC_SERIAL = icc" \
"CXX_SERIAL = icpc" \
"FFLAGS_PROMOTION = -real-size 64" \
"FFLAGS_OPT = -O3 -g -convert big_endian -free -align array64byte" \
"CFLAGS_OPT = -O3 -g" \
"CXXFLAGS_OPT = -O3 -g" \
"LDFLAGS_OPT = -O3 -g" \
"FFLAGS_DEBUG = -g -convert big_endian -free -check all -fpe0 -traceback" \
"CFLAGS_DEBUG = -g -traceback" \
"CXXFLAGS_DEBUG = -g -traceback" \
"LDFLAGS_DEBUG = -g -fpe0 -traceback" \
"FFLAGS_OMP = -qopenmp" \
"CFLAGS_OMP = -qopenmp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
ifort-gcc: # BUILDTARGET Intel Fortran compiler and GNU C/C++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = ifort" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -real-size 64" \
"FFLAGS_OPT = -O3 -convert big_endian -free -align array64byte" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -g -convert big_endian -free -check all -fpe0 -traceback" \
"CFLAGS_DEBUG = -g" \
"CXXFLAGS_DEBUG = -g" \
"LDFLAGS_DEBUG = -g -fpe0 -traceback" \
"FFLAGS_OMP = -qopenmp" \
"CFLAGS_OMP = -fopenmp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
intel-mpi: # BUILDTARGET Intel compiler suite with Intel MPI library
( $(MAKE) all \
"FC_PARALLEL = mpiifort" \
"CC_PARALLEL = mpiicc" \
"CXX_PARALLEL = mpiicpc" \
"FC_SERIAL = ifort" \
"CC_SERIAL = icc" \
"CXX_SERIAL = icpc" \
"FFLAGS_PROMOTION = -real-size 64" \
"FFLAGS_OPT = -O3 -convert big_endian -free -align array64byte" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -g -convert big_endian -free -CU -CB -check all -fpe0 -traceback" \
"CFLAGS_DEBUG = -g -traceback" \
"CXXFLAGS_DEBUG = -g -traceback" \
"LDFLAGS_DEBUG = -g -fpe0 -traceback" \
"FFLAGS_OMP = -qopenmp" \
"CFLAGS_OMP = -qopenmp" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
gfortran: # BUILDTARGET GNU Fortran, C, and C++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = gfortran" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
"FFLAGS_OPT = -O3 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -g -ffree-line-length-none -fconvert=big-endian -ffree-form -fcheck=all -fbacktrace -ffpe-trap=invalid,zero,overflow" \
"CFLAGS_DEBUG = -g" \
"CXXFLAGS_DEBUG = -g" \
"LDFLAGS_DEBUG = -g" \
"FFLAGS_OMP = -fopenmp" \
"CFLAGS_OMP = -fopenmp" \
"FFLAGS_ACC =" \
"CFLAGS_ACC =" \
"PICFLAG = -fPIC" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
gfortran-clang: # BUILDTARGET GNU Fortran compiler with LLVM clang/clang++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc -cc=clang" \
"CXX_PARALLEL = mpicxx -cxx=clang++" \
"FC_SERIAL = gfortran" \
"CC_SERIAL = clang" \
"CXX_SERIAL = clang++" \
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
"FFLAGS_OPT = -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
"CFLAGS_OPT = -O3 -m64" \
"CXXFLAGS_OPT = -O3 -m64" \
"LDFLAGS_OPT = -O3 -m64" \
"FFLAGS_DEBUG = -g -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" \
"CFLAGS_DEBUG = -g -m64" \
"CXXFLAGS_DEBUG = -O3 -m64" \
"LDFLAGS_DEBUG = -g -m64" \
"FFLAGS_OMP = -fopenmp" \
"CFLAGS_OMP = -fopenmp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
g95: # BUILDTARGET (deprecated) G95 Fortran compiler with GNU C/C++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = g95" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -O3 -ffree-line-length-huge -fendian=big" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_OMP = -fopenmp" \
"CFLAGS_OMP = -fopenmp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
pathscale-nersc: # BUILDTARGET (deprecated) Pathscale compilers on NERSC machines
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -O3 -freeform -extend-source" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
cray-nersc: # BUILDTARGET (deprecated) Cray compilers on NERSC machines
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -default64" \
"FFLAGS_OPT = -O3 -f free" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_OMP = " \
"CFLAGS_OMP = " \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
gnu-nersc: # BUILDTARGET (deprecated) GNU compilers on NERSC machines
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
"FFLAGS_OPT = -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
"CFLAGS_OPT = -O3 -m64" \
"CXXFLAGS_OPT = -O3 -m64" \
"LDFLAGS_OPT = -O3 -m64" \
"FFLAGS_DEBUG = -g -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
"CFLAGS_DEBUG = -g -m64" \
"CXXFLAGS_DEBUG = -g -m64" \
"LDFLAGS_DEBUG = -g -m64" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"SERIAL = $(SERIAL)" \
"USE_PAPI = $(USE_PAPI)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI $(FILE_OFFSET) $(ZOLTAN_DEFINE)" )
intel-nersc: # BUILDTARGET (deprecated) Intel compilers on NERSC machines
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -real-size 64" \
"FFLAGS_OPT = -O3 -convert big_endian -free -align array64byte" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_OMP = -qopenmp" \
"CFLAGS_OMP = -qopenmp" \
"FFLAGS_DEBUG = -real-size 64 -g -convert big_endian -free -check all -gen-interfaces -warn interfaces -traceback" \
"CFLAGS_DEBUG = -g -traceback" \
"CXXFLAGS_DEBUG = -g -traceback" \
"LDFLAGS_DEBUG = -g -traceback" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
bluegene: # BUILDTARGET (deprecated) IBM XL compilers on BlueGene/Q systems
( $(MAKE) all \
"FC_PARALLEL = mpixlf95_r" \
"CC_PARALLEL = mpixlc_r" \
"CXX_PARALLEL = mpixlcxx_r" \
"FC_SERIAL = bgxlf95_r" \
"CC_SERIAL = bgxlc_r" \
"CXX_SERIAL = bgxlc++_r" \
"FFLAGS_PROMOTION = -qrealsize=8" \
"FFLAGS_OPT = -O2 -g" \
"CFLAGS_OPT = -O2 -g" \
"CXXFLAGS_OPT = -O2 -g" \
"LDFLAGS_OPT = -O2 -g" \
"FFLAGS_DEBUG = -O0 -g -C -qinitalloc -qinitauto" \
"CFLAGS_DEBUG = -O0 -g" \
"CXXFLAGS_DEBUG = -O0 -g" \
"LDFLAGS_DEBUG = -O0 -g" \
"FFLAGS_OMP = -qsmp=omp" \
"CFLAGS_OMP = -qsmp=omp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
llvm: # BUILDTARGET LLVM flang, clang, and clang++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpifort" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpic++" \
"FC_SERIAL = flang" \
"CC_SERIAL = clang" \
"CXX_SERIAL = clang++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -O3 -g -Mbyteswapio -Mfreeform" \
"CFLAGS_OPT = -O3 -g" \
"CXXFLAGS_OPT = -O3 -g" \
"LDFLAGS_OPT = -O3 -g" \
"FFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -Mbyteswapio -Mfreeform -Mstandard" \
"CFLAGS_DEBUG = -O0 -g -Weverything" \
"CXXFLAGS_DEBUG = -O0 -g -Weverything" \
"LDFLAGS_DEBUG = -O0 -g" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -fopenmp" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
nag: # BUILDTARGET NAG Fortran compiler and GNU C/C++ compilers
( $(MAKE) all \
"FC_PARALLEL = mpifort" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpic++" \
"FC_SERIAL = nagfor" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -free -mismatch -O3 -convert=big_ieee" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -free -mismatch -O0 -g -C -convert=big_ieee" \
"CFLAGS_DEBUG = -O0 -g -Wall -pedantic" \
"CXXFLAGS_DEBUG = -O0 -g -Wall -pedantic" \
"LDFLAGS_DEBUG = -O0 -g -C" \
"FFLAGS_OMP = -qsmp=omp" \
"CFLAGS_OMP = -qsmp=omp" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE -DNAG_COMPILER" )
cray: # BUILDTARGET Cray Programming Environment
( $(MAKE) all \
"FC_PARALLEL = ftn" \
"CC_PARALLEL = cc" \
"CXX_PARALLEL = CC" \
"FC_SERIAL = ftn" \
"CC_SERIAL = cc" \
"CXX_SERIAL = CC" \
"FFLAGS_PROMOTION = -sreal64" \
"FFLAGS_OPT = -Ofast -ffree" \
"CFLAGS_OPT = -Ofast" \
"CXXFLAGS_OPT = -Ofast" \
"LDFLAGS_OPT = -Ofast -hbyteswapio" \
"FFLAGS_DEBUG = -eD -O0 -ffree" \
"CFLAGS_DEBUG = -O0 -g -Weverything" \
"CXXFLAGS_DEBUG = -O0 -g -Weverything" \
"LDFLAGS_DEBUG = -eD -O0 -hbyteswapio" \
"FFLAGS_OMP = -homp" \
"CFLAGS_OMP = -fopenmp" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
CPPINCLUDES =
FCINCLUDES =
LIBS =
ifneq "$(PIO)" ""
#
# Regardless of PIO library version, look for a lib subdirectory of PIO path
# NB: PIO_LIB is used later, so we don't just set LIBS directly
#
ifneq ($(wildcard $(PIO)/lib), )
PIO_LIB = $(PIO)/lib
else
PIO_LIB = $(PIO)
endif
LIBS = -L$(PIO_LIB)
#
# Regardless of PIO library version, look for an include subdirectory of PIO path
#
ifneq ($(wildcard $(PIO)/include), )
CPPINCLUDES += -I$(PIO)/include
FCINCLUDES += -I$(PIO)/include
else
CPPINCLUDES += -I$(PIO)
FCINCLUDES += -I$(PIO)
endif
#
# Depending on PIO version, libraries may be libpio.a, or libpiof.a and libpioc.a
# Keep open the possibility of shared libraries in future with, e.g., .so suffix
#
# Check if libpio.* exists and link -lpio if so, but we make an exception for
# libpio.settings (a file added in PIO2), which is not a library to link
ifneq ($(wildcard $(PIO_LIB)/libpio\.*), )
# Makefiles don't support "and" operators so we have nested "if" instead
ifneq "$(wildcard $(PIO_LIB)/libpio\.*)" "$(PIO_LIB)/libpio.settings"
LIBS += -lpio
endif
endif
ifneq ($(wildcard $(PIO_LIB)/libpiof\.*), )
LIBS += -lpiof
endif
ifneq ($(wildcard $(PIO_LIB)/libpioc\.*), )
LIBS += -lpioc
endif
ifneq ($(wildcard $(PIO_LIB)/libgptl\.*), )
LIBS += -lgptl
endif
else # Not using PIO, using SMIOL
LIBS += -L$(PWD)/src/external/SMIOL -lsmiolf -lsmiol
FCINCLUDES += -I$(PWD)/src/external/SMIOL
endif
ifneq "$(NETCDF)" ""
ifneq ($(wildcard $(NETCDF)/lib), )
NETCDFLIBLOC = lib
endif
ifneq ($(wildcard $(NETCDF)/lib64), )
NETCDFLIBLOC = lib64
endif
CPPINCLUDES += -I$(NETCDF)/include
FCINCLUDES += -I$(NETCDF)/include
LIBS += -L$(NETCDF)/$(NETCDFLIBLOC)
NCLIB = -lnetcdf
NCLIBF = -lnetcdff
ifneq ($(wildcard $(NETCDF)/$(NETCDFLIBLOC)/libnetcdff.*), ) # CHECK FOR NETCDF4
LIBS += $(NCLIBF)
endif # CHECK FOR NETCDF4
ifneq "$(NETCDFF)" ""
FCINCLUDES += -I$(NETCDFF)/include
LIBS += -L$(NETCDFF)/$(NETCDFLIBLOC)
LIBS += $(NCLIBF)
endif
LIBS += $(NCLIB)
endif
ifneq "$(PNETCDF)" ""
ifneq ($(wildcard $(PNETCDF)/lib), )
PNETCDFLIBLOC = lib
endif
ifneq ($(wildcard $(PNETCDF)/lib64), )
PNETCDFLIBLOC = lib64
endif
CPPINCLUDES += -I$(PNETCDF)/include
FCINCLUDES += -I$(PNETCDF)/include
LIBS += -L$(PNETCDF)/$(PNETCDFLIBLOC) -lpnetcdf
endif
ifneq "$(LAPACK)" ""
LIBS += -L$(LAPACK)
LIBS += -llapack
LIBS += -lblas
endif
RM = rm -f
CPP = cpp -P -traditional
RANLIB = ranlib
ifdef CORE
ifneq ($(wildcard src/core_$(CORE)), ) # CHECK FOR EXISTENCE OF CORE DIRECTORY
ifneq ($(wildcard src/core_$(CORE)/build_options.mk), ) # Check for build_options.mk
include src/core_$(CORE)/build_options.mk
else # ELSE Use Default Options
EXE_NAME=$(CORE)_model
NAMELIST_SUFFIX=$(CORE)
endif
override CPPFLAGS += -DMPAS_NAMELIST_SUFFIX=$(NAMELIST_SUFFIX)
override CPPFLAGS += -DMPAS_EXE_NAME=$(EXE_NAME)
else # ELSE CORE DIRECTORY CHECK
report_builds: all
endif # END CORE DIRECTORY CHECK
ifeq "$(DEBUG)" "true"
ifndef FFLAGS_DEBUG
FFLAGS=$(FFLAGS_OPT)
CFLAGS=$(CFLAGS_OPT)
CXXFLAGS=$(CXXFLAGS_OPT)
LDFLAGS=$(LDFLAGS_OPT)
DEBUG_MESSAGE="Debug flags are not defined for this compile group. Defaulting to Optimized flags"
else # FFLAGS_DEBUG IF
FFLAGS=$(FFLAGS_DEBUG)
CFLAGS=$(CFLAGS_DEBUG)
CXXFLAGS=$(CXXFLAGS_DEBUG)
LDFLAGS=$(LDFLAGS_DEBUG)
override CPPFLAGS += -DMPAS_DEBUG
DEBUG_MESSAGE="Debugging is on."
endif # FFLAGS_DEBUG IF
else # DEBUG IF
FFLAGS=$(FFLAGS_OPT)
CFLAGS=$(CFLAGS_OPT)
CXXFLAGS=$(CXXFLAGS_OPT)
LDFLAGS=$(LDFLAGS_OPT)
DEBUG_MESSAGE="Debugging is off."
endif # DEBUG IF
FC=$(FC_PARALLEL)
CC=$(CC_PARALLEL)
CXX=$(CXX_PARALLEL)
SFC=$(FC_SERIAL)
SCC=$(CC_SERIAL)
PARALLEL_MESSAGE="Parallel version is on."
ifeq "$(OPENMP)" "true"
FFLAGS += $(FFLAGS_OMP)
CFLAGS += $(CFLAGS_OMP)
CXXFLAGS += $(CFLAGS_OMP)
override CPPFLAGS += "-DMPAS_OPENMP"
LDFLAGS += $(FFLAGS_OMP)
endif #OPENMP IF
ifeq "$(OPENACC)" "true"
FFLAGS += $(FFLAGS_ACC)
CFLAGS += $(CFLAGS_ACC)
CXXFLAGS += $(CFLAGS_ACC)
override CPPFLAGS += "-DMPAS_OPENACC"
LDFLAGS += $(FFLAGS_ACC)
endif #OPENACC IF
ifeq "$(OPENMP_OFFLOAD)" "true"
FFLAGS += $(FFLAGS_GPU)
CFLAGS += $(FFLAGS_GPU)
CXXFLAGS += $(FFLAGS_GPU)
override CPPFLAGS += "-DMPAS_OPENMP_OFFLOAD"
LDFLAGS += $(LDFLAGS_GPU)
endif #OPENMP_OFFLOAD IF
ifeq "$(PRECISION)" "single"
CFLAGS += "-DSINGLE_PRECISION"
CXXFLAGS += "-DSINGLE_PRECISION"
override CPPFLAGS += "-DSINGLE_PRECISION"
PRECISION_MESSAGE="MPAS was built with default single-precision reals."
else
FFLAGS += $(FFLAGS_PROMOTION)
PRECISION_MESSAGE="MPAS was built with default double-precision reals."
endif #PRECISION IF
ifeq "$(USE_PAPI)" "true"
CPPINCLUDES += -I$(PAPI)/include -D_PAPI
FCINCLUDES += -I$(PAPI)/include
LIBS += -L$(PAPI)/lib -lpapi
PAPI_MESSAGE="Papi libraries are on."
else # USE_PAPI IF
PAPI_MESSAGE="Papi libraries are off."
endif # USE_PAPI IF
# Only if this Makefile was invoked from a compiler target should we check that PICFLAG is set
ifneq "$(FC_SERIAL)" ""
ifeq "$(SHAREDLIB)" "true"
ifneq "$(PICFLAG)" ""
FFLAGS += $(PICFLAG)
CFLAGS += $(PICFLAG)
CXXFLAGS += $(PICFLAG)
LDFLAGS += $(PICFLAG)
SHAREDLIB_MESSAGE="Position-independent code was generated."
else
$(error Position-independent code was requested but PIC flags are not available. Please add PIC flags for the '$(BUILD_TARGET)' target)
endif
else
SHAREDLIB_MESSAGE="Position-dependent code was generated."
endif
endif
ifdef TIMER_LIB
ifeq "$(TIMER_LIB)" "tau"
override TAU=true
TIMER_MESSAGE="TAU is being used for the timer interface"
endif
ifeq "$(TIMER_LIB)" "gptl"
override CPPFLAGS += -DMPAS_GPTL_TIMERS
override FCINCLUDES += -I${GPTL}/include
override LIBS += -L${GPTL}/lib -lgptl
TIMER_MESSAGE="GPTL is being used for the timer interface"
endif
ifeq "$(TIMER_LIB)" ""
override CPPFLAGS += -DMPAS_NATIVE_TIMERS
TIMER_MESSAGE="The native timer interface is being used"
endif
else # else ifdef $(TIMER_LIB)
override CPPFLAGS += -DMPAS_NATIVE_TIMERS
TIMER_MESSAGE="The native timer interface is being used"
endif # endif ifdef $(TIMER_LIB)
ifeq "$(TAU)" "true"
LINKER=tau_f90.sh
CPPINCLUDES += -DMPAS_TAU -DMPAS_TAU_TIMERS
TAU_MESSAGE="TAU Hooks are on."
else
LINKER=$(FC)
TAU_MESSAGE="TAU Hooks are off."
endif
ifeq "$(GEN_F90)" "true"
override CPPFLAGS += -Uvector
GEN_F90_MESSAGE="MPAS generated and was built with intermediate .f90 files."
else
override GEN_F90=false
GEN_F90_MESSAGE="MPAS was built with .F files."
endif
ifeq "$(OPENMP)" "true"
OPENMP_MESSAGE="MPAS was built with OpenMP enabled."
else
OPENMP_MESSAGE="MPAS was built without OpenMP support."
endif
ifeq "$(OPENMP_OFFLOAD)" "true"
OPENMP_OFFLOAD_MESSAGE="MPAS was built with OpenMP-offload GPU support enabled."
else
OPENMP_OFFLOAD_MESSAGE="MPAS was built without OpenMP-offload GPU support."
endif
ifeq "$(OPENACC)" "true"
OPENACC_MESSAGE="MPAS was built with OpenACC accelerator support enabled."
else
OPENACC_MESSAGE="MPAS was built without OpenACC accelerator support."
endif
ifneq ($(wildcard .mpas_core_*), ) # CHECK FOR BUILT CORE
ifneq ($(wildcard .mpas_core_$(CORE)), ) # CHECK FOR SAME CORE AS ATTEMPTED BUILD.
override AUTOCLEAN=false
CONTINUE=true
else
LAST_CORE=`cat .mpas_core_*`
ifeq "$(AUTOCLEAN)" "true" # CHECK FOR CLEAN PRIOR TO BUILD OF A NEW CORE.
CONTINUE=true
AUTOCLEAN_MESSAGE="Infrastructure was cleaned prior to building ."
else
CONTINUE=false
endif # END OF AUTOCLEAN CHECK
endif # END OF CORE=LAST_CORE CHECK
else
override AUTOCLEAN=false
CONTINUE=true
endif # END IF BUILT CORE CHECK
ifneq ($(wildcard namelist.$(NAMELIST_SUFFIX)), ) # Check for generated namelist file.
NAMELIST_MESSAGE="A default namelist file (namelist.$(NAMELIST_SUFFIX).defaults) has been generated, but namelist.$(NAMELIST_SUFFIX) has not been modified."
else
NAMELIST_MESSAGE="A default namelist file (namelist.$(NAMELIST_SUFFIX).defaults) has been generated and copied to namelist.$(NAMELIST_SUFFIX)."
endif
ifneq ($(wildcard streams.$(NAMELIST_SUFFIX)), ) # Check for generated streams file.
STREAM_MESSAGE="A default streams file (streams.$(NAMELIST_SUFFIX).defaults) has been generated, but streams.$(NAMELIST_SUFFIX) has not been modified."
else
STREAM_MESSAGE="A default streams file (streams.$(NAMELIST_SUFFIX).defaults) has been generated and copied to streams.$(NAMELIST_SUFFIX)."
endif
ifeq "$(findstring clean, $(MAKECMDGOALS))" "clean" # CHECK FOR CLEAN TARGET
override AUTOCLEAN=false
endif # END OF CLEAN TARGET CHECK
VER=$(shell git describe --dirty 2> /dev/null)
#override CPPFLAGS += -DMPAS_GIT_VERSION=$(VER)
ifeq "$(findstring v, $(VER))" "v"
override CPPFLAGS += -DMPAS_GIT_VERSION=$(VER)
else
override CPPFLAGS += -DMPAS_GIT_VERSION="unknown"
endif # END OF GIT DESCRIBE VERSION
####################################################
# Section for adding external libraries and includes
####################################################
ifdef MPAS_EXTERNAL_LIBS
override LIBS += $(MPAS_EXTERNAL_LIBS)
endif
ifdef MPAS_EXTERNAL_INCLUDES
override CPPINCLUDES += $(MPAS_EXTERNAL_INCLUDES)
override FCINCLUDES += $(MPAS_EXTERNAL_INCLUDES)
endif
ifdef MPAS_EXTERNAL_CPPFLAGS
override CPPFLAGS += $(MPAS_EXTERNAL_CPPFLAGS)
endif
####################################################
override CPPFLAGS += -DMPAS_BUILD_TARGET=$(BUILD_TARGET)
ifeq ($(wildcard src/core_$(CORE)), ) # CHECK FOR EXISTENCE OF CORE DIRECTORY
all: core_error
else