From 41ae4b77d8e0fd89f469e28f2b14b58ce9468558 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 5 Oct 2011 10:00:03 -0400 Subject: [PATCH] Changed passing of variables between recursive makes. DEBUG options can be effectively passed now. --- src/Makefile | 12 ++++----- src/xml-fortran/Makefile | 42 +++++------------------------- src/xml-fortran/templates/Makefile | 40 ++++------------------------ 3 files changed, 18 insertions(+), 76 deletions(-) diff --git a/src/Makefile b/src/Makefile index c5008b7f1c..e685c03dfe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,7 +15,7 @@ include OBJECTS # User Options #=============================================================================== -COMPILER = gfortran +COMPILER = intel DEBUG = no PROFILE = no OPTIMIZE = no @@ -31,7 +31,7 @@ USE_COARRAY = no ifeq ($(COMPILER),intel) F90 = ifort - F90FLAGS = -Ixml-fortran -Ixml-fortran/templates -fpp -warn + F90FLAGS := -fpp -warn LDFLAGS = endif @@ -39,7 +39,7 @@ endif ifeq ($(COMPILER),gfortran) F90 = gfortran - F90FLAGS = -Ixml-fortran -Ixml-fortran/templates -cpp -Wall + F90FLAGS := -cpp -Wall LDFLAGS = endif @@ -100,8 +100,8 @@ endif all: xml-fortran $(program) xml-fortran: - cd xml-fortran; make COMPILER=$(COMPILER) - cd xml-fortran/templates; make COMPILER=$(COMPILER) + cd xml-fortran; make F90=$(F90) F90FLAGS="$(F90FLAGS)" + cd xml-fortran/templates; make F90=$(F90) F90FLAGS="$(F90FLAGS)" $(program): $(objects) $(F90) $(objects) $(templates) $(xml_fort) -o $@ $(LDFLAGS) distclean: clean @@ -120,7 +120,7 @@ neat: .PHONY: all xml-fortran clean neat distclean %.o: %.f90 - $(F90) $(F90FLAGS) -c $< + $(F90) -Ixml-fortran -Ixml-fortran/templates $(F90FLAGS) -c $< #=============================================================================== # Dependencies diff --git a/src/xml-fortran/Makefile b/src/xml-fortran/Makefile index eebbfec33b..6e963f0595 100644 --- a/src/xml-fortran/Makefile +++ b/src/xml-fortran/Makefile @@ -1,43 +1,15 @@ reader = xmlreader -xml_fortran_source = $(wildcard *.f90) -xml_fortran_objects = $(xml_fortran_source:.f90=.o) - -#=============================================================================== -# User Options -#=============================================================================== - -DEBUG = no +source = $(wildcard *.f90) +objects = $(source:.f90=.o) #=============================================================================== # Compiler Options #=============================================================================== -# Intel Fortran compiler options +# Ignore unused variables -ifeq ($(COMPILER),intel) - F90 = ifort - F90FLAGS += -fpp -endif - -# GNU Fortran compiler options - -ifeq ($(COMPILER),gfortran) - F90 = gfortran - F90FLAGS += -cpp -Wall -endif - -# Set compiler flags for debugging - -ifeq ($(DEBUG),yes) - F90FLAGS += -g - LDFLAGS += -g - ifeq ($(COMPILER),intel) - F90FLAGS += -traceback -ftrapuv -fp-stack-check -check all - endif - ifeq ($(COMPILER),gfortran) - F90FLAGS += -pedantic -std=f2008 -fbacktrace -fbounds-check \ - -ffpe-trap=invalid,zero,overflow,underflow - endif +ifeq ($(F90),ifort) + override F90FLAGS += -warn nounused endif #=============================================================================== @@ -45,8 +17,8 @@ endif #=============================================================================== all: $(reader) -$(reader): $(xml_fortran_objects) - $(F90) $(xml_fortran_objects) -o $@ $(LDFLAGS) +$(reader): $(objects) + $(F90) $(objects) -o $@ clean: @rm -f *.o *.mod $(reader) neat: diff --git a/src/xml-fortran/templates/Makefile b/src/xml-fortran/templates/Makefile index 8c0cce3ff8..1dc049211e 100644 --- a/src/xml-fortran/templates/Makefile +++ b/src/xml-fortran/templates/Makefile @@ -1,48 +1,18 @@ templates = $(wildcard *.xml) objects = $(templates:.xml=.o) -#=============================================================================== -# User Options -#=============================================================================== - -DEBUG = no - #=============================================================================== # Compiler Options #=============================================================================== -# Set compiler defaults +# Add include for subdirectory -F90 = gfortran -F90FLAGS = -I.. -LDFLAGS = +override F90FLAGS += -I.. -# Intel Fortran compiler options +# Ignore unused variables -ifeq ($(COMPILER),intel) - F90 = ifort - F90FLAGS += -fpp -endif - -# GNU Fortran compiler options - -ifeq ($(COMPILER),gfortran) - F90 = gfortran - F90FLAGS += -cpp -Wall -endif - -# Set compiler flags for debugging - -ifeq ($(DEBUG),yes) - F90FLAGS += -g - LDFLAGS += -g - ifeq ($(COMPILER),intel) - F90FLAGS += -traceback -ftrapuv -fp-stack-check -check all - endif - ifeq ($(COMPILER),gfortran) - F90FLAGS += -pedantic -std=f2008 -fbacktrace -fbounds-check \ - -ffpe-trap=invalid,zero,overflow,underflow - endif +ifeq ($(F90),ifort) + override F90FLAGS += -warn nounused endif #===============================================================================