First Commit
This commit is contained in:
95
libraries/ssd1306/tools/oled_cli/Makefile.common
Normal file
95
libraries/ssd1306/tools/oled_cli/Makefile.common
Normal file
@@ -0,0 +1,95 @@
|
||||
# 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 different platforms
|
||||
#
|
||||
# Accept the following parameters:
|
||||
# CC
|
||||
# CXX
|
||||
# STRIP
|
||||
# AR
|
||||
#
|
||||
|
||||
default: all
|
||||
|
||||
DESTDIR ?=
|
||||
BLD ?= ../../bld
|
||||
BACKSLASH?=/
|
||||
OUTFILE?=oled_cli
|
||||
MKDIR?=mkdir -p
|
||||
convert=$(subst /,$(BACKSLASH),$1)
|
||||
|
||||
.SUFFIXES: .bin .out .hex .srec
|
||||
|
||||
$(BLD)/%.o: %.c
|
||||
-$(MKDIR) $(call convert,$(dir $@))
|
||||
$(CC) -std=gnu11 $(CCFLAGS) $(CCFLAGS-$@) $(CCFLAGS-$(basename $(notdir $@))) -c $< -o $@
|
||||
|
||||
$(BLD)/%.o: %.ino
|
||||
-$(MKDIR) $(call convert,$(dir $@))
|
||||
$(CXX) -std=c++11 $(CCFLAGS) $(CXXFLAGS) -x c++ -c $< -o $@
|
||||
|
||||
$(BLD)/%.o: %.cpp
|
||||
-$(MKDIR) $(call convert,$(dir $@))
|
||||
$(CXX) -std=c++11 $(CCFLAGS) $(CXXFLAGS) $(CCFLAGS-$(basename $(notdir $@))) -c $< -o $@
|
||||
|
||||
# ************* Common defines ********************
|
||||
|
||||
INCLUDES += \
|
||||
-I. \
|
||||
-I../../src
|
||||
|
||||
CXXFLAGS += -fno-rtti
|
||||
|
||||
CCFLAGS += -MD -g -Os -w -ffreestanding $(INCLUDES) -Wall -Werror \
|
||||
-Wl,--gc-sections -ffunction-sections -fdata-sections \
|
||||
$(EXTRA_CCFLAGS)
|
||||
|
||||
.PHONY: clean ssd1306 all help
|
||||
|
||||
SRCS += main.cpp \
|
||||
|
||||
OBJS = $(addprefix $(BLD)/, $(addsuffix .o, $(basename $(SRCS))))
|
||||
|
||||
LDFLAGS += -L$(BLD) -lssd1306
|
||||
|
||||
####################### Compiling library #########################
|
||||
|
||||
ssd1306:
|
||||
$(MAKE) -C ../../src -f Makefile.$(platform)
|
||||
|
||||
all: $(OUTFILE)
|
||||
|
||||
$(OUTFILE): $(OBJS) ssd1306
|
||||
-$(MKDIR) $(call convert,$(dir $@))
|
||||
$(CC) -o $(OUTFILE) $(CCFLAGS) $(OBJS) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf $(BLD)
|
||||
rm -f *~ *.out *.bin *.hex *.srec *.s *.o *.pdf *core
|
||||
|
||||
help:
|
||||
@echo "Makefile accepts the following targets:"
|
||||
@echo " all Build oled_cli tool"
|
||||
|
||||
-include $(OBJS:%.o=%.d)
|
||||
Reference in New Issue
Block a user