# Breadth-first search (forward only), two implementations:
#   -impl inject   collect frontier edges, then inject into parents (BfsEdgeInject.sml)
#   -impl cas      visit each frontier edge in parallel, dedup with CAS (BfsCasDedup.sml)
#
#   make
#   bin/bfs @mpl procs 8 -- ~/data/graph/rmat-1M-symm-bin -impl inject
#   bin/bfs @mpl procs 8 -- ~/data/graph/rmat-1M-symm-bin -impl cas --check
#
# Other flags: -source S (default 0), -repeat R, -warmup W.
# Use --check to verify the result against a sequential BFS.

MPL ?= mpl
SMLPKG ?= smlpkg
MPL_FLAGS ?= -default-type int64 -default-type word64

MPLLIB = lib/github.com/mpllang/mpllib/sources.mpl.mlb

.PHONY: all clean realclean

all: bin/bfs

bin/bfs: $(MPLLIB) bfs.mlb *.sml ../Concurrency.sml
	@mkdir -p bin
	$(MPL) $(MPL_FLAGS) -output $@ bfs.mlb

$(MPLLIB): sml.pkg
	$(SMLPKG) sync
	@touch $@

clean:
	rm -rf bin

realclean: clean
	rm -rf lib
