TOP = ..

include $(TOP)/mk/config.mk

SUBDIRS = tool lib appl

all::
	@echo
	@echo 'No "all" rule here. If you want to build and install everything'
	@echo 'use "make install".  Otherwise build subdirectories separately.'
	@echo

clean::
	@(unset MAKEFLAGS; \
          set -e; \
          if [ "$$subdir_makeflags" = "" ]; then \
             subdir_makeflags='$(SUBDIR_MAKEFLAGS)'; \
          fi; \
          if [ "$$subdirs" = "" ]; then \
             subdirs='$(SUBDIRS)'; \
          fi; \
          if [ "$$target" = "" ]; then \
             target='$@'; \
          fi; \
          for i in $$subdirs ; do \
             (cd $$i ; echo "making $$target in $$i..." ; \
              eval make $$subdir_makeflags $$target ) ; \
             if [ $$? != 0 ]; then \
                exit 1; \
             fi; \
          done; \
         )


install::
	@(unset MAKEFLAGS; \
          set -e; \
          if [ "$$subdir_makeflags" = "" ]; then \
             subdir_makeflags='$(SUBDIR_MAKEFLAGS)'; \
          fi; \
          if [ "$$subdirs" = "" ]; then \
             subdirs='$(SUBDIRS)'; \
          fi; \
          if [ "$$target" = "" ]; then \
             target='$@'; \
          fi; \
          for i in $$subdirs ; do \
             (cd $$i ; echo "making $$target in $$i..." ; \
              eval make $$subdir_makeflags $$target ) ; \
             if [ $$? != 0 ]; then \
                exit 1; \
             fi; \
          done; \
         )
	@echo 'Installation completed.'
	@echo 'You can now build the examples in the subdirectory ./examples'
	@echo 'using "make all".'
	@echo

