-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (43 loc) · 1.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# makefile: makes the learn_dg program
SRC=$(shell pwd)/src
OBJ=$(shell pwd)/obj
BIN=$(shell pwd)/bin
DOC=$(shell pwd)/docs
# Compiler
FF = gfortran
FFLAGS = -Wall -std=f2008 -Wextra -fPIC -fmax-errors=1 -Wimplicit-interface
FFLAGS += -O0 -g -fcheck=all -fbacktrace
# Ford
# FORD = ford
FORD = $(HOME)/Projects/ford/ford.py
FORD_FLAGS = -d $(SRC) -o $(DOC)
default: docs
# Dependencies of main program
objects=$(OBJ)/external.o \
$(OBJ)/square.o
objects_ex=$(OBJ)/external_ex.o \
$(OBJ)/square.o
$(OBJ)/square.o: $(SRC)/square.f90
$(FF) $(FFLAGS) -J$(OBJ) -c -o $@ $<
$(OBJ)/external.o: $(SRC)/external.f90 $(OBJ)/square.o
$(FF) $(FFLAGS) -J$(OBJ) -c -o $@ $<
$(OBJ)/external_ex.o: $(SRC)/external_ex.f90 $(OBJ)/square.o
$(FF) $(FFLAGS) -J$(OBJ) -c -o $@ $<
# Main program(s)
$(OBJ)/main.o: $(SRC)/main.f90 $(objects)
$(FF) $(FFLAGS) -I$(OBJ) -J$(OBJ) -c -o $@ $< $(FLIBS)
$(BIN)/main: $(OBJ)/main.o $(objects)
$(FF) $(FFLAGS) -o $@ $+ $(FLIBS)
$(OBJ)/main_ex.o: $(SRC)/main_ex.f90 $(objects_ex)
$(FF) $(FFLAGS) -I$(OBJ) -J$(OBJ) -c -o $@ $< $(FLIBS)
$(BIN)/main_ex: $(OBJ)/main_ex.o $(objects_ex)
$(FF) $(FFLAGS) -o $@ $+ $(FLIBS)
build: $(BIN)/main $(BIN)/main_ex
run: build
$(BIN)/main > /dev/null 2>&1
$(BIN)/main_ex > /dev/null 2>&1
.PHONY: docs
docs: build run
$(FORD) $(FORD_FLAGS) project.md
clean:
rm -rf $(OBJ)/*.o $(OBJ)/*.mod $(BIN)/main* $(DOC)/*