Skip to content

Commit 566e7f6

Browse files
committed
Add makefile to spikesorter plugin
1 parent 96f503d commit 566e7f6

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
LIBNAME := $(notdir $(CURDIR))
3+
OBJDIR := $(OBJDIR)/$(LIBNAME)
4+
TARGET := $(LIBNAME).so
5+
6+
7+
SRC_DIR := ${shell find ./ -type d -print}
8+
VPATH := $(SOURCE_DIRS)
9+
10+
SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
11+
OBJ := $(addprefix $(OBJDIR)/,$(notdir $(SRC:.cpp=.o)))
12+
13+
BLDCMD := $(CXX) -shared -o $(OUTDIR)/$(TARGET) $(OBJ) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)
14+
15+
VPATH = $(SRC_DIR)
16+
17+
.PHONY: objdir
18+
19+
$(OUTDIR)/$(TARGET): objdir $(OBJ)
20+
-@mkdir -p $(BINDIR)
21+
-@mkdir -p $(LIBDIR)
22+
-@mkdir -p $(OUTDIR)
23+
@echo "Building $(TARGET)"
24+
@$(BLDCMD)
25+
26+
$(OBJDIR)/%.o : %.cpp
27+
@echo "Compiling $<"
28+
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
29+
30+
31+
objdir:
32+
-@mkdir -p $(OBJDIR)
33+
34+
clean:
35+
@echo "Cleaning $(LIBNAME)"
36+
-@rm -rf $(OBJDIR)
37+
-@rm -f $(OUTDIR)/$(TARGET)
38+
39+
-include $(OBJ:%.o=%.d)

0 commit comments

Comments
 (0)