Created
December 11, 2016 03:35
-
-
Save yellowcrescent/678a17f866eeba9faadf88e9e4c8ba5f to your computer and use it in GitHub Desktop.
makefile for pinger thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trying to build a fucking makefile | |
# jacob AVR makefile | |
#BUILDNAME=BLINKTEST | |
BUILDNAME=PINGER-2016 | |
## Program names | |
CC=avr-gcc | |
CXX=avr-g++ | |
OBJ2HEX=avr-objcopy | |
UISP=avrdude | |
## Programmer type | |
PROGHW=bsd | |
PROGPORT=/dev/parport0 | |
PROGPART=ATMEGA328P | |
### Arduino shit | |
ARDUINO_HOME=/opt/Arduino | |
ARDUINO=-DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR | |
ARDUINO_OBJS=hooks.o abi.o WInterrupts.o wiring.o wiring_analog.o wiring_digital.o wiring_pulse.o wiring_shift.o HardwareSerial.o new.o Print.o Stream.o USBCore.o WMath.o WString.o CDC.o HardwareSerial0.o | |
## Project & Device parameters | |
TARGET=$(BUILDNAME) | |
DEVICE=atmega328p | |
XTAL=1000000L | |
EXTRA_CFLAGS=-DF_CPU=$(XTAL) \ | |
-I$(ARDUINO_HOME)/hardware/arduino/avr/cores/arduino \ | |
-I$(ARDUINO_HOME)/hardware/arduino/avr/libraries \ | |
-I$(ARDUINO_HOME)/hardware/arduino/avr/variants/standard \ | |
-I$(ARDUINO_HOME)/libraries/LiquidCrystal/src \ | |
-I$(ARDUINO_HOME)/libraries/NewPing | |
## Compilation & Programming parameters | |
#CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=$(DEVICE) $(EXTRA_CFLAGS) | |
#CFLAGS=-Os -Wall -mmcu=$(DEVICE) $(EXTRA_CFLAGS) | |
CFLAGS=-fpermissive -ffunction-sections -fdata-sections -g -w -Os -std=c99 -mmcu=$(DEVICE) -Wall $(EXTRA_CFLAGS) $(ARDUINO) | |
UISPARGS=-c $(PROGHW) -F -p $(PROGPART) -P $(PROGPORT) -U flash:w: | |
## Object list | |
OBJS = $(BUILDNAME).o | |
program : $(TARGET).hex | |
$(UISP) $(UISPARGS)$(TARGET).hex | |
.cpp.o: | |
$(CXX) -c $(CFLAGS) $< -o $@ | |
.S.o: | |
$(CC) -x assembler-with-cpp -c $(CFLAGS) $< -o $@ | |
.c.s: | |
$(CC) -S $(CFLAGS) $< -o $@ | |
LiquidCrystal.o: $(ARDUINO_HOME)/libraries/LiquidCrystal/src/LiquidCrystal.cpp | |
$(CXX) -c $(CFLAGS) $< -o $@ | |
NewPing.o: $(ARDUINO_HOME)/libraries/NewPing/NewPing.cpp | |
$(CXX) -c $(CFLAGS) $< -o $@ | |
wiring_pulse.S.o: $(ARDUINO_HOME)/hardware/arduino/avr/cores/arduino/wiring_pulse.S | |
$(CC) -x assembler-with-cpp -c $(CFLAGS) $< -o $@ | |
%.o: $(ARDUINO_HOME)/hardware/arduino/avr/cores/arduino/%.cpp | |
$(CXX) -c $(CFLAGS) $< -o $@ | |
%.o: $(ARDUINO_HOME)/hardware/arduino/avr/cores/arduino/avr-libc/%.c | |
$(CC) -c $(CFLAGS) -o $@ $^ | |
%.o: $(ARDUINO_HOME)/hardware/arduino/avr/cores/arduino/%.c | |
$(CC) -c $(CFLAGS) -o $@ $^ | |
$(TARGET).bin: $(OBJS) $(ARDUINO_OBJS) wiring_pulse.S.o LiquidCrystal.o NewPing.o | |
$(CC) $(CFLAGS) -o $@ $(OBJS) $(ARDUINO_OBJS) wiring_pulse.S.o LiquidCrystal.o NewPing.o | |
$(TARGET).hex: $(TARGET).bin | |
$(OBJ2HEX) -j .text -j .data -R .eeprom -O ihex $< $@ | |
clean : | |
rm -f *.hex *.obj *.o *.bin | |
all : $(TARGET).hex | |
#setfuse: | |
# $(UISP) -c $(PROGHW) -F -p $(PROGPART) -P $(PROGPORT) -U lfuse:w:0xff:m -U hfuse:w:0xd8:m | |
#$(UISP) -c $(PROGHW) -F -p $(PROGPART) -P $(PROGPORT) -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xfd:m | |
#checkfuse: | |
# ../checkfuse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment