-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.linux
74 lines (55 loc) · 1.96 KB
/
Makefile.linux
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
67
68
69
70
71
72
73
74
# Makefile.linux
#
TARGETS=ModelDecoder ModelEncoder
all: $(TARGETS)
OBJ=.o
EXE=
OBJSDIR=objs_linux
PYTHON=python3
# Bulk of definitions are shared between platforms
#
include Makefile.common
# Compile
#
CC=gcc
CFLAGS=-g -march=sandybridge -mfpmath=sse -MMD $(DEFINES) $(INCLUDES) -O3 -flto -funroll-loops
#CFLAGS=-g -march=sandybridge -mfpmath=sse -MMD $(DEFINES) $(INCLUDES)
CXX=g++
CXXFLAGS=--std=c++11 $(CFLAGS)
# Link
#
LD=$(CXX)
LDFLAGS=-g $(CXXFLAGS)
LDLIBS=-lm -lgcov
ModelDecoder: version $(DECODER_ALL_OBJS)
$(LD) $(LDFLAGS) $(DECODER_ALL_OBJS) $(LDLIBS) -o $@
ModelEncoder: version $(ENCODER_ALL_OBJS)
$(LD) $(LDFLAGS) $(ENCODER_ALL_OBJS) $(LDLIBS) -o $@
ModelTest: version $(TESTS_ALL_OBJS)
$(LD) $(LDFLAGS) $(TESTS_ALLOBJS) $(LDLIBS) -o $@
$(OBJSDIR)/sub_decoder.o: $(OBJSDIR)/git_version.h
$(OBJSDIR)/git_version.h: version
#
$(OBJSDIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJSDIR)/%.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<
version:
@mkdir -p $(OBJSDIR)
@(echo "// Automatically generated by Makefile" ; git describe --dirty --always --long --tags | sed 's/\(^.*\)/#define GIT_VERSION "\1"/' ) > $(OBJSDIR)/_git_version.h
@diff -q $(OBJSDIR)/_git_version.h $(OBJSDIR)/git_version.h || ( cp $(OBJSDIR)/_git_version.h $(OBJSDIR)/git_version.h && echo "Updated git_version.h" )
clean:
-rm -rf ModelEncoder ModelDecoder $(OBJSDIR)
deploy:
$(MAKE) -j5 -f Makefile.linux clean
$(MAKE) -j5 -f Makefile.linux version
$(MAKE) -j5 -f Makefile.linux ModelDecoder
toolchain_windows.sh $(CURDIR) make CXX=clang-cl LD=lld-link OBJSDIR=objs_w64_clang -j5 -f Makefile.w64 clean
toolchain_windows.sh $(CURDIR) make CXX=clang-cl LD=lld-link OBJSDIR=objs_w64_clang -j5 -f Makefile.w64 version
toolchain_windows.sh $(CURDIR) make CXX=clang-cl LD=lld-link OBJSDIR=objs_w64_clang -j5 -f Makefile.w64 ModelDecoder.exe
scripts/deploy.sh
DEPS:=$(sort $(DECODER_OBJS:.o=.d) $(ENCODER_OBJS:.o=.d))
-include $(DEPS)
.PHONY: all clean deploy version