openfoam/wmake/rules/General/transform
Mark Olesen de72a04aeb ENH: make it easier to switch between the various make dependencies programs.
- However, the new ragel-based parser is much faster
  than the others, and does not cause 'too many open files' error
  that the flex-based parser does (issue #784).

  The timings (using src/sampling as being somewhat representative)

    $ wclean; wmakeLnInclude -u .; time wmake -s dep

        3.4s  wmkdepend (ragel) [now default]
        5.7s  wmkdep (flex)
        6.1s  cpp -M

- The makeDepend script is for testing purposes only, but could used as
  a hook for other dependency generation systems (eg, ninja).
  It simply wraps 'cpp -M' in a form that is calling compatible with
  wmkdepend.

BUG: wmkdepend parser was missing optional leading space on #include match

STYLE: use -G2 (goto-based) option for wmkdepend state machine

- the machine is compact with few states and lends itself to this
2018-04-12 10:14:03 +02:00

43 lines
1.1 KiB
Plaintext

#----------------------------*- makefile-gmake -*------------------------------
# The dependency generation program
WMKDEP := $(WMAKE_BIN)/wmkdepend # 1. Ragel-based
# WMKDEP := $(WMAKE_BIN)/wmkdep # 2. Flex-based (slower, ulimit problem)
# WMKDEP := $(WM_SCRIPTS)/makeDepend # 3. cpp -M (for testing only)
WMKDEP_FLAGS := -eWM_PROJECT_DIR -eWM_THIRD_PARTY_DIR
ifneq ("$(WM_QUIET)","")
E=@
define QUIET_MESSAGE
@echo " $1: $2";
endef
define VERBOSE_MESSAGE
endef
WMKDEP_FLAGS += -q
else
E=
define QUIET_MESSAGE
endef
define VERBOSE_MESSAGE
@echo "$1 $2";
endef
endif
define DEFINE_TRANSFORM
$(OBJECTS_DIR)/%.o : %$1
$(call QUIET_MESSAGE,$(subst .,,$(1))too,$(value <F))
$E $$($(subst .,,$(1))too)
endef
$(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))
$(OBJECTS_DIR)/%.dep : %
$(call QUIET_MESSAGE,dep,$(<F))
$(call VERBOSE_MESSAGE,Making dependency list for source file,$(<F))
@$(WM_SCRIPTS)/makeTargetDir $@
@$(WMKDEP) $(WMKDEP_FLAGS) -o$@ -I$(*D) $(LIB_HEADER_DIRS) $<
#------------------------------------------------------------------------------