Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ MODULE_FILES = $(subst .F,.mod, $(subst .F90,.mod, $(subst .f,.mod, $(subst .f90
MODULE_PATHS = $(sort $(dir $(MODULE_FILES)))
MODULE_OBJECTS = $(subst .F,.o, $(subst .F90,.o, $(subst .f,.o, $(subst .f90,.o, $(MODULES)))))

# list of all paths containing sources:
SOURCE_PATHS = $(sort $(dir $(SOURCES)))
# list of all .mod files on these paths (to remove with 'make new'):
RM_MODULE_FILES = $(addsuffix *.mod,$(MODULE_PATHS))
RM_MODULE_FILES += $(addsuffix *.mod,$(SOURCE_PATHS))
ALL_MODULE_FILES = $(sort $(RM_MODULE_FILES))
# note that this should contain everything in MODULE_FILES but maybe
# additional ones if the user has a local version of some module in a
# different directory. Previously the library version of .mod was not removed
# in that case, and was wrongly used by library routines that "use" the module.


#----------------------------------------------------------------------------
# Compiling, linking, and include flags
# User set flags, empty if not set
Expand Down Expand Up @@ -116,7 +128,7 @@ endif

#----------------------------------------------------------------------------
# Targets that do not correspond to file names:
.PHONY: .objs .exe clean clobber new all output plots;
.PHONY: .objs .exe clean clobber new all output plots debug_new;

# Reset suffixes that we understand
.SUFFIXES:
Expand Down Expand Up @@ -255,10 +267,16 @@ plots: $(SETPLOT_FILE) $(MAKEFILE_LIST);
new: $(MAKEFILE_LIST)
-rm -f $(OBJECTS)
-rm -f $(MODULE_OBJECTS)
-rm -f $(MODULE_FILES)
-rm -f $(ALL_MODULE_FILES)
-rm -f $(EXE)
$(MAKE) $(EXE) MAKELEVEL=0 -f $(MAKEFILE_LIST)

debug_new:
@echo MODULE_PATHS: $(MODULE_PATHS)
@echo SOURCE_PATHS: $(SOURCE_PATHS)
@echo ALL_MODULE_FILES: $(ALL_MODULE_FILES)



# Clean up options:
clean:
Expand Down