forked from radum2275/merlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.linux
More file actions
48 lines (32 loc) · 795 Bytes
/
Makefile.linux
File metadata and controls
48 lines (32 loc) · 795 Bytes
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
CXX := g++
CXX_FLAGS := -Wall -O0 -std=c++98 -g
RUN_ARGS := --help
BIN := bin
BUILD := build
SRC := src
INCLUDE := include
LIB := lib
LIBRARIES := -lboost_program_options
EXECUTABLE := merlin
SRCS := $(shell find $(SRC) -name *.cpp)
OBJS := $(SRCS:%=$(BUILD)/%.o)
DEPS := $(OBJS:.o=.d)
INC_FLAGS := $(addprefix -I,$(INCLUDE))
LDFLAGS := $(addprefix -L,$(LIB))
CPP_FLAGS := $(INC_FLAGS) -MMD -MP
$(BIN)/$(EXECUTABLE): $(OBJS)
$(MKDIR_P) $(BIN)
$(CXX) $(OBJS) $(LDFLAGS) -o $@ $(LIBRARIES)
# c++ source
$(BUILD)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPP_FLAGS) $(CXX_FLAGS) -c $< -o $@
.PHONY: clean
all: $(BIN)/$(EXECUTABLE)
run: clean all
./$(BIN)/$(EXECUTABLE) $(RUN_ARGS)
clean:
$(RM) -r $(BUILD)/*
$(RM) -r $(BIN)/*
-include $(DEPS)
MKDIR_P ?= mkdir -p