# MIT License # # Copyright (c) 2018, Alexey Dynda # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # ################################################################# # Makefile to build ssd1306 examples for AVR controllers # # Accept the following parameters: # CC # CXX # STRIP # AR # MCU # FREQUENCY default: all ifndef IDF_PATH $(error If building for ESP32, you must supply the IDF_PATH variable.) endif BLD ?= ../bld PROJECT ?= demos/ssd1306_demo prepare_esp32_library: mkdir -p $(BLD)/esp32/components/ssd1306 cp -a ../src $(BLD)/esp32/components/ssd1306/ cp -a ../component.mk $(BLD)/esp32/components/ssd1306/ prepare_esp32_sketch: mkdir -p $(BLD)/esp32/components/sketch cp -a $(PROJECT)/* $(BLD)/esp32/components/sketch/ mv $(BLD)/esp32/components/sketch/$(notdir $(PROJECT)).ino $(BLD)/esp32/components/sketch/$(notdir $(PROJECT)).cpp echo "COMPONENT_ADD_INCLUDEDIRS := ." > $(BLD)/esp32/components/sketch/component.mk prepare_esp32_project: mkdir -p $(BLD)/esp32/main cp -a ./esp32_main.cpp $(BLD)/esp32/main/ echo "" > $(BLD)/esp32/main/component.mk echo "#" > $(BLD)/esp32/sdkconfig.defaults echo "PROJECT_NAME:=$(notdir $(PROJECT))" > $(BLD)/esp32/Makefile # echo "COMPONENTS:=main sketch ssd1306" >> $(BLD)/esp32/Makefile echo "include \$$(IDF_PATH)/make/project.mk" >> $(BLD)/esp32/Makefile .PHONY: build build: prepare_esp32_project prepare_esp32_library prepare_esp32_sketch $(MAKE) -C $(BLD)/esp32 all: build flash: build $(MAKE) -C $(BLD)/esp32 flash