Welcome! Log In Create A New Profile

Advanced

Teacup: Problem with Gen7 branch new split-Makefiles

Posted by Cyberwizzard 
Teacup: Problem with Gen7 branch new split-Makefiles
January 08, 2013 09:23AM
I've been playing with the current version of the Gen7 branch of Teacup and it seems like the new Makefile are not working on Ubuntu 12.04 properly: when having build targets in the BUILDDIR (e.g. build/teacup.elf or build/clock.o) make complains that the needed rule is missing. For example:
make -f Makefile-AVR all
rm -f build/depend
mkdir -p build
avr-gcc -DF_CPU=16000000L -mmcu=atmega644p -g -Wall -Wstrict-prototypes -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Winline -fno-move-loop-invariants -fno-tree-scev-cprop -Os -ffunction-sections -finline-functions-called-once -mcall-prologues -save-temps=obj -MM analog.c clock.c copier.c crc.c dda.c dda_maths.c dda_queue.c debug.c delay.c gcode_parse.c gcode_process.c graycode.c heater.c home.c intercom.c mendel.c pinio.c sd.c serial.c sermsg.c sersendf.c temp.c timer.c usb_serial.c watchdog.c > build/depend
make: *** No rule to make target `teacup.hex', needed by `all'.  Stop

Building an object file directly:
make -f Makefile-AVR build/clock.o
make: *** No rule to make target `build/clock.o'.  Stop.

Now I set BUILDDIR to an empty string and the depend file to simply 'depend':
make -f Makefile-AVR clock.o
#rm -f depend
#mkdir -p 
avr-gcc -DF_CPU=16000000L -mmcu=atmega644p -g -Wall -Wstrict-prototypes -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Winline -fno-move-loop-invariants -fno-tree-scev-cprop -Os -ffunction-sections -finline-functions-called-once -mcall-prologues -save-temps=obj -MM analog.c clock.c copier.c crc.c dda.c dda_maths.c dda_queue.c debug.c delay.c gcode_parse.c gcode_process.c graycode.c heater.c home.c intercom.c mendel.c pinio.c sd.c serial.c sermsg.c sersendf.c temp.c timer.c usb_serial.c watchdog.c > depend
avr-gcc -DF_CPU=16000000L -mmcu=atmega644p -g -Wall -Wstrict-prototypes -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Winline -fno-move-loop-invariants -fno-tree-scev-cprop -Os -ffunction-sections -finline-functions-called-once -mcall-prologues -save-temps=obj   -c -o clock.o clock.c

Alternatively I link the source file to the 'build' directory: clock.c -> build/clock.c:
make -f Makefile-AVR build/clock.o
avr-gcc -DF_CPU=16000000L -mmcu=atmega644p -g -Wall -Wstrict-prototypes -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Winline -fno-move-loop-invariants -fno-tree-scev-cprop -Os -ffunction-sections -finline-functions-called-once -mcall-prologues -save-temps=obj   -c -o build/clock.o build/clock.c
build/clock.c:7:19: fatal error: pinio.h: No such file or directory
compilation terminated.
make: *** [build/clock.o] Error 1
Note that it failed as the other source files are missing but at least Make is not complaining about missing rules.

It seems that having the source file in another folder from the target object file is somehow confusing Make...

So does this split-makefile work for other people besides me or is it just broken at the moment?

Edit: I added a rule before the include in 'Makefile-common':
build/clock.o: clock.c
    echo "Works!"

This works as expected; it seems to be an issue with the wildcard target matching.

Edited 1 time(s). Last edit at 01/08/2013 09:26AM by Cyberwizzard.
Re: Teacup: Problem with Gen7 branch new split-Makefiles
January 08, 2013 03:32PM
I found out that the issue lies in the use of a non-standard makefile: if I run
ln -s Makefile-AVR Makefile

I can run make without a '-f', '--file=' or '--makefile=' argument at which point I can compile Teacup again... This is odd and smells like a Make bug - am I the only one with this issue?

My make version is: Make 3.81
Re: Teacup: Problem with Gen7 branch new split-Makefiles
January 09, 2013 07:12AM
Quote

So does this split-makefile work for other people besides me or is it just broken at the moment?

Actually, it's developed on Ubuntu and be assured, I push only what works at least for me smiling smiley

The good news: I get the same problem when there's no Makefile file.

Line 79 of Makefile-common reads:
$(BUILDDIR)/%.o: %.c config.h Makefile Makefile-common
If you remove the word "Makefile" from this line, building without the file Makefile works again.

I think this commit should fix the issue: [github.com]

Thanks for the hint, Cyberwizzard!


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Sorry, only registered users may post in this forum.

Click here to login