#==================================================
# Copyright IBM 2008
#==================================================

.NOTPARALLEL:

SHELL          := /bin/bash
ifeq ($(SHARKCLONEROOT),)
  $(error SHARKCLONEROOT not set)
endif
BLDMODE := $(shell if [[ -e $(SHARKCLONEROOT)/config/kdef.mk ]]; \
           then echo "GPL"; else echo "CVS"; fi)
ifeq ($(BLDMODE), GPL)
        CONFIGDIR := $(SHARKCLONEROOT)/config
else
        CONFIGDIR := $(SHARKCLONEROOT)/../gconfig
endif
include $(CONFIGDIR)/kdef.mk

DESTDIR = $(SHARKCLONEROOT)
CXI_HEADER_DIR = $(DESTDIR)/include/cxi

DASH_I  = *-[^=\ ][i]*
DASH_IK = *-[^=\ ][ik]*

ifeq ($(LIBSRC_BUILD_ON), Y)
HEADERS = cxiTypes-plat.h cxiSystem-plat.h cxiSharedSeg-plat.h
else
HEADERS = cxiTypes-plat.h cxiSystem-plat.h cxiIOBuffer-plat.h \
          cxiSharedSeg-plat.h cxiMode-plat.h Trace-plat.h \
          cxiAtomic-plat.h cxiMmap-plat.h cxiVFSStats-plat.h \
          cxiCred-plat.h cxiDmapi-plat.h
endif

Install:: install
install:: Headers
Headers:: install.he
install.he:: $(HEADERS)
	@(case '$(MAKEFLAGS)' in $(DASH_I)) set +e;; esac; \
            changed="$?"; \
	 if [ ! -e $(CXI_HEADER_DIR) ]; then  \
                echo "Making directory $(CXI_HEADER_DIR)"; \
                mkdir -p $(CXI_HEADER_DIR); \
          fi; \
	  for i in $$changed; do \
		(set -x; $(INSTALL) $(INSTINCFLAGS) $$i  $(CXI_HEADER_DIR)/$$i) done)
install.he::
	touch install.he
clean:: Clean
Clean::
	 rm -f install.he; \
	 for i in $(HEADERS); do \
                (set -x; rm -rf $(CXI_HEADER_DIR)/$$i) done
Depend::
InstallLibs::
Libs::
Makefiles::
subdirMakefiles::
