Skip to content

Commit

Permalink
Added debug and opt flags for makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrysdale committed Feb 16, 2024
1 parent c4522fb commit 0b04afd
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
FC := gfortran
LD := $(FC)
RM := rm -f
CFLAGS= -Wall -Wextra -O2
DEBUGFLAGS=-g
OPTFLAGS=-O2

# Source files
SRCS := src/closed_loop_lumped.f90 \
Expand All @@ -15,20 +18,31 @@ SRCS := src/closed_loop_lumped.f90 \
src/thermoregulation.f90 \
app/main.f90
PROG := closed_loop_lumped
LIB := $(PROG).so
OBJS := $(addsuffix .o, $(SRCS))

.PHONY: all clean
.PHONY: all clean debug
all: $(PROG)

$(PROG): $(OBJS)
$(LD) -o $@ $^

$(OBJS): %.o: %
$(FC) -c -o $@ $<
$(FC) $(CFLAGS) -c -o $@ $<

lib: $(OBJS)
$(FC) -c $(SRCS)
$(FC) -m64 -shared $(LIB) -o $(PROG).so $(OBJS)
debug: CFLAGS+=$(DEBUGFLAGS)
debug: $(PROG)
debug: $(LIB)

opt: CFLAGS+=$(OPTFLAGS)
opt: $(PROG)
opt: $(LIB)

$(LIB): $(OBJS)
$(FC) $(CFLAGS) -c $(SRCS)
$(FC) $(CFLAGS) -m64 -shared -o $(LIB) $(OBJS)

lib: $(LIB)

# Defines module interdependencies
main.mod := src/kind_parameter.f90.o \
Expand Down

0 comments on commit 0b04afd

Please sign in to comment.