diff options
author | stijn <stijn@ignitron.net> | 2020-10-08 16:19:26 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-10-29 15:27:18 +1100 |
commit | f1666419a8aaee846f7175ccdb8799ab9deea376 (patch) | |
tree | ed5aa9080c46c15ba34f76260f42fd4a17e78946 /py | |
parent | 2b9f0586e7a37a673aa2c8ef298751c8d30b2667 (diff) |
py/mkrules.mk: Add target for compiling C++ files.
Move the target from the ESP32 Makefile since that does what is needed
already, but also include files from user C modules as is done for the C
files.
Diffstat (limited to 'py')
-rw-r--r-- | py/mkrules.mk | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/py/mkrules.mk b/py/mkrules.mk index c37c25db4..f003174ea 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -58,12 +58,28 @@ $(Q)$(CC) $(CFLAGS) -c -MD -o $@ $< $(RM) -f $(@:.o=.d) endef +define compile_cxx +$(ECHO) "CXX $<" +$(Q)$(CXX) $(CXXFLAGS) -c -MD -o $@ $< +@# The following fixes the dependency file. +@# See http://make.paulandlesley.org/autodep.html for details. +@# Regex adjusted from the above to play better with Windows paths, etc. +@$(CP) $(@:.o=.d) $(@:.o=.P); \ + $(SED) -e 's/#.*//' -e 's/^.*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.d) >> $(@:.o=.P); \ + $(RM) -f $(@:.o=.d) +endef + vpath %.c . $(TOP) $(USER_C_MODULES) $(BUILD)/%.o: %.c $(call compile_c) vpath %.c . $(TOP) $(USER_C_MODULES) +vpath %.cpp . $(TOP) $(USER_C_MODULES) +$(BUILD)/%.o: %.cpp + $(call compile_cxx) + $(BUILD)/%.pp: %.c $(ECHO) "PreProcess $<" $(Q)$(CPP) $(CFLAGS) -Wp,-C,-dD,-dI -o $@ $< |