summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/bootstrap.make33
-rw-r--r--cli/makefile2
-rw-r--r--examples/hello/makefile2
3 files changed, 29 insertions, 8 deletions
diff --git a/build/bootstrap.make b/build/bootstrap.make
index 89a8fde..3bb9d7e 100644
--- a/build/bootstrap.make
+++ b/build/bootstrap.make
@@ -16,6 +16,14 @@ ifeq ($(patsubst %build/bootstrap.make,,$(lastword $(MAKEFILE_LIST))),)
include $(build)/bootstrap.make
endif
+def_goal := $(.DEFAULT_GOAL)
+
+# Include C++ configuration. We need to know if we are using the generic
+# C++ compiler in which case we need to compensate for missing dependency
+# auto-generation (see below).
+#
+$(call include,$(bld_root)/cxx/configuration.make)
+
# Aliases
#
ifdef %interactive%
@@ -30,10 +38,6 @@ install: $(out_base)/.install
dist: $(out_base)/.dist
clean: $(out_base)/.clean
-ifneq ($(filter $(.DEFAULT_GOAL),test install dist clean),)
-.DEFAULT_GOAL :=
-endif
-
endif
@@ -45,13 +49,30 @@ $(error dist_prefix is not set)
endif
endif
-
-# Don't include dependency info for certain targets.
+# If we don't have dependency auto-generation then we need to manually
+# make sure that CLI files are compiled before C++ file. To do this we
+# make the object files ($2) depend in order-only on generated files
+# ($3).
#
+ifeq ($(cxx_id),generic)
+
+define include-dep
+$(if $2,$(eval $2: | $3))
+endef
+
+else
+
define include-dep
$(call -include,$1)
endef
+endif
+
+
+# Don't include dependency info for certain targets.
+#
ifneq ($(filter $(MAKECMDGOALS),clean disfigure),)
include-dep =
endif
+
+.DEFAULT_GOAL := $(def_goal)
diff --git a/cli/makefile b/cli/makefile
index 8f4ccfc..1d4ac42 100644
--- a/cli/makefile
+++ b/cli/makefile
@@ -65,7 +65,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): cli := $(out_root)/cli/cli
$(gen): cli_options := --guard-prefix CLI
-$(call include-dep,$(cxx_od))
+$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
# Alias for default target.
#
diff --git a/examples/hello/makefile b/examples/hello/makefile
index a162d0d..f5c191c 100644
--- a/examples/hello/makefile
+++ b/examples/hello/makefile
@@ -26,7 +26,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): cli := $(out_root)/cli/cli
$(gen): $(out_root)/cli/cli
-$(call include-dep,$(dep))
+$(call include-dep,$(dep),$(obj),$(gen))
# Convenience alias for default target.
#