1234567891011121314151617181920212223242526272829 |
- CXX=/usr/bin/g++
- FLAGS = -g -Wall -pthread -std=c++11
- TF_CFLAGS=$(shell python3 -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))' 2>/dev/null)
- TF_LFLAGS=$(shell python3 -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))' 2>/dev/null)
- SRC_DIR=.
- INC_DIR=.
- BUILD_DIR=.
- SRCS=$(wildcard $(SRC_DIR)/*.cpp)
- OBJS=$(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRCS))
- EXECUTABLE=matMul.so
- all: dir $(BUILD_DIR)/$(EXECUTABLE)
- dir:
- mkdir -p $(BUILD_DIR)
- $(BUILD_DIR)/$(EXECUTABLE): $(OBJS)
- $(CXX) -shared $(TF_LFLAGS) -Wall -o $@ $^
- $(OBJS): $(BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp $(INC_DIR)/%.hpp
- $(CXX) $(FLAGS) -fPIC -c $(TF_CFLAGS) -I$(INC_DIR) -o $@ $< -O2
- clean:
- rm -f $(BUILD_DIR)/*.o $(BUILD_DIR)/$(EXECUTABLE)
|