Commit e81ac496 authored by Wolfgang Kilian's avatar Wolfgang Kilian
Browse files

Initial commit: Makefile

parents
########################################################################
### Variables
# Compiler
FC = gfortran
FCFLAGS = -fcheck=all
LDFLAGS =
# Program
MAIN = nnet
# Source code
MAIN_SRC = $(MAIN).f90
MODULES_SRC =
# Test output and reference
OUTPUT = $(MAIN).out
REFERENCE = $(MAIN).ref
# Module and object file names
MAIN_OBJ = $(MAIN_SRC:.f90=.o)
OBJECTS = $(MODULES_SRC:.f90=.o) $(MAIN_OBJ)
MODULES = $(MODULES_SRC:.f90=.mod)
########################################################################
### Targets
# Main target: run the main program (for testing)
all: check
# Test: compare output with reference
check: $(OUTPUT) $(REFERENCE)
diff $(OUTPUT) $(REFERENCE)
# Cleanup: remove generated files
clean:
rm -f $(MODULES)
rm -f $(OBJECTS)
rm -f $(OUTPUT)
realclean: clean
rm -f $(MAIN)
.PHONY: all check clean realclean
########################################################################
### Further rules and dependencies
$(OUTPUT): $(MAIN)
./$(MAIN)
$(MAIN): $(OBJECTS)
$(FC) $(FCFLAGS) $(LDFLAGS) $^ -o $@
### Fortran compiler execution:
%.o %.mod: %.f90
$(FC) $(FCFLAGS) -c $<
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment