Introduce default POSIX environment

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2019-01-10 13:53:44 +01:00
parent e6dc62e09a
commit 37372574a4
5 changed files with 1029 additions and 2 deletions

View File

@@ -24,6 +24,14 @@ else
$(error Not allowed program command)
endif
ifneq ($(strip $(ENV)),)
ifeq ($(strip $(ENV)),posix)
ENVDIR=$(PWD)/env/posix
else
$(error Invalid environment selected)
endif
endif
#
# Installing headers
#
@@ -68,6 +76,35 @@ $(SRC_RM): validate
$(if $(shell readlink $@ | grep $(PWD)/src), \
@echo " RM $@"; rm $@,)
#
# Installing environment
#
ENV_IN=$(shell find $(ENVDIR) -name '*.[c|h]' -type f)
ENV_OUT=$(patsubst $(ENVDIR)%,$(OUTDIR)/src/ocf/env/%,$(ENV_IN))
ENV_RM=$(shell find $(OUTDIR)/src/ocf/env -name '*.[c|h]' -xtype l 2>/dev/null)
env: | env_check env_dep
@$(MAKE) distcleandir
env_check:
ifeq ($(ENVDIR),)
$(error No environment selected)
endif
env_dep: $(ENV_OUT) $(ENV_RM)
$(ENV_OUT):
ifeq ($(strip $(OUTDIR)),)
$(error No output specified for installing sources)
endif
@echo " INSTALL $@"
@mkdir -p $(dir $@)
@$(INSTALL) $(subst $(OUTDIR)/src/ocf/env,$(ENVDIR),$@) $@
$(ENV_RM): validate
$(if $(shell readlink $@ | grep $(ENVDIR)), \
@echo " RM $@"; rm $@,)
#
# Distclean
#
@@ -96,5 +133,5 @@ doc: validate
@mkdir -p $(OUTDIR)/doc
@cd doc && mv html $(OUTDIR)/doc/ocf
.PHONY: inc src validate help distclean distcleandir doc \
$(INC_RM) $(SRC_RM) $(DIST_DIR)
.PHONY: inc src env env_check env_dep validate help distclean distcleandir doc \
$(INC_RM) $(SRC_RM) $(ENV_RM) $(DIST_DIR)