-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (33 loc) · 873 Bytes
/
Copy pathMakefile
File metadata and controls
42 lines (33 loc) · 873 Bytes
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
CC = gfortran
CPP = $(CC) -cpp
CCFLAGS = -g -Wall
LDFLAGS = `pkg-config --cflags --libs gtk-4-fortran`
# Makefile settings - Can be customized.
APPNAME = bfcv
EXT = .f90
SRCDIR = src
OBJDIR = obj
SRC = $(wildcard $(SRCDIR)/*$(EXT))
OBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)/%.o)
DEP = $(OBJ:$(OBJDIR)/%.o=%.d)
RM = rm
all: $(APPNAME)
# Builds the app
$(APPNAME): $(OBJ)
$(CC) $(CCFLAGS) -o $@ $^ $(LDFLAGS)
# Creates the dependecy rules
%.d: $(SRCDIR)/%$(EXT)
@$(CPP) $(CCFLAGS) $< -MM -MT $(@:%.d=$(OBJDIR)/%.o) >$@ $(LDFLAGS)
# Includes all .h files
-include $(DEP)
# Building rule for .o files and its .c/.cpp in combination with all .h
$(OBJDIR)/%.o: $(SRCDIR)/%$(EXT)
mkdir -p $(OBJDIR) 2> /dev/null
$(CC) $(CCFLAGS) -o $@ -c $< $(LDFLAGS)
# Cleans complete project
.PHONY: clean
clean:
$(RM) $(OBJ) $(DEP) $(APPNAME)
# Runs project
run: all
./$(APPNAME)