You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
739 B
41 lines
739 B
2 years ago
|
CC = g++
|
||
|
|
||
|
OPT = -O3
|
||
|
FLAGS = -std=c++20 -Wall -Wextra -pedantic
|
||
|
LIBS = -lwiringPi
|
||
|
|
||
|
TARGET = bbx-test
|
||
|
SOURCEDIR = src
|
||
|
BUILDDIR = build
|
||
|
|
||
|
SOURCES = $(wildcard $(SOURCEDIR)/*.cpp)
|
||
|
OBJECTS = $(patsubst $(SOURCEDIR)/%.cpp,$(BUILDDIR)/%.o,$(SOURCES))
|
||
|
|
||
|
.PHONY: all clean depend run
|
||
|
|
||
|
all: $(TARGET)
|
||
|
|
||
|
$(BUILDDIR):
|
||
|
@mkdir -p $(BUILDDIR)
|
||
|
|
||
|
$(TARGET): $(OBJECTS)
|
||
|
$(CC) $(FLAGS) $(OPT) $^ -o $@ $(LIBS)
|
||
|
|
||
|
$(OBJECTS): $(BUILDDIR)/%.o : $(SOURCEDIR)/%.cpp $(SOURCEDIR)/%.hpp | $(BUILDDIR)
|
||
|
$(CC) $(FLAGS) $(OPT) -c $< -o $@ $(LIBS)
|
||
|
|
||
|
depend: .depend
|
||
|
|
||
|
.depend: $(SOURCES)
|
||
|
rm -rf $(BUILDDIR)/.depend
|
||
|
$(CXX) $(FLAGS) -MM $^ -MF $(BUILDDIR)/.depend
|
||
|
|
||
|
clean:
|
||
|
rm -rf $(BUILDDIR)
|
||
|
rm -f $(TARGET)
|
||
|
|
||
|
run: $(TARGET)
|
||
|
sudo ./$(TARGET)
|
||
|
|
||
|
-include $(BUILDDIR)/.depend
|