@@ -12,9 +12,6 @@ ifneq ($(NO_CONFIG_CHECKING),TRUE)
1212endif
1313
1414CXX = $(HIP_PATH ) /bin/hipcc
15- CC = $(HIP_PATH ) /bin/hipcc
16- FC = gfortran
17- F90 = gfortran
1815
1916ifdef CXXSTD
2017 CXXSTD := $(strip $(CXXSTD ) )
2421
2522# Generic flags, always used
2623CXXFLAGS = -std=$(CXXSTD ) -m64
27- CFLAGS = -std=c11 -m64
28-
29- FFLAGS = -ffixed-line-length-none -fno-range-check -fno-second-underscore
30- F90FLAGS = -ffree-line-length-none -fno-range-check -fno-second-underscore -fimplicit-none
31-
32- FMODULES = -J$(fmoddir ) -I $(fmoddir )
3324
3425# rdc support
3526ifeq ($(USE_GPU_RDC ) ,TRUE)
@@ -44,110 +35,37 @@ HIPCC_FLAGS += -pthread
4435
4536CXXFLAGS += $(HIPCC_FLAGS )
4637
47- # add fopenmp targeting the gnu library
48- ifeq ($(USE_OMP ) ,TRUE)
49- CXXFLAGS += -fopenmp=libgomp
50- CFLAGS += -fopenmp=libgomp
51- HIPCC_FLAGS += -fopenmp=libgomp
52- endif
53-
54- ifneq ($(BL_NO_FORT ) ,TRUE)
55-
56- # Taken straight from gnu
57- # ask gfortran the name of the library to link in. First check for the
58- # static version. If it returns only the name w/o a path, then it
59- # was not found. In that case, ask for the shared-object version.
60- gfortran_liba = $(shell $(F90 ) -print-file-name=libgfortran.a)
61- gfortran_libso = $(shell $(F90 ) -print-file-name=libgfortran.so)
38+ # =============================================================================================
6239
63- ifneq ($(gfortran_liba ) ,libgfortran.a) # if found the full path is printed, thus `neq`.
64- LIBRARY_LOCATIONS += $( dir $( gfortran_liba ) )
40+ ifeq ($(DEBUG ) ,TRUE)
41+ CXXFLAGS += -g -O1
6542else
66- LIBRARY_LOCATIONS += $( dir $( gfortran_libso ) )
43+ CXXFLAGS += -gline-tables-only -fdebug-info-for-profiling -O3
6744endif
6845
69- override XTRALIBS += -lgfortran
70-
71- quadmath_liba = $(shell $(F90 ) -print-file-name=libquadmath.a)
72- quadmath_libso = $(shell $(F90 ) -print-file-name=libquadmath.so)
73-
74- ifneq ($(quadmath_liba ) ,libquadmath.a)
75- override XTRALIBS += -lquadmath
76- else ifneq ($(quadmath_libso),libquadmath.so)
77- override XTRALIBS += -lquadmath
78- endif
46+ ifeq ($(WARN_ALL ) ,TRUE)
47+ warning_flags = -Wall -Wextra -Wunreachable-code -Wnull-dereference
48+ warning_flags += -Wfloat-conversion -Wextra-semi
7949
80- endif # BL_NO_FORT
81-
82- # =============================================================================================
83-
84- ifeq ($(HIP_COMPILER ) ,clang)
85-
86- ifeq ($(DEBUG),TRUE)
87- CXXFLAGS += -g -O1 -munsafe-fp-atomics
88- CFLAGS += -g -O0
89-
90- FFLAGS += -g -O0 -ggdb -fbounds-check -fbacktrace -Wuninitialized -Wunused -ffpe-trap=invalid,zero -finit-real=snan -finit-integer=2147483647 -ftrapv
91- F90FLAGS += -g -O0 -ggdb -fbounds-check -fbacktrace -Wuninitialized -Wunused -ffpe-trap=invalid,zero -finit-real=snan -finit-integer=2147483647 -ftrapv
92-
93- else # DEBUG=FALSE flags
94-
95- CXXFLAGS += -gline-tables-only -fdebug-info-for-profiling -O3 -munsafe-fp-atomics
96- CFLAGS += -gline-tables-only -fdebug-info-for-profiling -O3
97- FFLAGS += -g1 -O3
98- F90FLAGS += -g1 -O3
50+ warning_flags += -Wpedantic
9951
52+ ifneq ($(WARN_SHADOW),FALSE)
53+ warning_flags += -Wshadow
10054 endif
10155
102- ifeq ($(WARN_ALL),TRUE)
103- warning_flags = -Wall -Wextra -Wunreachable-code -Wnull-dereference
104- warning_flags += -Wfloat-conversion -Wextra-semi
105-
106- warning_flags += -Wpedantic
107-
108- ifneq ($(WARN_SHADOW),FALSE)
109- warning_flags += -Wshadow
110- endif
111-
112- CXXFLAGS += $(warning_flags ) -Woverloaded-virtual
113- CFLAGS += $(warning_flags )
114- endif
115-
116- ifeq ($(WARN_ERROR),TRUE)
117- CXXFLAGS += -Werror -Wno-deprecated-declarations -Wno-gnu-zero-variadic-macro-arguments
118- CFLAGS += -Werror
119- endif
120-
121- # Generic HIP info
122- ROC_PATH =$(realpath $(dir $(HIP_PATH ) ) )
123- SYSTEM_INCLUDE_LOCATIONS += $(ROC_PATH ) /include $(HIP_PATH ) /include
124-
125- # rocRand
126- SYSTEM_INCLUDE_LOCATIONS += $(ROC_PATH ) /include/hiprand $(ROC_PATH ) /include/rocrand
127- LIBRARY_LOCATIONS += $(ROC_PATH ) /lib
128- LIBRARIES += -Wl,--rpath=$(ROC_PATH ) /lib -lhiprand -lrocrand
129-
130- # rocPrim - Header only
131- SYSTEM_INCLUDE_LOCATIONS += $(ROC_PATH ) /include/rocprim
132-
133- # rocThrust - Header only
134- # SYSTEM_INCLUDE_LOCATIONS += $(ROC_PATH)/include/rocthrust
135-
136- # rocTracer
137- ifeq ($(USE_ROCTX),TRUE)
138- CXXFLAGS += -DAMREX_USE_ROCTX
139- HIPCC_FLAGS += -DAMREX_USE_ROCTX
140- LIBRARY_LOCATIONS += $(ROC_PATH ) /lib
141- LIBRARIES += -Wl,--rpath=$(ROC_PATH ) /lib -lroctracer64 -lroctx64
142- endif
56+ CXXFLAGS += $(warning_flags ) -Woverloaded-virtual
57+ CFLAGS += $(warning_flags )
58+ endif
14359
144- # hipcc passes a lot of unused arguments to clang
145- LEGACY_DEPFLAGS += -Wno-unused-command-line-argument
60+ ifeq ($(WARN_ERROR ) ,TRUE)
61+ CXXFLAGS += -Werror -Wno-deprecated-declarations -Wno-gnu-zero-variadic-macro-arguments
62+ CFLAGS += -Werror
63+ endif
14664
147- # =============================================================================================
65+ # Generic HIP info
66+ ROC_PATH =$(realpath $(dir $(HIP_PATH ) ) )
67+ SYSTEM_INCLUDE_LOCATIONS += $(ROC_PATH ) /include $(HIP_PATH ) /include
14868
149- else ifeq ($(HIP_COMPILER),nvcc)
150- $(error HIP_COMPILER nvcc is not supported at this time. Use USE_CUDA to compile for NVIDIA platforms.)
151- endif
69+ # hipcc passes a lot of unused arguments to clang
70+ LEGACY_DEPFLAGS += -Wno-unused-command-line-argument
15271
153- # =============================================================================================
0 commit comments