Files
harbour-core/harbour/config/dir.mk
Viktor Szakats 94a81336c4 2010-01-02 23:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* config/dir.mk
     % Deleted code handling pre-3.81 GNU Make versions.
       We require 3.81 now, so no longer required.
       Sent by Tamas Tevesz.
2010-01-02 22:08:42 +00:00

76 lines
1.5 KiB
Makefile

#
# $Id$
#
include $(TOP)$(ROOT)config/global.mk
ifneq ($(HB_PLATFORM),)
ifneq ($(HB_COMPILER),)
ifeq ($(HB_HOST_PLAT),dos)
# do not use rules for parallel processing in DOS
JOB_SRV := NO
endif
ifeq ($(JOB_SRV),NO)
DIRS := $(filter-out {%},$(subst {, {,$(DIRS)))
include $(TOP)$(ROOT)config/dirsh.mk
else
# NOTE: The empty line directly before 'endef' HAVE TO exist!
# It causes that every command will be separated by LF
define dir_mk
@$(MK) $(MKFLAGS) -C $(dir) $@
endef
DIRS_PURE := $(filter-out {%},$(subst {, {,$(DIRS)))
DIRS_DEP := $(filter-out $(DIRS_PURE),$(DIRS))
DIRS_MK := $(foreach d, $(DIRS_PURE), $(if $(wildcard $(d)/Makefile),$(d),))
DIR_RULE = $(foreach dir, $(DIRS_MK), $(dir_mk))
endif
all : first
ifeq ($(JOB_SRV),NO)
first clean install::
+$(DIR_RULE)
else
DIRS_CLEAN := $(foreach dir, $(DIRS_MK), $(dir).clean)
DIRS_INST := $(foreach dir, $(DIRS_MK), $(dir).inst)
ifneq ($(_HB_BLD),yes)
first :: $(DIRS_MK)
endif
install :: $(DIRS_INST)
clean :: $(DIRS_CLEAN)
comma := ,
define dep_rule
$(subst $(comma),$(2) ,$(subst },$(2),$(subst {,$(2)::|,$(1))))
endef
$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),.clean)))
$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),.inst)))
$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),)))
$(DIRS_CLEAN) ::
+@$(MK) $(MKFLAGS) -C $(@:.clean=) clean
$(DIRS_INST) ::
+@$(MK) $(MKFLAGS) -C $(@:.inst=) install _HB_BLD=yes
$(DIRS_MK) ::
+@$(MK) $(MKFLAGS) -C $(@)
endif
endif
endif