On Sun, Jun 30, 2019 at 9:36 AM Dmitry Yurtaev <[email protected]> wrote:
> > > > I see in src/Makefile, motmod-objs
> > > > gets emc/motion/motion.o, emc/motion/command.o, etc., but where are
> > > > these object files being built from the .c files? Submakefile under
> > > > emc/motion only copies headers to ../includes. There is nothing to
> > > > compile these source files.
> > > >
> > I see where the .o files are listed but somewhere in the makefile or
> > submakefiles there must be instructions to compile from .c or .cc to form
> > those .o files. And I don't see it anywhere.
>
> motmod.o is added to obj-m var with
>
> obj-$(CONFIG_MOTMOD) += motmod.o
>
> then
>
> RTOBJS := $(sort $(foreach mod,$(obj-m),$(call TORTOBJS,$(mod))))
> TORTOBJS = $(foreach file,$($(patsubst %.o,%,$(1))-objs),
> objects/rt$(file))
>
> adds motmod-objs to RTOBJS. and finally the rule call the compiler:
>
> # Rules to make .o (object) files
> $(sort $(RTOBJS)) : objects/rt%.o : %.c
> $(ECHO) Compiling realtime $<
> @rm -f $@
> @mkdir -p $(dir $@)
> $(Q)$(CC) -c $(OPT) $(DEBUG) $(EXTRA_DEBUG) -DRTAPI -I../include \
> $(EXTRA_CFLAGS) \
> -MP -MD -MF "${@:.o=.d}" -MT "$@" \
> $< -o $@
>
> /dmitry
>
>
A ha! Now that IS helpful! Thank you, Dmitry!
Just for my education, what is the reason for building motmod this way,
rather than the arguably simpler way that most other modules (e.g.,
milltask) are built in their Submakefiles?
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers