@@ -213,24 +213,24 @@ PROGRAMS :=
213213# file names, but this is what allows 'make src.i' to produce proper
214214# preprocessed source when src.c needs a customized compile flag.
215215# See Submakefile.skel for an example.
216- TOOBJS = $(patsubst % .cc,objects/% .o,$(patsubst % .c,objects/% .o,$(1 ) ) )
217- TODEPS = $(patsubst % .cc,objects/% .d,$(patsubst % .c,objects/% .d,$(1 ) ) )
218- TOOBJSDEPS = $(call TOOBJS,$(1 ) ) $(call TODEPS, $(1 ) ) $(patsubst % .cc,% .ii,$(patsubst % .c,% .i,$(1 ) ) )
216+ TOOBJS = $(patsubst % .cpp,objects/ % .o, $( patsubst % . cc,objects/% .o,$(patsubst % .c,objects/% .o,$(1 ) ) ) )
217+ TODEPS = $(patsubst % .cpp,objects/ % .d, $( patsubst % . cc,objects/% .d,$(patsubst % .c,objects/% .d,$(1 ) ) ) )
218+ TOOBJSDEPS = $(call TOOBJS,$(1 ) ) $(call TODEPS, $(1 ) ) $(patsubst % .cpp, % .ii, $( patsubst % . cc,% .ii,$(patsubst % .c,% .i,$(1 ) ) ) )
219219
220220SUBMAKEFILES := $(patsubst % ,% /Submakefile,$(SUBDIRS ) )
221221-include $(wildcard $(SUBMAKEFILES ) )
222222
223223# This checks that all the things listed in USERSRCS are either C files
224224# or C++ files
225225ASSERT_EMPTY = $(if $(1 ) , $(error "Should be empty but is not: $(1 ) ") )
226- $(call ASSERT_EMPTY,$(filter-out %.c %.cc, $(USERSRCS)))
226+ $(call ASSERT_EMPTY,$(filter-out %.c %.cc %.cpp , $(USERSRCS)))
227227
228228$(call TOOBJS,$(PYSRCS ) ) : EXTRAFLAGS += -fPIC -fno-strict-aliasing
229229USERSRCS += $(PYSRCS )
230230
231231# Find the list of object files for each type of source file
232232CUSERSRCS := $(filter % .c,$(USERSRCS ) )
233- CXXUSERSRCS := $(filter % .cc,$(USERSRCS ) )
233+ CXXUSERSRCS := $(filter % .cc % .cpp ,$(USERSRCS ) )
234234CUSEROBJS := $(call TOOBJS,$(CUSERSRCS ) )
235235CXXUSEROBJS += $(call TOOBJS,$(CXXUSERSRCS ) )
236236
@@ -279,7 +279,35 @@ $(sort $(CUSEROBJS)) : objects/%.o: %.c
279279 -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
280280 $< -o $@
281281
282- $(sort $(CXXUSEROBJS ) ) : objects/% .o: % .cc
282+ # Ruckig files need C++20
283+ RUCKIG_CXX_FILES := $(filter emc/tp/ruckig% ,$(CXXUSERSRCS ) )
284+ NON_RUCKIG_CXX_FILES := $(filter-out emc/tp/ruckig% ,$(CXXUSERSRCS ) )
285+
286+ $(sort $(patsubst % .cpp,objects/% .o,$(filter % .cpp,$(RUCKIG_CXX_FILES ) ) ) ) : objects/% .o: % .cpp
287+ $(ECHO ) Compiling $<
288+ @mkdir -p $(dir $@ )
289+ @rm -f $@
290+ $(Q )$(CXX ) -c $(CXXFLAGS ) $(EXTRAFLAGS ) -std=c++20 \
291+ -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
292+ $< -o $@
293+
294+ $(sort $(patsubst % .cc,objects/% .o,$(filter % .cc,$(RUCKIG_CXX_FILES ) ) ) ) : objects/% .o: % .cc
295+ $(ECHO ) Compiling $<
296+ @mkdir -p $(dir $@ )
297+ @rm -f $@
298+ $(Q )$(CXX ) -c $(CXXFLAGS ) $(EXTRAFLAGS ) -std=c++20 \
299+ -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
300+ $< -o $@
301+
302+ $(sort $(patsubst % .cpp,objects/% .o,$(filter % .cpp,$(NON_RUCKIG_CXX_FILES ) ) ) ) : objects/% .o: % .cpp
303+ $(ECHO ) Compiling $<
304+ @mkdir -p $(dir $@ )
305+ @rm -f $@
306+ $(Q )$(CXX ) -c $(CXXFLAGS ) $(EXTRAFLAGS ) \
307+ -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
308+ $< -o $@
309+
310+ $(sort $(patsubst % .cc,objects/% .o,$(filter % .cc,$(NON_RUCKIG_CXX_FILES ) ) ) ) : objects/% .o: % .cc
283311 $(ECHO ) Compiling $<
284312 @mkdir -p $(dir $@ )
285313 @rm -f $@
@@ -292,7 +320,19 @@ $(sort $(patsubst %.c,%.i,$(CUSERSRCS))): %.i: %.c
292320 $(ECHO ) Preprocessing $< to $@
293321 $(Q )$(CC ) -dD $(CFLAGS ) $(EXTRAFLAGS ) -E $< -o $@
294322
295- $(sort $(patsubst % .cc,% .ii,$(CXXUSERSRCS ) ) ) : % .ii: % .cc
323+ $(sort $(patsubst % .cc,% .ii,$(filter % .cc,$(RUCKIG_CXX_FILES ) ) ) ) : % .ii: % .cc
324+ $(ECHO ) Preprocessing $< to $@
325+ $(Q )$(CXX ) -dD $(CXXFLAGS ) $(EXTRAFLAGS ) -std=c++20 -E $< -o $@
326+
327+ $(sort $(patsubst % .cpp,% .ii,$(filter % .cpp,$(RUCKIG_CXX_FILES ) ) ) ) : % .ii: % .cpp
328+ $(ECHO ) Preprocessing $< to $@
329+ $(Q )$(CXX ) -dD $(CXXFLAGS ) $(EXTRAFLAGS ) -std=c++20 -E $< -o $@
330+
331+ $(sort $(patsubst % .cc,% .ii,$(filter % .cc,$(NON_RUCKIG_CXX_FILES ) ) ) ) : % .ii: % .cc
332+ $(ECHO ) Preprocessing $< to $@
333+ $(Q )$(CXX ) -dD $(CXXFLAGS ) $(EXTRAFLAGS ) -E $< -o $@
334+
335+ $(sort $(patsubst % .cpp,% .ii,$(filter % .cpp,$(NON_RUCKIG_CXX_FILES ) ) ) ) : % .ii: % .cpp
296336 $(ECHO ) Preprocessing $< to $@
297337 $(Q )$(CXX ) -dD $(CXXFLAGS ) $(EXTRAFLAGS ) -E $< -o $@
298338
@@ -884,7 +924,7 @@ endif
884924# "kbuild" system. $(BASEPWD) is used here, instead of relative paths, because
885925# that's what kbuild seems to require
886926
887- EXTRA_CFLAGS := $(filter-out -ffast-math,$(RTFLAGS ) ) -D__MODULE__ -I$(BASEPWD ) /../include -I$(BASEPWD ) -I$(BASEPWD ) /libnml/linklist \
927+ EXTRA_CFLAGS := $(filter-out -ffast-math,$(RTFLAGS ) ) -D__MODULE__ -I$(BASEPWD ) /../include -I$(BASEPWD ) -I$(BASEPWD ) /libnml/linklist -I $( BASEPWD ) /emc/tp/ruckig/include \
888928 -I$(BASEPWD ) /libnml/cms -I$(BASEPWD ) /libnml/rcs -I$(BASEPWD ) /libnml/inifile \
889929 -I$(BASEPWD ) /libnml/os_intf -I$(BASEPWD ) /libnml/nml -I$(BASEPWD ) /libnml/buffer \
890930 -I$(BASEPWD ) /libnml/posemath -I$(BASEPWD ) /rtapi -I$(BASEPWD ) /hal \
@@ -1231,6 +1271,18 @@ motmod-objs += emc/motion/emcmotutil.o
12311271motmod-objs += emc/motion/stashf.o
12321272motmod-objs += emc/motion/dbuf.o
12331273motmod-objs += emc/tp/sp_scurve.o
1274+ motmod-objs += emc/tp/ruckig_wrapper.o
1275+ motmod-objs += emc/tp/ruckig/src/ruckig/brake.o
1276+ motmod-objs += emc/tp/ruckig/src/ruckig/position_first_step1.o
1277+ motmod-objs += emc/tp/ruckig/src/ruckig/position_first_step2.o
1278+ motmod-objs += emc/tp/ruckig/src/ruckig/position_second_step1.o
1279+ motmod-objs += emc/tp/ruckig/src/ruckig/position_second_step2.o
1280+ motmod-objs += emc/tp/ruckig/src/ruckig/position_third_step1.o
1281+ motmod-objs += emc/tp/ruckig/src/ruckig/position_third_step2.o
1282+ motmod-objs += emc/tp/ruckig/src/ruckig/velocity_second_step1.o
1283+ motmod-objs += emc/tp/ruckig/src/ruckig/velocity_second_step2.o
1284+ motmod-objs += emc/tp/ruckig/src/ruckig/velocity_third_step1.o
1285+ motmod-objs += emc/tp/ruckig/src/ruckig/velocity_third_step2.o
12341286
12351287obj-m += homemod.o
12361288homemod-objs := emc/motion/homemod.o
@@ -1246,6 +1298,18 @@ tpmod-objs += emc/tp/blendmath.o
12461298tpmod-objs += emc/nml_intf/emcpose.o
12471299tpmod-objs += libnml/posemath/_posemath.o
12481300tpmod-objs += emc/tp/sp_scurve.o
1301+ tpmod-objs += emc/tp/ruckig_wrapper.o
1302+ tpmod-objs += emc/tp/ruckig/src/ruckig/brake.o
1303+ tpmod-objs += emc/tp/ruckig/src/ruckig/position_first_step1.o
1304+ tpmod-objs += emc/tp/ruckig/src/ruckig/position_first_step2.o
1305+ tpmod-objs += emc/tp/ruckig/src/ruckig/position_second_step1.o
1306+ tpmod-objs += emc/tp/ruckig/src/ruckig/position_second_step2.o
1307+ tpmod-objs += emc/tp/ruckig/src/ruckig/position_third_step1.o
1308+ tpmod-objs += emc/tp/ruckig/src/ruckig/position_third_step2.o
1309+ tpmod-objs += emc/tp/ruckig/src/ruckig/velocity_second_step1.o
1310+ tpmod-objs += emc/tp/ruckig/src/ruckig/velocity_second_step2.o
1311+ tpmod-objs += emc/tp/ruckig/src/ruckig/velocity_third_step1.o
1312+ tpmod-objs += emc/tp/ruckig/src/ruckig/velocity_third_step2.o
12491313tpmod-objs += libnml/posemath/sincos.o $(MATHSTUB )
12501314
12511315TORTOBJS = $(foreach file,$($(patsubst % .o,% ,$(1 ) ) -objs) , objects/rt$(file ) )
@@ -1266,15 +1330,40 @@ modules: $(patsubst %.o,../rtlib/%.so,$(obj-m))
12661330
12671331RTFLAGS += -fno-strict-aliasing -fwrapv
12681332
1269- # Rules to make .o (object) files
1270- $(sort $(RTOBJS ) ) : objects/rt% .o : % .c
1333+ # Rules to make .o (object) files for C files
1334+ $(sort $(filter-out objects/rtemc/tp/ruckig_wrapper.o objects/rtemc/tp/ruckig/src/ruckig/ % , $( RTOBJS ) ) ) : objects/rt% .o : % .c
12711335 $(ECHO ) Compiling realtime $<
12721336 @rm -f $@
12731337 @mkdir -p $(dir $@ )
12741338 $(Q )$(CC ) -c $(OPT ) $(DEBUG ) $(EXTRA_DEBUG ) -DRTAPI \
12751339 $(EXTRA_CFLAGS ) \
12761340 -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
12771341 $< -o $@
1342+
1343+ # C++ flags for Ruckig: drop C-only -Wno-declaration-after-statement, and suppress
1344+ # false-positive -Warray-bounds and -Wunused-parameter in Ruckig library
1345+ RUCKIG_CXXFLAGS := $(filter-out -Wno-declaration-after-statement,$(EXTRA_CFLAGS ) ) \
1346+ -Wno-array-bounds -Wno-unused-parameter
1347+
1348+ # Rules for C++ .cc files in realtime modules
1349+ objects/rtemc/tp/ruckig_wrapper.o : emc/tp/ruckig_wrapper.cc
1350+ $(ECHO ) Compiling realtime $<
1351+ @rm -f $@
1352+ @mkdir -p $(dir $@ )
1353+ $(Q )$(CXX ) -c $(OPT ) $(DEBUG ) $(EXTRA_DEBUG ) -DRTAPI -std=c++20 \
1354+ $(RUCKIG_CXXFLAGS ) \
1355+ -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
1356+ $< -o $@
1357+
1358+ # Rules for C++ .cpp files in realtime modules
1359+ objects/rtemc/tp/ruckig/src/ruckig/% .o : emc/tp/ruckig/src/ruckig/% .cpp
1360+ $(ECHO ) Compiling realtime $<
1361+ @rm -f $@
1362+ @mkdir -p $(dir $@ )
1363+ $(Q )$(CXX ) -c $(OPT ) $(DEBUG ) $(EXTRA_DEBUG ) -DRTAPI -std=c++20 \
1364+ $(RUCKIG_CXXFLAGS ) \
1365+ -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
1366+ $< -o $@
12781367endif
12791368
12801369ifeq ($(BUILD_SYS ) ,normal)
0 commit comments