Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

72 lines (51 sloc) 1.532 kB
CC = gcc
CU = nvcc
LD = nvcc # use nvcc tu solve CUDA_PATH manual setting
SET_DIR = .
EXEC = swsharp
CC_FLAGS = -O3 -Wall
CU_FLAGS = -O3 -arch sm_13
LD_FLAGS = -O3 -lstdc++ -lpthread
OBJ_DIR = obj
SRC_DIR = src
DOC_DIR = doc
LIB_DIR = $(SET_DIR)/lib
INC_DIR = $(SET_DIR)/include/$(EXEC)
SRC := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/*.cu)
OBJ := $(SRC:.cu=.o)
OBJ := $(OBJ:.c=.o)
OBJ := $(subst $(SRC_DIR), $(OBJ_DIR), $(OBJ))
DEP := $(OBJ:.o=.d)
LIB := $(LIB_DIR)/lib$(EXEC).a
DOC := $(DOC_DIR)/doc.template
API_HEADERS := chain.h chain_base.h matcher.h sw.h sw_data.h\
sw_prefs.h sw_reconstruct.h sw_result.h
API_HEADERS_DST := $(addprefix $(INC_DIR)/, $(API_HEADERS))
API_HEADERS_SRC := $(addprefix $(SRC_DIR)/, $(API_HEADERS))
DIRS_CREATED = $(OBJ_DIR)/.null
all: $(EXEC)
$(EXEC): $(OBJ)
$(LD) $(OBJ) -o $@ $(LD_FLAGS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(DIRS_CREATED)
$(CC) $< -c -o $@ -MMD $(CC_FLAGS) -Isrc/
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cu $(DIRS_CREATED)
$(CU) $< -M -o $(@:.o=.d) --output-directory $(OBJ_DIR)
$(CU) $< -c -o $@ $(CU_FLAGS)
$(DIRS_CREATED):
@mkdir -p $(OBJ_DIR)
@touch $(DIRS_CREATED)
clean:
rm $(OBJ) $(DEP) $(EXEC) $(INC_DIR) $(LIB_DIR) -fr
install: all lib include
lib: all $(LIB)
include: $(API_HEADERS_DST)
$(LIB): $(OBJ)
@mkdir -p $(LIB_DIR)
ar rcs $(LIB) $(filter-out obj/main.o, $(OBJ))
$(INC_DIR)/%.h: $(SRC_DIR)/%.h
@mkdir -p $(INC_DIR)
cp $< $(INC_DIR)
@sed -i -e '/cond PRIVATE/,/endcond/c\ \' $@
docs: $(API_HEADERS_SRC) $(DOC)
doxygen $(DOC)
-include $(DEP)
Jump to Line
Something went wrong with that request. Please try again.