Index

auto-plow / 4f44ee4

A wheelchair motor-propelled battery-powered ESP32-driven remote control snow plow.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1330 Nov 2018 21:59245a6d2Update MakefileJoshua13116N

Blob @ auto-plow / Makefile

text/plain2070 bytesdownload raw
1# Raspberry Pi settings
2CC = gcc --std=c11
3CCFLAGS = -Wall -Wextra -pedantic -Os
4SOURCES = $(shell find src/rpi -name '*.c')
5OBJECTS = $(SOURCES:c=o)
6OUT = autoplow
7
8
9# Arduino Settings
10F_CPU = 16000000L
11MCU = atmega328p
12
13ARDUINO_CC = avr-gcc
14ARDUINO_CXX = avr-g++
15ARDUINO_AR = avr-ar
16ARDUINO_OBJCOPY = avr-objcopy
17
18ARDUINO_FLAGS = -c -w -Os -MMD -ffunction-sections -fdata-sections -DF_CPU=$(F_CPU) -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -mmcu=$(MCU)
19ARDUINO_CC_FLAGS = $(ARDUINO_FLAGS)
20ARDUINO_CXX_FLAGS = $(ARDUINO_FLAGS) -fno-exceptions
21
22ARDUINO_INCLUDE = "include/arduino/"
23ARDUINO_CORE_CXX_SRC = $(shell find include/arduino -name '*.cpp')
24ARDUINO_CORE_CXX = $(ARDUINO_CORE_CXX_SRC:cpp=o)
25ARDUINO_CORE_CC_SRC = $(shell find include/arduino -name '*.c')
26ARDUINO_CORE_CC = $(ARDUINO_CORE_CC_SRC:c=o)
27
28ARD1_SOURCES = $(shell find src/ard1 -name '*.cpp')
29ARD1_OBJECTS = $(ARD1_SOURCES:%.cpp=%.o)
30ARD1_OUT = bin/ard1.hex
31# ARD2_SOURCES = $(shell find src/ard2 -name '*.cpp')
32
33ARDUINO_ALL_OBJECTS := $(ARD1_OBJECTS)
34ARDUINO_ALL_OBJECTS += $(ARDUINO_CORE_CXX)
35ARDUINO_ALL_OBJECTS += $(ARDUINO_CORE_CC)
36
37.PHONY: all ard1-build
38
39all: $(OUT)
40
41$(OUT): $(OBJECTS)
42 $(CC) $(CCFLAGS) $(OBJECTS) -o $(OUT)
43
44
45ard1-build: $(ARD1_OUT)
46
47$(ARDUINO_CORE_CC): $(ARDUINO_CORE_CC_SRC)
48 $(ARDUINO_CC) $(ARDUINO_CC_FLAGS) -I$(ARDUINO_INCLUDE) $< -o $@
49
50$(ARDUINO_CORE_CXX): $(ARDUINO_CORE_CXX_SRC)
51 $(ARDUINO_CXX) $(ARDUINO_CXX_FLAGS) -I$(ARDUINO_INCLUDE) $< -o $@
52
53$(ARD1_OBJECTS): $(ARD1_SOURCES) $(ARDUINO_CORE_CXX) $(ARDUINO_CORE_CC)
54 $(ARDUINO_CXX) $(ARDUINO_CXX_FLAGS) -I$(ARDUINO_INCLUDE) $< -o $@
55
56
57$(ARD1_OUT): $(ARDUINO_ALL_OBJECTS) $(ARD1_OBJECTS) $(ARDUINO_CORE_CXX) $(ARDUINO_CORE_CC)
58 $(ARDUINO_AR) rcs core.a $<
59 $(ARDUINO_CC) -Os -Wl,--gc-sections -mmcu=$(MCU) -o $(ARD1_SOURCES:cpp=elf) $(ARD1_OBJECTS) core.a -lm
60 $(ARDUINO_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(ARD1_SOURCES:cpp=elf) $(ARD1_SOURCES:cpp=eep)
61 $(ARDUINO_OBJCOPY) -O ihex -R .eeprom $(ARD1_SOURCES:cpp=elf) $@
62 rm core.a
63