Index

auto-plow / d1128e2

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1601 Dec 2018 13:4458fa73fUpdate MakefileJoshua13725N

Blob @ auto-plow / Makefile

text/plain2118 bytesdownload raw
1# Raspberry Pi settings
2CC = gcc --std=c18
3CFLAGS = -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_NASM = nasm
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_CFLAGS = $(ARDUINO_FLAGS)
20ARDUINO_CXXFLAGS = $(ARDUINO_FLAGS) -fno-exceptions
21
22ARDUINO_INCLUDE = "include/arduino/"
23
24ARDUINO_CORE_CXX_SRC = $(shell find include/arduino -name '*.cpp')
25ARDUINO_CORE_C_SRC = $(shell find include/arduino -name '*.c')
26ARDUINO_CORE_ASM_SRC = $(shell find include/arduino -name '*.S')
27
28ARD1_SOURCES = $(shell find src/ard1 -name '*.cpp')
29
30ARDUINO_CORE_C = $(ARDUINO_CORE_C_SRC:%.c=%.o)
31ARDUINO_CORE_CXX = $(ARDUINO_CORE_CXX_SRC:%.cpp=%.o)
32ARDUINO_CORE_ASM = $(ARDUINO_CORE_ASM_SRC:%.S=%.o)
33
34ARD1_OBJECTS = $(ARD1_SOURCES:%.cpp=%.o)
35
36ARD1_OUT = bin/ard1.hex
37
38
39
40.PHONY: all ard1-build
41
42all: $(OUT)
43
44$(OUT): $(OBJECTS)
45 $(CC) $(CFLAGS) $(OBJECTS) -o $(OUT)
46
47$(OBJECTS): $(SOURCES)
48 $(CC) -c $(CFLAGS) $(SOURCES)
49
50
51ard1-build: $(ARD1_OUT)
52
53%.o: %.c
54 @echo
55 @echo Compiling Arduino C file: $< to $@
56 $(ARDUINO_CC) $(ARDUINO_CFLAGS) -I $(ARDUINO_INCLUDE) $< -o $@
57
58%.o: %.cpp
59 @echo
60 @echo Compiling Arduino C++ file: $< to $@
61 $(ARDUINO_CXX) $(ARDUINO_CXXFLAGS) -I $(ARDUINO_INCLUDE) $< -o $@
62
63%.o: %.S
64 @echo
65 @echo Compiling Arduino Assembly file: $< to $@
66 $(ARDUINO_CC) $(ARDUINO_CFLAGS) -I $(ARDUINO_INCLUDE) $< -o $@
67
68
69$(ARD1_OUT): $(ARD1_OBJECTS) $(ARDUINO_CORE_CXX) $(ARDUINO_CORE_C) $(ARDUINO_CORE_ASM)
70 @echo
71 @echo Compiling Arduino objects to hex file
72 $(ARDUINO_CC) -Os -Wl,-Map,bin/main.map --gc-sections -mmcu=$(MCU) $(ARD1_OBJECTS) $(ARDUINO_CORE_CXX) $(ARDUINO_CORE_C) $(ARDUINO_CORE_ASM) -o bin/main.elf
73 $(ARDUINO_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 bin/main.elf bin/main.eep
74 $(ARDUINO_OBJCOPY) -O ihex -R .eeprom bin/main.elf $@
75