-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
42 lines (33 loc) · 1.01 KB
/
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
41
42
# project name (generate executable with this name)
TARGET = parser
CC = g++
# compiling flags here
CFLAGS = -Wall -I. `Magick++-config --cppflags --cxxflags` `pkg-config opencv --cflags`
LINKER = g++ -o
# linking flags here
LFLAGS = -Wall -I. -lm `Magick++-config --ldflags`
LIBS = `Magick++-config --libs` `pkg-config opencv --libs`
# change these to set the proper directories where each files shoould be
SRCDIR = src
OBJDIR = obj
BINDIR = bin
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
rm = rm -f
$(BINDIR)/$(TARGET): $(OBJECTS)
@$(LINKER) $@ $(LFLAGS) $(OBJECTS) $(LIBS)
@echo "Linking complete!"
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp
@mkdir -p $(OBJDIR)
@mkdir -p $(BINDIR)
@$(CC) $(CFLAGS) -c $< -o $@
@echo "Compiled "$<" successfully!"
.PHONEY: clean
clean:
@$(rm) $(OBJECTS)
@echo "Cleanup complete!"
.PHONEY: remove
remove: clean
@$(rm) $(BINDIR)/$(TARGET)
@echo "Executable removed!"