## Copyright, 2001, Astra Network Inc.  All Rights Reserved

## This source code has been published by Astra Network Inc. However, any
## use, reproduction, modification, distribution or transfer of this
## software, or any software which includes or is based upon any of this
## code, is only permitted if expressly authorized by a written license
## agreement from Astra. Contact your Astra representitive directly for
## more information.


HAFTADIR_ENV:=$(shell echo $$HAFTADIR)
ifeq "X$(HAFTADIR_ENV)" "X"
 TOPDIR:=$(shell /bin/pwd)
else
 TOPDIR:=$(HAFTADIR_ENV)/overlord
endif
WHO:=$(shell basename $$HOME)
DATE=$(shell date)

include $(TOPDIR)/mkfiles/def_glob.mk

all: default build-$(PLAT)/Makefile
	$(MAKE) -C build-$(PLAT)

clean lint test deps: build-$(PLAT)/Makefile
	$(MAKE) -C build-$(PLAT) $@

default: default-$(PLAT)-specific

default-general:
	@echo "This will create a default build structure" 
	@/bin/sh -c " \
	mkdir build-$(PLAT); \
	mkdir build-$(PLAT)/lib; \
	mkdir build-$(PLAT)/lib/quad; \
	mkdir build-$(PLAT)/ola; \
	mkdir build-$(PLAT)/olc; \
	mkdir build-$(PLAT)/olrt; \
	mkdir build-$(PLAT)/olrt/mod_alive; \
	mkdir build-$(PLAT)/olrt/mod_null; \
	mkdir build-$(PLAT)/olrt/mod_kill; \
	mkdir build-$(PLAT)/olrt/mod_log; \
	mkdir build-$(PLAT)/olrt/mod_logf1; \
	mkdir build-$(PLAT)/olrt/mod_var; \
	mkdir build-$(PLAT)/olrt/mod_exit; \
	mkdir build-$(PLAT)/olrt/mod_exec; \
	mkdir build-$(PLAT)/olrt/mod_sh; \
	mkdir build-$(PLAT)/olrt/mod_curtime; \
	mkdir build-$(PLAT)/olrt/mod_getpidbyname; \
	/bin/true" > /dev/null 2>&1

default-nto-specific: default-general
	@/bin/sh -c "\
	mkdir build-$(PLAT)/olrt/mod_cpu; \
	mkdir build-$(PLAT)/olrt/mod_sharedvar; \
	mkdir build-$(PLAT)/olrt/mod_fd; \
	mkdir build-$(PLAT)/olrt/mod_maxmem; \
	mkdir build-$(PLAT)/olrt/mod_mem; \
	mkdir build-$(PLAT)/olrt/pkg_all; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_alive; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_null; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_kill; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_log; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_logf1; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_var; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_exit; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_exec; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_sh; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_curtime; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_cpu; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_sharedvar; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_fd; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_getpidbyname; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_maxmem; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_mem; \
	/bin/true" > /dev/null 2>&1

default-linux-specific: default-general
	@/bin/sh -c "\
	mkdir build-$(PLAT)/olrt/mod_sharedvar; \
	mkdir build-$(PLAT)/olrt/pkg_all; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_alive; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_null; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_kill; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_log; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_logf1; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_var; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_exit; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_exec; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_sh; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_getpidbyname; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_curtime; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_sharedvar; \
	/bin/true" > /dev/null 2>&1

default-solaris2.8-specific: default-general
	@/bin/sh -c "\
	mkdir build-$(PLAT)/olrt/mod_cpu; \
	mkdir build-$(PLAT)/olrt/mod_sharedvar; \
	mkdir build-$(PLAT)/olrt/mod_fd; \
	mkdir build-$(PLAT)/olrt/pkg_all; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_alive; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_null; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_kill; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_log; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_logf1; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_var; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_exit; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_exec; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_sh; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_curtime; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_cpu; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_sharedvar; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_fd; \
	mkdir build-$(PLAT)/olrt/pkg_all/mod_getpidbyname; \
	/bin/true" > /dev/null 2>&1

default-qnx4-specific: default-general
	@/bin/sh -c "\
	/bin/true" > /dev/null 2>&1

build-%/Makefile: $(MKFILEDIR)/build.mk
	$(CPMKFILE) $^ $@

