VERBOSE=@

.PHONY: configure-all build-all

all:	build-all

configure-all: source_configured


source_configured:
	$(VERBOSE)echo "create standard configuration of l4linux, l4env, fiasco ..."
	$(MAKE) -C l4 oldconfig O=../build/l4
	$(MAKE) -C build/fiasco_ia32 oldconfig
	$(MAKE) -C l4linux-2.6 O=../build/linux oldconfig CONFIG_L4_L4DIR=`pwd`/l4
	$(MAKE) -C l4linux-2.6 O=../build/linux_drv oldconfig CONFIG_L4_L4DIR=`pwd`/l4
	sed -i "s|CONFIG_L4_OBJ_TREE.*|CONFIG_L4_OBJ_TREE="\"`pwd`"/build/l4\"|" build/linux/.config	
	sed -i "s|CONFIG_L4_OBJ_TREE.*|CONFIG_L4_OBJ_TREE="\"`pwd`"/build/l4\"|" build/linux_drv/.config
	$(VERBOSE)touch source_configured
	$(VERBOSE)echo
	$(VERBOSE)echo "The source code of the OpenTC L4Env snapshot has been successfully configured now."
	$(VERBOSE)echo "You can build it in the default configuration by typing the following command:"
	$(VERBOSE)echo
	$(VERBOSE)echo "make build-all"
	$(VERBOSE)echo
	$(VERBOSE)echo "If you want to do a custom build, please refer to the instructions page in the documentation."

build-all: source_configured
	$(MAKE) -C dice -f Makefile.drops
	$(MAKE) -C l4
	$(MAKE) -C build/fiasco_ia32
	$(MAKE) -C build/linux
	$(MAKE) -C build/linux_drv
