-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (68 loc) · 1.69 KB
/
Makefile
File metadata and controls
88 lines (68 loc) · 1.69 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
# Droidspaces v6 - droidspaces-socketd build system
# SPDX-License-Identifier: GPL-3.0-or-later
ROOT_DIR := ../..
SRC_DIR := .
API_DIR := ..
OUT_DIR := $(ROOT_DIR)/output
OBJ_DIR := $(OUT_DIR)/.obj/socketd
BINARY_NAME := droidspaces-socketd
TARGET := $(OUT_DIR)/$(BINARY_NAME)
CXX ?= g++
# Verbose control - V=1 shows full commands, V=0 keeps output tidy
V ?= 0
# Static link control - off by default
STATIC ?= 0
ifeq ($(V),1)
Q =
msg_cxx =
msg_ld =
else
Q = @
msg_cxx = @printf " CXX %s\n" $<
msg_ld = @printf " CXXLD %s\n" $@
endif
CXXFLAGS ?= -Wall -Wextra -Wpedantic -Werror \
-O2 -std=c++17 \
-I$(SRC_DIR) -I$(API_DIR)/include
LDFLAGS ?=
LDLIBS ?=
ifeq ($(STATIC),1)
LDFLAGS += -static
endif
SRCS := \
main.cpp \
backend_client.cpp \
container_list.cpp \
container_inspect.cpp \
snapshot_lists.cpp \
event_log.cpp \
api_server.cpp
OBJS := $(SRCS:%.cpp=$(OBJ_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
.PHONY: all clean help
all: $(TARGET)
help:
@echo "droidspaces-socketd build system"
@echo ""
@echo "Targets:"
@echo " make - Build $(BINARY_NAME)"
@echo " make clean - Remove socketd build artifacts"
@echo ""
@echo "Options:"
@echo " V=1 - Show full compiler commands"
@echo " CXX=... - Override the C++ compiler"
@echo " STATIC=1 - Link droidspaces-socketd statically"
$(OUT_DIR):
$(Q)mkdir -p $(OUT_DIR)
$(OBJ_DIR):
$(Q)mkdir -p $(OBJ_DIR)
$(TARGET): $(OBJS) | $(OUT_DIR)
$(msg_ld)
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(OBJ_DIR)/%.o: %.cpp | $(OBJ_DIR)
$(msg_cxx)
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
clean:
$(Q)rm -rf $(OBJ_DIR)
$(Q)rm -f $(TARGET)
-include $(DEPS)