Commit c723b997 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Improved flags and targets in Makefile

parent 9ab13d9d
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -2,8 +2,16 @@ CXX := g++

CPPFLAGS := -MD -MP -I ./libs/install/include
CXXFLAGS := -std=c++11 -Wall -Wextra -pedantic -O3 -march=native -mtune=native -flto -fopenmp
LDLIBS := -lm -lMOAB -lgomp -flto
LDFLAGS := -L ./libs/install/lib -Wl,-rpath,"$(CURDIR)/libs/install/lib"
LDLIBS := -lm -lMOAB -lgomp
LDFLAGS := -flto

# add the path where MOAB was installed to linker flags
ifneq ("$(wildcard ./libs/install/lib/*)", "")
LDFLAGS += -L ./libs/install/lib -Wl,-rpath,"$(CURDIR)/libs/install/lib"
endif
ifneq ("$(wildcard ./libs/install/lib64/*)", "")
LDFLAGS += -L ./libs/install/lib64 -Wl,-rpath,"$(CURDIR)/libs/install/lib64"
endif

SOURCES = $(wildcard *.cpp)
TARGETS = $(SOURCES:%.cpp=%)
@@ -20,8 +28,12 @@ moab:
$(TARGETS): %: %.o
	$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)

.PHONY:
clean:
	$(RM) *.[od] $(TARGETS)

.PHONY:
distclean: clean
	+make -C libs clean

-include $(SOURCES:%.cpp=%.d)