# /usr/share/doc/libblitz-doc/testsuite/Makefile
#
# Ad hoc Makefile for building and playing with the sample sources
# distributed within the debian package libblitz-doc.
#
# Recommended usage:
#  create a dedicated folder somewhere in your HOME directory;
#  link all the files in /usr/share/doc/libblitz-doc/testsuite in the dedicated folder;
#  launch this Makefile in the dedicated folder:
#  $ make ;
#  for a basic cleanup, consider the clean target:
#  $ make clean ;
#  for an entire cleanup, the maintainer-clean target:
#  $ make maintainer-clean ;
#  for other targets, just read the Makefile.
#
# written for Debian by Jerome Benoit <calculus@rezozer.net>
# on behalf of the Debian Science Team
# copyright: 2016-2019 Jerome Benoit <calculus@rezozer.net>
# distributed under the terms and conditions of GPL version 2 or later
#

PROGRAMS = $(sort module $(filter-out module1 module2, $(patsubst %.cpp,%,$(wildcard *.cpp))))

default: all

CPPFLAGS = -I.
CXXFLAGS = $(shell pkg-config blitz --cflags)
LDLIBS = $(shell pkg-config blitz --libs)

CXX_OPTIMIZE_FLAGS = -O3 -funroll-loops -fstrict-aliasing -fomit-frame-pointer -ffast-math -DUSE_LIBBLAS

all: build

build: $(PROGRAMS)

check: build
	@$(foreach eg, $(PROGRAMS), echo "*** $(eg) ***" ; ./$(eg) > /dev/null ; )

clean:
	$(RM) $(PROGRAMS)

maintainer-clean: clean


64bit: 64bit.cpp
	$(CXX) $(CXXFLAGS) $(CXX_OPTIMIZE_FLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@

exprctor: exprctor.cpp
	$(CXX) -DBZ_DEBUG $(CXXFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@

module: module1.cpp module2.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@

pthread: pthread.cpp
	$(CXX) -DBZ_THREADSAFE -pthread $(CXXFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@

transpose: transpose.cpp
	$(CXX) -fpermissive $(CXXFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
