-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_.make
60 lines (48 loc) · 1.42 KB
/
_.make
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
##############################################################################
# Project name :
# File name : Makefile
# Last modified : Wed 16 Aug 2017 01:06:42 AM ICT
# Guide :
###############################################################################
.PHONY: all run clean cleanall tags syntatic
LANG := cpp
CC := gcc
CXX := g++
OPENCV := `pkg-config --cflags opencv --libs`
CFLAGS += -Wall -g
LIBS :=
INC := -I./inc
LFLAGS += -s -lm
TARGET := hog
CLEAR_SCREEN := clear
vpath %.cpp src
vpath %.h inc
SUB_DIR := .obj
CREATE_SUB_DIR := $(shell mkdir -p $(SUB_DIR))
vpath %.o $(SUB_DIR)
vpath %.d $(SUB_DIR)
SRCS := $(wildcard src/*.$(LANG))
INCS := $(wildcard inc/*.h)
OBJS := $(addprefix $(SUB_DIR)/,$(notdir $(SRCS:.$(LANG)=.o)))
DEPS := $(addprefix $(SUB_DIR)/,$(notdir $(SRCS:.$(LANG)=.d)))
all : $(TARGET)
$(TARGET) : $(OBJS)
@$(CXX) $(LFLAGS) $(INC) $(OBJS) -o $@ -lm $(LIBS)
$(SUB_DIR)/%.o: %.$(LANG)
@$(CXX) -c $(CFLAGS) $(INC) -MMD -MP $< -o $@ $(LIBS)
run: $(TARGET)
@$(CLEAR_SCREEN)
./$(TARGET)
clean:
@$(CLEAR_SCREEN)
@-rm -rf $(SUB_DIR)
cleanall:
@$(CLEAR_SCREEN)
@-rm -rf $(SUB_DIR) $(TARGET)
tags : $(SRCS) $(INCS)
ctags -f ./.tags --c-kinds=+p --fields=+iaS --extra=+fq ./inc
syntatic:
echo "$(INC)" > .syntastic_$(LANG)_config
echo "$(CFLAGS)" >> .syntastic_$(LANG)_config
echo "$(LFLAGS)" >> .syntastic_$(LANG)_config
sed -i 's/ -/\n-/g' .syntastic_$(LANG)_config