From b5bfe8af171b795f6e9cd91f89ba68293e12a398 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Sun, 27 Nov 2016 11:19:46 -0600 Subject: [PATCH] The Smoothie project needs to compile C++ inside config/boardname/src/ to use with High Priority Interruption, then I modified the board configs Makefile to support it, see attached patch. It works fine for the first time compilation, but if we execute: $ touch config/boardname/src/Pin.cxx And execute "make" it will not detect that Pin.cxx was modified. I think there is some other place I should modify, but I didn't find it. --- configs/Board.mk | 13 ++++++++++--- configs/Makefile | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/configs/Board.mk b/configs/Board.mk index 11f0ed4dc2..680b37ebcb 100644 --- a/configs/Board.mk +++ b/configs/Board.mk @@ -43,6 +43,7 @@ else AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT)) endif COBJS = $(CSRCS:.c=$(OBJEXT)) +CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) @@ -108,17 +109,23 @@ $(AOBJS): %$(OBJEXT): %$(ASMEXT) $(COBJS) $(LINKOBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -libboard$(LIBEXT): $(OBJS) +$(CXXOBJS) $(LINKOBJS): %$(OBJEXT): %.cxx + $(call COMPILEXX, $<, $@) + +libboard$(LIBEXT): $(OBJS) $(CXXOBJS) $(Q) $(AR) $@ # Create an empty archive ifneq ($(OBJS),) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $@, $(OBJS) $(CXXOBJS)) endif -.depend: Makefile $(SRCS) +.depend: Makefile $(SRCS) $(CXXSRCS) ifneq ($(ZDSVERSION),) $(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep else $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep +endif +ifneq ($(CXXSRCS),) + $(Q) $(MKDEP) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >>Make.dep endif $(Q) touch $@ diff --git a/configs/Makefile b/configs/Makefile index 68a5fad87f..f430e137e8 100644 --- a/configs/Makefile +++ b/configs/Makefile @@ -66,6 +66,7 @@ BOARD_INSTALLED = $(if $(wildcard $(BOARD_DIR)$(DELIM)Makefile),y,) CONFIG_ASRCS = CONFIG_CSRCS = +CONFIG_CXXSRCS = # boardctl support @@ -79,6 +80,9 @@ AOBJS = $(ASRCS:.S=$(OBJEXT)) CSRCS = $(CONFIG_CSRCS) COBJS = $(CSRCS:.c=$(OBJEXT)) +CXXSRCS = $(CONFIG_CXXSRCS) +CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) + SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) @@ -93,12 +97,18 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -$(BIN): $(OBJS) - $(call ARCHIVE, $@, $(OBJS)) +$(CXXOBJS): %$(OBJEXT): %.cxx + $(call COMPILEXX, $<, $@) -.depend: Makefile $(SRCS) +$(BIN): $(OBJS) $(CXXOBJS) + $(call ARCHIVE, $@, $(OBJS) $(CXXOBJS)) + +.depend: Makefile $(SRCS) $(CXXSRCS) ifneq ($(SRCS),) $(Q) $(MKDEP) --dep-path . "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep +endif +ifneq ($(CXXSRCS),) + $(Q) $(MKDEP) --dep-path . "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >>Make.dep endif $(Q) touch $@