include ../support/Makefile.inc

all: test

denoising: denoising.cpp
	$(CXX) $(CXXFLAGS) denoising.cpp $(LIB_HALIDE) -o denoising -ldl -lpthread -lz $(LDFLAGS)

denoising.o: denoising
	./denoising

# g++ on OS X might actually be system clang without openmp
CXX_VERSION=$(shell $(CXX) --version)
ifeq (,$(findstring clang,$(CXX_VERSION)))
OPENMP_FLAGS=-fopenmp
else
OPENMP_FLAGS=
endif

# -O2 is faster than -O3 for this app (O3 unrolls too much)
test: test.cpp denoising.o
	$(CXX) $(CXXFLAGS) $(OPENMP_FLAGS) -msse2 -Wall -O3 test.cpp denoising.o -o test -lpthread -ldl $(PNGFLAGS)

clean:
	rm -f test denoising.o denoising.h denoising
