45 lines
1.1 KiB
Makefile
Executable File
45 lines
1.1 KiB
Makefile
Executable File
# BrainStem2-DevantechI2C-Cpp-Example Cpp
|
|
|
|
CPP = g++
|
|
ROOT = .
|
|
TARGET = BrainStem2-DevantechI2C-Cpp-Example
|
|
OUT := linux_$(TARGET)
|
|
DBG_DST := $(OUT)/Debug
|
|
REL_DST := $(OUT)/Release
|
|
|
|
# We are looking for the BrainStem2 library in
|
|
# a lib folder sibling to this makefile. Change
|
|
# these defines to point somewhere else if this
|
|
# is not the case.
|
|
LIBRARIES := -L$(ROOT)/lib -lBrainStem2
|
|
INCLUDES := -Ilib/
|
|
|
|
# We add the current directory to the rpath expecting
|
|
# that libBrainStem2.so will be copied into the build
|
|
# folder. If this is not the case adjust the rpath
|
|
# do match your needs.
|
|
CFLAGS = -std=c++11 -Wall -Werror -Wl,-rpath,. $(INCLUDES)
|
|
|
|
all : dirs
|
|
make app
|
|
|
|
app : debug release
|
|
|
|
.PHONY : debug
|
|
debug: dirs
|
|
$(CPP) $(CFLAGS) BrainStem2-DevantechI2C-Cpp/main.cpp $(LIBRARIES) -o $(DBG_DST)/BrainStem2-DevantechI2C-Cpp
|
|
cp lib/libBrainStem2.so $(DBG_DST)
|
|
|
|
.PHONY : release
|
|
release: dirs
|
|
$(CPP) $(CFLAGS) -DNDEBUG BrainStem2-DevantechI2C-Cpp/main.cpp $(LIBRARIES) -o $(REL_DST)/BrainStem2-DevantechI2C-Cpp
|
|
cp lib/libBrainStem2.so $(REL_DST)
|
|
|
|
.PHONY : dirs
|
|
dirs:
|
|
mkdir -p $(DBG_DST)
|
|
mkdir -p $(REL_DST)
|
|
|
|
clean:
|
|
rm -rf $(OUT)
|