6 changed files with 74 additions and 6 deletions
@ -0,0 +1,68 @@ |
|||||
|
#
|
||||
|
# **************************************************************
|
||||
|
# * Simple C++ Makefile Template *
|
||||
|
# * *
|
||||
|
# * Author: Arash Partow (2003) *
|
||||
|
# * URL: http://www.partow.net/programming/makefile/index.html *
|
||||
|
# * Modified: Maximilian Stiefel (2021) *
|
||||
|
# * *
|
||||
|
# * Copyright notice: *
|
||||
|
# * Free use of this C++ Makefile template is permitted under *
|
||||
|
# * the guidelines and in accordance with the the MIT License *
|
||||
|
# * http://www.opensource.org/licenses/MIT *
|
||||
|
# * *
|
||||
|
# **************************************************************
|
||||
|
#
|
||||
|
|
||||
|
CXX := -clang |
||||
|
CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -std=c++20 -pthread |
||||
|
LDFLAGS := -lstdc++ -lrt -lpigpio -lm -lboost_program_options |
||||
|
BUILD := ./build |
||||
|
OBJ_DIR := $(BUILD)/objects |
||||
|
APP_DIR := $(BUILD)/app |
||||
|
TARGET := SaMcam |
||||
|
INCLUDE := -Iinclude/ -Ilib/ |
||||
|
SRC := \
|
||||
|
$(wildcard src/drivers/*.cpp)\
|
||||
|
$(wildcard src/hal/*.cpp) \
|
||||
|
$(wildcard src/*.cpp) \
|
||||
|
|
||||
|
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o) |
||||
|
DEPENDENCIES \ |
||||
|
:= $(OBJECTS:.o=.d) |
||||
|
|
||||
|
all: build $(APP_DIR)/$(TARGET) |
||||
|
|
||||
|
$(OBJ_DIR)/%.o: %.cpp |
||||
|
@mkdir -p $(@D) |
||||
|
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -MMD -o $@ |
||||
|
|
||||
|
$(APP_DIR)/$(TARGET): $(OBJECTS) |
||||
|
@mkdir -p $(@D) |
||||
|
$(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS) |
||||
|
|
||||
|
-include $(DEPENDENCIES) |
||||
|
|
||||
|
.PHONY: all build clean debug release info |
||||
|
|
||||
|
build: |
||||
|
@mkdir -p $(APP_DIR) |
||||
|
@mkdir -p $(OBJ_DIR) |
||||
|
|
||||
|
debug: CXXFLAGS += -DDEBUG -g |
||||
|
debug: all |
||||
|
|
||||
|
release: CXXFLAGS += -O2 |
||||
|
release: all |
||||
|
|
||||
|
clean: |
||||
|
-@rm -rvf $(OBJ_DIR)/* |
||||
|
-@rm -rvf $(APP_DIR)/* |
||||
|
|
||||
|
info: |
||||
|
@echo "[*] Application dir: ${APP_DIR} " |
||||
|
@echo "[*] Object dir: ${OBJ_DIR} " |
||||
|
@echo "[*] Sources: ${SRC} " |
||||
|
@echo "[*] Objects: ${OBJECTS} " |
||||
|
@echo "[*] Dependencies: ${DEPENDENCIES} " |
||||
|
@echo "[*] Linker flags: ${LDFLAGS} " |
@ -1,4 +1,4 @@ |
|||||
#include <include/a4988.h> |
#include <a4988.h> |
||||
#include <pigpio.h> |
#include <pigpio.h> |
||||
#include <queue> |
#include <queue> |
||||
#include <cmath> |
#include <cmath> |
@ -1,4 +1,4 @@ |
|||||
#include <include/stepper.h> |
#include <stepper.h> |
||||
#include <thread> |
#include <thread> |
||||
#include <functional> |
#include <functional> |
||||
#include <iostream> |
#include <iostream> |
@ -1,5 +1,5 @@ |
|||||
#include <iostream> |
#include <iostream> |
||||
#include <include/stepper.h> |
#include <stepper.h> |
||||
#include <boost/program_options.hpp> |
#include <boost/program_options.hpp> |
||||
|
|
||||
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
Loading…
Reference in new issue