-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
40 lines (27 loc) · 827 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
LIBNAME := $(notdir $(CURDIR))
OBJDIR := $(OBJDIR)/$(LIBNAME)
TARGET := $(LIBNAME).so
SRC_DIR := ${shell find ./ -type d -print}
VPATH := $(SOURCE_DIRS)
SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
OBJ := $(addprefix $(OBJDIR)/,$(notdir $(SRC:.cpp=.o)))
LDFLAGS += -lv4l2 `pkg-config --libs --cflags opencv4`
BLDCMD := $(CXX) -shared -o $(OUTDIR)/$(TARGET) $(OBJ) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)
VPATH = $(SRC_DIR)
.PHONY: objdir
$(OUTDIR)/$(TARGET): objdir $(OBJ)
-@mkdir -p $(BINDIR)
-@mkdir -p $(LIBDIR)
-@mkdir -p $(OUTDIR)
@echo "Building $(TARGET)"
@$(BLDCMD)
$(OBJDIR)/%.o : %.cpp
@echo "Compiling $<"
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
objdir:
-@mkdir -p $(OBJDIR)
clean:
@echo "Cleaning $(LIBNAME)"
-@rm -rf $(OBJDIR)
-@rm -f $(OUTDIR)/$(TARGET)
-include $(OBJ:%.o=%.d)