Arduino Compile with Makefile


Hi Folks,

I’ve been plinking around with the Legacy firmware and for me the learning curve has been steep. I’ve found the standard stuff … tip of 0.2.10 not the same as tag 0.2.10, Brewpi vs BrewPi, probe calibration, etc. One thing that I noticed is that in the script outputs, the controller firmware shows as “build unknown”:

Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port/dev/ttyAMA0

I suspect this is because the last 0.2.10 firmware was compiled outside of a firmware repo based on these lines in

GIT_VERSION = $(shell cd $(SOURCE_PATH); git describe --long)
$(info using $(GIT_VERSION) as build name)

So, I figured I’d build inside my git repo and see what happens. The first time I got errors based on not finding Actuator.o:

$ make BUILD_NAME=dev BOARD=uno clean all
rm -f  tmp/Actuator.o tmp/ActuatorArduinoPin.o tmp/ArduinoFunctions.o tmp/Brewpi.o tmp/BrewpiStrings.o tmp/Buzzer.o tmp/DallasTemperature.o tmp/DeviceManager.o tmp/Display.o tmp/DisplayLcd.o tmp/DS2413.o tmp/EepromManager.o tmp/FilterCascaded.o tmp/FilterFixed.o tmp/Logger.o tmp/Main.o tmp/Menu.o tmp/OLEDFourBit.o tmp/OneWire.o tmp/OneWireTempSensor.o tmp/PiLink.o tmp/Random.o tmp/RotaryEncoder.o tmp/Sensor.o tmp/SettingsManager.o tmp/Simulator.o tmp/SpiLcd.o tmp/TempControl.o tmp/TemperatureFormats.o tmp/TempSensor.o tmp/Ticks.o
rm -f  tmp/Actuator.d tmp/ActuatorArduinoPin.d tmp/ArduinoFunctions.d tmp/Brewpi.d tmp/BrewpiStrings.d tmp/Buzzer.d tmp/DallasTemperature.d tmp/DeviceManager.d tmp/Display.d tmp/DisplayLcd.d tmp/DS2413.d tmp/EepromManager.d tmp/FilterCascaded.d tmp/FilterFixed.d tmp/Logger.d tmp/Main.d tmp/Menu.d tmp/OLEDFourBit.d tmp/OneWire.d tmp/OneWireTempSensor.d tmp/PiLink.d tmp/Random.d tmp/RotaryEncoder.d tmp/Sensor.d tmp/SettingsManager.d tmp/Simulator.d tmp/SpiLcd.d tmp/TempControl.d tmp/TemperatureFormats.d tmp/TempSensor.d tmp/Ticks.d
rm -f "final/brewpi-avr.elf" "final/brewpi-avr.a" "final/brewpi-avr.hex" "final/brewpi-avr.lss" "final/brewpi-avr.eep" "final/" "final/brewpi-avr.srec"
make: *** No rule to make target 'tmp/Actuator.o', needed by 'final/brewpi-avr.elf'.  Stop.

So, duffer that I am I searched for “Actuator” in “makefile” and commented those lines out. I tried again and got an error that I don’t quite understand when it tries to link:

$ make BUILD_NAME=dev BOARD=uno clean all
rm -f
rm -f
rm -f "final/brewpi-avr.elf" "final/brewpi-avr.a" "final/brewpi-avr.hex" "final/brewpi-avr.lss" "final/brewpi-avr.eep" "final/" "final/brewpi-avr.srec"
Building target: final/brewpi-avr.elf
Invoking: AVR8/GNU Linker
"avr-g++" -o final/brewpi-avr.elf     -Wl,-Map="final/" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p -Wl,--relax
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot open map file final/ No such file or directory
collect2: error: ld returned 1 exit status
makefile:330: recipe for target 'final/brewpi-avr.elf' failed
make: *** [final/brewpi-avr.elf] Error 1

So that noise you hear is my face hitting the end of my abilities … or maybe it’s the sound of my head hitting a wall. If this is trivial maybe someone can help me out. If it’s not I’ll just hard-code the BUILD_NAME and forget I ever saw the makefile. :slight_smile: