-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
75 lines (56 loc) · 1.48 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
CC := g++
CCFLAGS += -std=c++11 -Wall -g -O0
ARCH=$(shell uname -m)
ifeq ($(ARCH), aarch64)
LIBRARY = -llz4-arm64
else
LIBRARY = -llz4-x64
endif
LDFLAGS += -Wl,--gc-sections -Wl,--as-needed -Llib $(LIBRARY) -ldl
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags)
SRC := \
src/core.cc \
src/proc.cc \
src/lz4.cc \
src/arthur.cc
OBJ := $(SRC:src/%.cc=build/%.o)
DEP := $(OBJ:%.o=%.d)
INC := -Iinclude
DEF := -DGIT_VERSION=\"$(GIT_VERSION)\"
TARGET = arthur
TARGET_G = arthur_g
PACKAGE = Arthur-$(GIT_VERSION)-$(shell uname -s)-$(shell uname -p).tar.gz
PACKAGE_G = Arthur-$(GIT_VERSION)-$(shell uname -s)-$(shell uname -p)-Debug.tar.gz
.PHONY: clean all test cleanall distclean package
.SUFFIXES:
.SECONDARY:
all: $(TARGET)
build/$(TARGET_G): $(OBJ)
@echo LINK $(notdir $@)
@$(CC) $(CCFLAGS) -o $@ $(OBJ) $(LDFLAGS)
build/$(TARGET): build/$(TARGET_G)
@strip $< -o $@
$(TARGET): build/$(TARGET)
@ln -sf build/$(TARGET) $@
build/%.o: src/%.cc
@echo CC $<
@mkdir -p $(dir $@)
@$(CC) $(CCFLAGS) $(INC) $(DEF) -MMD -MT $@ -MF build/$*.d -o $@ -c $<
test:
@echo TBD
clean:
@rm -rf build $(TARGET)
@rm -rf Arthur-*.tar.gz
cleanall: clean
distclean: cleanall
host.log: $(TARGET)
@sh -c "uname -a; cat /etc/*release; ldd ./arthur" > $@
$(PACKAGE): $(TARGET)
@echo $@
@tar cfz $(PACKAGE) build/arthur
$(PACKAGE_G): $(TARGET) host.log
@echo $@
@tar cfz $(PACKAGE_G) build/arthur build/arthur_g host.log
package: $(PACKAGE) $(PACKAGE_G)
@echo $*
-include $(DEP)