INSTDIR=../inst

all: wbo

wbo:
	cd open_wbo && sh ./configure
	cd open_wbo && if [ "$$(uname -s)" = "Darwin" ]; then $(MAKE) r; else $(MAKE) rs; fi
	mkdir -p $(INSTDIR)/bin
	if [ "$$(uname -s)" = "Darwin" ]; then \
		cp -f open_wbo/open-wbo_release$(EXEEXT) $(INSTDIR)/bin/open-wbo_static$(EXEEXT); \
	else \
		cp -f open_wbo/open-wbo_static$(EXEEXT) $(INSTDIR)/bin/open-wbo_static$(EXEEXT); \
	fi

clean: clean-src clean-wbo

clean-src:
	rm -f *.o *.so *.rds
	rm -r $(INSTDIR)

clean-wbo:
	cd open_wbo && $(MAKE) allclean && rm -f Makefile

.PHONY: all wbo clean clean-src
