Skip to content

Commit

Permalink
Avoiding "empty object file" warning bit me
Browse files Browse the repository at this point in the history
I tried to be smart about which compilers included cvmix_kinds_and_types.o in
libcvmix.a to avoid warnings when some compilers (basically all but PGI) create
an empty object file; this extra layer of complexity caused problems when
building CVMix as part of CESM on yellowstone with the PGI compiler. I don't
know why I was so interested in suppressing this particular warning message in
the first place, but I'll need to make a new CVMix tag to fix the POP build
issues.
  • Loading branch information
mnlevy1981 committed Jul 29, 2014
1 parent 1c9f41b commit dcc37d2
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/shared/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ ifeq ($(FC),NONE)
NOFC = TRUE
endif

MODULES = cvmix_background.F90 \
MODULES = cvmix_kinds_and_types.F90 \
cvmix_background.F90 \
cvmix_convection.F90 \
cvmix_ddiff.F90 \
cvmix_kpp.F90 \
Expand All @@ -27,22 +28,16 @@ MODULES = cvmix_background.F90 \

# Some compilers produce ALL_UPPER_CASE.mod files
ifeq ($(UCASE),TRUE)
MODS_TMP = CVMIX_KINDS_AND_TYPES.F90 \
$(shell echo $(MODULES) | tr '[a-z]' '[A-Z]')
MODS_TMP = $(shell echo $(MODULES) | tr '[a-z]' '[A-Z]')
else
MODS_TMP = cvmix_kinds_and_types.F90 \
$(MODULES)
MODS_TMP = $(MODULES)
endif
ifneq ($(OBJ_DIR),$(INC_DIR))
INCS = $(addprefix $(INC_DIR)/,${MODS_TMP:.F90=.mod})
endif
MODS = $(addprefix $(OBJ_DIR)/,${MODS_TMP:.F90=.mod}) \
$(INCS)
OBJS = $(addprefix $(OBJ_DIR)/,${MODULES:.F90=.o})
KINDS_OBJ = $(OBJ_DIR)/cvmix_kinds_and_types.o
ifeq ($(FC),$(filter $(FC),pgf90 ftn))
OBJS += $(KINDS_OBJ)
endif

ifeq ($(USE_DEPS),TRUE)
include $(DEP_FILE)
Expand All @@ -64,7 +59,7 @@ ifneq ($(INC_DIR),$(OBJ_DIR))
endif

### Combine into library
$(LIB_DIR)/libcvmix.a: $(KINDS_OBJ) $(OBJS)
$(LIB_DIR)/libcvmix.a: $(OBJS)
ar -ru $(LIB_DIR)/libcvmix.a $(OBJS)

$(DEP_FILE): $(MAKE_DEP) $(SRC_DIR)/*.F90
Expand All @@ -90,5 +85,5 @@ check:

# Remove library, object files, module files, and dependency file
clean:
/bin/rm -f $(LIB_DIR)/libcvmix.a $(OBJS) $(KINDS_OBJ) $(MODS) $(DEP_FILE)
/bin/rm -f $(LIB_DIR)/libcvmix.a $(OBJS) $(MODS) $(DEP_FILE)

0 comments on commit dcc37d2

Please sign in to comment.