-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
34 lines (25 loc) · 896 Bytes
/
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
# based on work by Hilton Lipschitz, posted in
# http://hiltmon.com/blog/2013/07/03/a-simple-c-plus-plus-project-structure/
# Set the main compiler here. Options e.g.: 'gcc', 'g++'
CC := g++
# Special directories
SRCDIR := src
BUILDDIR := build
TARGET := bin/cvrp
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
# use -ggdb for GNU debugger
CFLAGS := -g -ggdb -Wall -std=c++11
LIB := -L lib
INC := -I include
$(TARGET): $(OBJECTS)
@echo " Linking..."
@echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
@echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET) *~
.PHONY: clean