-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extending the feature introduced in the previous revision, this one a…
…dds automatic tracing of the command lines used to compile different classes (C, Fortran, and executables). So now it is not necessary to track makefiles or options used in their invocation - only the final command line (name of compiler and flags) matters. This information is kept in .*opts files in both seq and mpi folders. Another change is that common parts of specific Makefiles was moved to a separate file common.mk that is included from each of the former. This common file is responsible for processing both dependencies and .*opts files. Also, most of variable assignments in makefiles were changed to immediate ":=", thus it is easier to keep track of their values, especially in the main Makefile.
- Loading branch information
Showing
4 changed files
with
180 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Common part of makefiles for different versions of ADDA package | ||
# All options are defined in Makefile and specific makefiles | ||
# $Author: yurkin $ | ||
# $Date:: 2010-09-06 18:17:09 +0700 #$ | ||
# | ||
# Copyright (C) 2010 Institute of Chemical Kinetics and Combustion & University of Amsterdam | ||
# This file is part of ADDA. | ||
# | ||
# ADDA is free software: you can redistribute it and/or modify it under the terms of the GNU | ||
# General Public License as published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# ADDA is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | ||
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with ADDA. If not, see | ||
# <http://www.gnu.org/licenses/>. | ||
|
||
# !!! This file do not have any options designed to be changed by ADDA user | ||
|
||
# The following are used to track whether recompilation of corresponding parts is required | ||
LDCMD := $(MYCC) $(LDFLAGS) | ||
CCMD := $(MYCC) $(CFLAGS) | ||
FCMD := $(MYCF) $(FFLAGS) | ||
|
||
READ_FILE = $(shell if [ -f $(1) ]; then cat $(1); fi) | ||
|
||
ifneq ($(call READ_FILE,$(LDOPTSFILE)),$(LDCMD)) | ||
$(shell rm -f $(LDOPTSFILE)) | ||
endif | ||
ifneq ($(call READ_FILE,$(COPTSFILE)),$(CCMD)) | ||
$(shell rm -f $(COPTSFILE)) | ||
endif | ||
ifneq ($(call READ_FILE,$(FOPTSFILE)),$(FCMD)) | ||
$(shell rm -f $(FOPTSFILE)) | ||
endif | ||
|
||
vpath %.c $(CPATH) | ||
vpath %.h $(HPATH) | ||
vpath %.f $(FPATH) | ||
|
||
#=================================================================================================== | ||
# Main action part | ||
#=================================================================================================== | ||
|
||
.DELETE_ON_ERROR: | ||
|
||
$(PROG): $(COBJECTS) $(FOBJECTS) $(LDOPTSFILE) | ||
@echo "Building $@" | ||
$(MYCC) -o $@ $(COBJECTS) $(FOBJECTS) $(LDFLAGS) | ||
|
||
$(COBJECTS): %.o: %.c %.d | ||
$(MYCC) -c $(CFLAGS) $< | ||
|
||
$(FOBJECTS): %.o: %.f $(FOPTSFILE) | ||
$(MYCF) -c $(FFLAGS) $< | ||
|
||
# Dependencies are only generated for C sources; we assume that each Fortran file is completely | ||
# independent or all of them are compiled at once. | ||
|
||
$(CDEPEND): %.d: %.c $(COPTSFILE) | ||
$(MYCC) $(DEPFLAG) $(CFLAGS) $< $(DFFLAG) $@.$$$$; \ | ||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ | ||
rm -f $@.$$$$ | ||
|
||
$(LDOPTSFILE): | ||
@echo Linking needs to be redone | ||
echo -n "$(LDCMD)" > $@ | ||
|
||
$(COPTSFILE): | ||
@echo C sources need to be recompiled | ||
echo -n "$(CCMD)" > $@ | ||
|
||
$(FOPTSFILE): | ||
@echo Fortran sources need to be recompiled | ||
echo -n "$(FCMD)" > $@ | ||
|
||
|
||
-include $(CDEPEND) |
Oops, something went wrong.