Gameduino/Makefile
From Hackerspace Brussels
This Makefile works on MacOS X, when Arduino.app is in /Applications (change the path if needed) and the Gameduino library in your Documents/Arduino/libraries folder.
You also need the avr tools and avrdude. A package can be found for MacOS X on http://www.obdev.at/products/crosspack/download.html
######### # PATHS # ######### ARDUINO_APP=/Applications/Arduino.app GAMEDUINO_PATH=$(HOME)/Documents/Arduino/libraries/Gameduino ########### # ARDUINO # ########### BITRATE=19200 PROGRAMMER=arduino PARTNO=atmega168 PORT=/dev/tty.usbserial-A6004aKP ######### # FLAGS # ######### AVRGXXFLAGS=-g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=$(PARTNO) -DF_CPU=16000000L -DARDUINO=100 \ -I$(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino \ -I$(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/variants/standard \ -I$(ARDUINO_APP)/Contents/Resources/Java/libraries/SPI \ -I$(GAMEDUINO_PATH) \ -I$(GAMEDUINO_PATH)/utility ############### # EXECUTABLES # ############### AVRAR=avr-ar AVRDUDE=avrdude AVRGXX=avr-g++ AVROBJCOPY=avr-objcopy ######### # RULES # ######### all: build/program.hex upload: build/program.hex $(AVRDUDE) -p$(PARTNO) -c$(PROGRAMMER) -P$(PORT) -b$(BITRATE) -D -Uflash:w:$^:i build/program.hex: build/program.elf rm -f $@ $(AVROBJCOPY) -j .text -j .data -O ihex $^ $@ build/program.elf: build/program.o build/GD.o build/SPI.o build/core.a $(AVRGXX) $(AVRGXXFLAGS) -o $@ $^ build/program.o: program.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/GD.o: $(GAMEDUINO_PATH)/GD.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/SPI.o: $(ARDUINO_APP)/Contents/Resources/Java/libraries/SPI/SPI.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/core.a: build/WInterrupts.c.o build/wiring.c.o build/wiring_analog.c.o build/wiring_digital.c.o build/wiring_pulse.c.o build/wiring_shift.c.o build/CDC.cpp.o build/HardwareSerial.cpp.o build/HID.cpp.o build/IPAddress.cpp.o build/main.cpp.o build/new.cpp.o build/Print.cpp.o build/Stream.cpp.o build/Tone.cpp.o build/USBCore.cpp.o build/WMath.cpp.o build/WString.cpp.o rm -f build/core.a $(AVRAR) rcs $@ $^ build/WInterrupts.c.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/WInterrupts.c $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/wiring.c.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring.c $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/wiring_analog.c.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_analog.c $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/wiring_digital.c.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_digital.c $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/wiring_pulse.c.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_pulse.c $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/wiring_shift.c.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_shift.c $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/CDC.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/CDC.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/HardwareSerial.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/HID.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/HID.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/IPAddress.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/IPAddress.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/main.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/new.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/Print.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/Stream.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/Stream.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/Tone.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/Tone.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/USBCore.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/USBCore.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/WMath.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/WMath.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ build/WString.cpp.o: $(ARDUINO_APP)/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.cpp $(AVRGXX) $(AVRGXXFLAGS) -c -o $@ $^ clean: rm -rf build/*