Changed passing of variables between recursive makes. DEBUG options can be effectively passed now.

This commit is contained in:
Paul Romano 2011-10-05 10:00:03 -04:00
parent 9717c887ca
commit 41ae4b77d8
3 changed files with 18 additions and 76 deletions

View file

@ -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

View file

@ -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:

View file

@ -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
#===============================================================================