summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 6bc26a8fe5f104991af331c1976fff7fc01cbde4 (plain)
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
61
62
63
64
65
66
CXX=clang++-11
#CXX=g++-10

CXXFLAGS=-O0 -g -D_DEBUG
#CXXFLAGS=-O2 -DNDEBUG

CXXFLAGS+=-Wall -Iinclude -std=c++20

ifeq ($(CXX),clang++-11)
CXXFLAGS+=-stdlib=libc++
endif

LDLIBS+=\
-lboost_context \
-lboost_filesystem \
-lboost_timer \
-lboost_system \

ifeq ($(CXX),clang++-11)
LIBS+= \
-fuse-ld=lld-11 \
-lc++ \
-lc++abi
#-lc++fs
#-lstdc++ \
#-lstdc++fs
else
LIBS+= \
-lstdc++
#-lstdc++fs
endif

SRC=\
    src/recode.cpp \
    src/test-unicode.cpp

all: src/recode src/test-unicode

test: src/test-unicode
	src/test-unicode

src/recode: src/recode.o dep
	$(CXX) $(LDFLAGS) $< $(LDLIBS) $(LIBS) -o $@

src/test-unicode: src/test-unicode.o dep
	$(CXX) $(LDFLAGS) $< $(LDLIBS) $(LIBS) -o $@

dep: $(SRC:.cpp=.d)

%.d: %.cpp
	$(CXX) $(CXXFLAGS) -MM -MP -MF $@ -MT $(*D)/$(*F).o -c $<

%.o: %.cpp %.d
	$(CXX) $(CXXFLAGS) -c $< -o $@

clean:
	-rm -f src/recode src/test-unicode
	-find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' | xargs rm -f

install:
	mkdir -p $(DESTDIR)/usr/include
	cp include/unicode.h $(DESTDIR)/usr/include

.PHONY: all test clean install dep

-include $(wildcard $(SRC:.cpp=.d))