# File       : Makefile
# Description: Make recipes
# Copyright 2023 Harvard University. All Rights Reserved.
CXX ?= g++
CXXFLAGS = -Wall -Wextra -pedantic -std=c++11
.PHONY: clean

# debug=true --> use assertions for debugging
debug ?= false

# setup debugging or production options
ifeq ("$(debug)", "false")
CXXFLAGS  += -O3 -DNDEBUG
else
CXXFLAGS  += -O0 -g
endif

# main target with ISPC
main: main.cpp LJ_force.o LJ_force_avx2.o
	$(CXX) $(CXXFLAGS) -D_ISPC_ -o $@ $^

# scalar code only
main_scalar: main.cpp LJ_force.o
	$(CXX) $(CXXFLAGS) -o $@ $^

# BASE target
LJ_force.o: LJ_force.cpp
	$(CXX) $(CXXFLAGS) -c -o $@ $<

# TODO: Implement the ISPC make recipe for an AVX2 target kernel
# ISPC AVX2 target
LJ_force_avx2.o: LJ_force.ispc
	@echo "TODO: ISPC recipe not implemented!"

clean:
	rm -f main main_scalar LJ_force*.o
