Add profiling flag

This commit is contained in:
Cory Balaton 2023-10-13 15:37:26 +02:00
parent ae7b437ac3
commit 11757e5e28
No known key found for this signature in database
GPG Key ID: 3E5FCEBFD80F432B

View File

@ -8,7 +8,7 @@ CLASSOBJS=$(CLASSSRCS:.cpp=.o)
INCLUDE=../include
CFLAGS=-larmadillo -llapack -std=c++11 -O2
CFLAGS=-Wall -larmadillo -llapack -std=c++11 -O3
OPENMP=-fopenmp
# Add a debug flag when compiling (For the DEBUG macro in utils.hpp)
@ -19,20 +19,27 @@ else
DBGFLAG=
endif
PROFILE ?= 0
ifeq ($(PROFILE), 1)
PROFFLAG=-pg
else
PROFFLAG=
endif
.PHONY: clean
all: test_suite main
# Rules for executables
main: main.o $(LIBOBJS) $(CLASSOBJS)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE) $(OPENMP)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
test_suite: test_suite.o $(LIBOBJS) $(CLASSOBJS)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE) $(OPENMP)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
# Rule for object files
%.o: %.cpp
$(CC) -c $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE) $(OPENMP)
$(CC) -c $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
clean:
rm *.o