summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2016-04-28 17:01:57 +0200
committerNicolas Schodet2019-10-07 00:44:57 +0200
commit90bdcdb391996efa70c2df0d3ec49303dd0daa0c (patch)
tree3766221f48ba314486b4df1e0530a6001e48a7b4
parent567a61a4b4053a715d57efa278fa733e50bf1db6 (diff)
build: add support for .cpp files
-rw-r--r--build/arch.mk5
-rw-r--r--build/macros.mk2
-rw-r--r--build/top.mk1
3 files changed, 7 insertions, 1 deletions
diff --git a/build/arch.mk b/build/arch.mk
index 6b6410b..b52bdbe 100644
--- a/build/arch.mk
+++ b/build/arch.mk
@@ -59,6 +59,11 @@ $$(OBJDIR)/%.$1.o: %.cc $$(COMPILE_DEPS) | $$(COMPILE_ORDER_DEPS)
$$(call mkdir_if_needed,$$@)
$$Q$$($1_COMPILE.cc) -o $$@ $$<
+$$(OBJDIR)/%.$1.o: %.cpp $$(COMPILE_DEPS) | $$(COMPILE_ORDER_DEPS)
+ @echo "CXX [$1] $$<"
+ $$(call mkdir_if_needed,$$@)
+ $$Q$$($1_COMPILE.cc) -o $$@ $$<
+
$$(OBJDIR)/%.$1.o: %.S $$(COMPILE_DEPS) | $$(COMPILE_ORDER_DEPS)
@echo "AS [$1] $$<"
$$(call mkdir_if_needed,$$@)
diff --git a/build/macros.mk b/build/macros.mk
index fd6c587..813c6fd 100644
--- a/build/macros.mk
+++ b/build/macros.mk
@@ -22,7 +22,7 @@ filter_sources_sub = $(foreach t,$1 $($1_SUBTARGETS),$(filter %.$t,$2)) \
# Test if one of the source is C++, in this case, return cc, else return c.
# $(call iscxx,SOURCES)
-iscxx = $(if $(filter %.cc,$1),cc,c)
+iscxx = $(if $(filter %.cc,$1)$(filter %.cpp,$1),cc,c)
# Output every parent directories until root is reached.
# $(call parents,DIRS,ROOT)
diff --git a/build/top.mk b/build/top.mk
index d7da682..4469d2e 100644
--- a/build/top.mk
+++ b/build/top.mk
@@ -52,6 +52,7 @@ clean:
include $(UCOO_BASE)/build/setup.mk
vpath %.cc $(UCOO_BASE) $(BASE)
+vpath %.cpp $(UCOO_BASE) $(BASE)
vpath %.c $(UCOO_BASE) $(BASE)
vpath %.S $(UCOO_BASE) $(BASE)