PATH_PREFIX = .

include $(PATH_PREFIX)/Local.mak


GOALS = prepare subdirs

SUBDIRS = nomore libsmodels portablethreads program_options platypus 

ifeq ($(BUILD_FORK), yes)
	SUBDIRS += ipc
endif

SUBDIRS += app

all: $(GOALS)

benchmark: BENCHMARK = yes
benchmark: all

optimize: OPTIMIZE = yes
optimize: all

prepare:
	mkdir -p lib/solver
	mkdir -p bin

.PHONY: subdirs $(SUBDIRS) clean

subdirs: $(SUBDIRS)

$(SUBDIRS):
	$(MAKE) -C $@

clean:
	rm -rf bin
	rm -rf lib
	$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) clean;)


binclean:
	rm -rf bin
	cd app && make binclean

export BENCHMARK
export OPTIMIZE
