-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (37 loc) · 982 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
CXX = clang++
CFLAGS = -I./third_party/CLI11/include \
-I./third_party/rapidjson/include
ODIR = obj
LDIR = ./lib
SDIR = ./src
LIBS =
_DEPS = po2json.hpp
DEPS = $(patsubst %,$(SDIR)/%,$(_DEPS))
_OBJ = po2json.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
INSTALL_DIR = ~/.local/bin
.PHONY: all clean install
.SECONDARY: main-build
all: pre-build main-build
main-build: po2json
$(ODIR)/%.o: $(SDIR)/%.cpp $(DEPS)
$(CXX) -c -o $@ $< $(CFLAGS)
po2json: $(OBJ)
$(CXX) -o $@ $^ $(CFLAGS) $(LIBS)
pre-build:
@if git submodule status | egrep -q '^[-]|^[+]' ; then \
echo "INFO: Need to reinitialize git submodules"; \
git submodule update --init; \
else \
echo "INFO: No need to reinitialize git submodules"; \
fi
@if test ! -d $(ODIR) ; then \
mkdir $(ODIR); \
fi
clean:
rm -rf $(ODIR) *~ core $(INCDIR)/*~
install: all
@if test ! -d $(INSTALL_DIR) ; then \
mkdir -p $(INSTALL_DIR); \
fi
cp po2json $(INSTALL_DIR);