You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
894 B
Makefile
59 lines
894 B
Makefile
TARGET=sbm
|
|
BUILD_DIR=build
|
|
MK_DIR=mkdir -p
|
|
|
|
|
|
CPP_SRCS= \
|
|
src/main.cpp \
|
|
src/p_serial_bus.cpp \
|
|
src/p_serial_packet.cpp \
|
|
src/p_idp.cpp
|
|
|
|
#TOOLCHAIN=armv7a-unknown-linux-gnueabihf
|
|
TOOLCHAIN=
|
|
CC=$(TOOLCHAIN)-g++
|
|
SIZE=$(TOOLCHAIN)-size
|
|
INCLUDES=\
|
|
-Icfg\
|
|
-Iinc
|
|
CFLAGS=-Og \
|
|
-Wall \
|
|
-fdata-sections \
|
|
-ffunction-sections \
|
|
-std=gnu++11 \
|
|
-g3 \
|
|
-DDEBUG \
|
|
$(INCLUDES) \
|
|
-Wextra \
|
|
-Werror \
|
|
-Wconversion \
|
|
-lzmq
|
|
|
|
ifdef RUN_TESTS
|
|
CPP_SRCS+=tests/tests.cpp
|
|
INCLUDES+=-Itests
|
|
CFLAGS+=-DRUN_TESTS
|
|
endif
|
|
|
|
all: bin/$(TARGET)
|
|
|
|
OBJS=$(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SRCS:.cpp=.o)))
|
|
vpath %.cpp $(sort $(dir $(CPP_SRCS)))
|
|
|
|
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
|
|
$(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
bin/$(TARGET): $(OBJS) Makefile
|
|
$(CC) $(OBJS) -o $@ -lzmq
|
|
size $@
|
|
|
|
$(BUILD_DIR):
|
|
mkdir $@
|
|
|
|
clean:
|
|
@rm -fR $(BUILD_DIR)
|
|
@rm -f bin/$(TARGET)
|
|
|
|
|
|
|