# the following include saves the command line flags into the MAKEDEF variable
!include "makeopts.mk"

!ifdef __CEARM__
ALLDIRS1=pro misc plugins/debugger
!else
ALLDIRS1=pro hc mkdep regex clp btree netnode vm va misc compress pattern demangle \
         parse register
!ifndef KERNEL
ALLDIRS2=efd base info ida ui module ldr plugins
!else
ALLDIRS2=base info ida
!endif
HELPDIRS=ui/txt
!endif

ALLDIRS=etc incdirs $(ALLDIRS1) $(HELPDIRS) $(ALLDIRS2)

.PHONY: env $(ALLDIRS) all

all: env allbin

env:
	@make -DDEBUG  -f makeenv_br.mak
	@make -DNDEBUG -f makeenv_br.mak
	@make -DDEBUG  -f makeenv_vc.mak
	@make -DNDEBUG -f makeenv_vc.mak

allbin: env $(ALLDIRS)

etc:	env
        @cd etc
	@$(MAKE)
        @cd ..

incdirs:	env
	@cd hc
	@$(MAKE) includes
	@cd ..\base
        @$(MAKE) includes
        @cd ..\misc
        @$(MAKE) includes
        @cd ..

!ifndef __CEARM__
$(HELPDIRS):
	@cd $@
	@$(MAKE) help
	@cd ..\..
!endif

$(ALLDIRS1) $(ALLDIRS2) efd:	env
	cd $@
	@$(MAKE)
	@cd ..

###
