updating Makefile for new source code

More
25 Dec 2013 05:38 #41995 by rwistort
Hi:
I've been hacking some updates to the source code and, up to now, the original Makefile has worked for me as long as I was only modifying existing files.
I finally needed to take the plunge, though, and create brand new .c and .h files in their own directories and make is not cooperating.

I have a single new directory, emc2-dev/src/c3pr, containing c3pr.h, c3pr.c, and a Submakefile which looks like this:
INCLUDES += c3pr

C3PRSRCS := c3pr/c3pr.c

USERSRCS += $(C3PRSRCS)

$(call TOOBJSDEPS, $(C3PRSRCS)) : EXTRAFLAGS=-fPIC

# I don't see why I need this stanza to resolve a "no rule to make target file 'c3pr/c3pr.o' error.
# None of the other Submakefiles seem to do this. Why is an implicit rule not used?
#c3pr/c3pr.o: c3pr/c3pr.c c3pr/c3pr.h 
#	$(ECHO) Compiling $<
#	$(Q)$(CC) -c $(CFLAGS) $(EXTRAFLAGS) $< -o $@

TARGETS += ./c3pr/c3pr.o

../include/%.h: ./c3pr/%.h
	cp $^ $@

I updated the SUBDIRS, HEADERS, and EXTRA_CFLAGS sections in src/Makefile and I'm running it as: "make --debug=v" to see what it's doing.
When I run make, I can see that:
- it does, indeed, invoke c3pr/Submakefile
- it generates src/depends/c3pr/c3pr.d, which looks reasonable
- it copies c3pr.h to emc2-dev/include
- it dies with 'no rule to make target...' as noted in the commented portion of the Submakefile above. Why do other Submakefiles not need to spell out the .c => .o rule?

Also, I do '#include "c3pr.h"' in emc/nml_intf/emc_nml.hh and when make gets that far, this partial listing shows how make gives up:

Considering target file `../tcl/emc.so'.
Considering target file `objects/emc/usr_intf/emcsh.o'.
Pruning file `emc/usr_intf/emcsh.cc'.
Pruning file `emc/usr_intf/emcsh.cc'.
Pruning file `/usr/include/tcl8.5/tcl.h'.
Pruning file `/usr/include/tcl8.5/tclDecls.h'.
Pruning file `/usr/include/tcl8.5/tclPlatDecls.h'.
Pruning file `/usr/include/tcl8.5/tk.h'.
Pruning file `/usr/include/tcl8.5/tkDecls.h'.
Pruning file `libnml/rcs/rcs.hh'.
Pruning file `libnml/nml/nml_type.hh'.
Pruning file `libnml/posemath/posemath.h'.
Pruning file `emc/nml_intf/emc.hh'.
Pruning file `config.h'.
Pruning file `emc/nml_intf/emcglb.h'.
Pruning file `emc/motion/emcmotcfg.h'.
Pruning file `emc/nml_intf/motion_types.h'.
Pruning file `emc/nml_intf/emc_nml.hh'.
Pruning file `emc/nml_intf/emc.hh'.
Pruning file `libnml/nml/cmd_msg.hh'.
Pruning file `libnml/nml/nml.hh'.
Pruning file `libnml/cms/cms_user.hh'.
Pruning file `libnml/nml/nml_type.hh'.
Pruning file `libnml/nml/nmlmsg.hh'.
Pruning file `libnml/nml/stat_msg.hh'.
Pruning file `emc/nml_intf/emcpos.h'.
Pruning file `emc/nml_intf/canon.hh'.
Pruning file `emc/nml_intf/emctool.h'.
Pruning file `emc/rs274ngc/rs274ngc.hh'.
Pruning file `emc/nml_intf/canon.hh'.
Pruning file `c3pr.h'.
Finished prerequisites of target file `objects/emc/usr_intf/emcsh.o'.
Giving up on target file `objects/emc/usr_intf/emcsh.o'.

I assume the problem is that the 'pruning c3pr' line ought to include a path to it, but I cannot figure out how to supply it without spelling it out in the #include line itself. Again, no other #include lines seem to need to do so.

Can anyone shed some light on this for me?
Thanks,
Reid

Please Log in or Create an account to join the conversation.

More
27 Dec 2013 01:40 #42035 by rwistort
I did:
make depclean
and I am back to tracking down 'real' problems.

Man, oh man, that Makefile is a piece of work!

Thanks,
Reid

Please Log in or Create an account to join the conversation.

More
28 Dec 2013 07:19 #42084 by andypugh
I don't think you will get much help with makefile stuff on the Forum, you would need to go to the developers mailing list for that.

Please Log in or Create an account to join the conversation.

Time to create page: 0.120 seconds
Powered by Kunena Forum