-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.linux
More file actions
45 lines (33 loc) · 1.61 KB
/
Makefile.linux
File metadata and controls
45 lines (33 loc) · 1.61 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
# binflate Makefile for Linux.
# ELF binary decompression tool.
# Include common definitions.
include ../build-infra/make/common.mk
include ../build-infra/make/platform-linux.mk
include ../bin-infra/make/zstd.mk
include ../build-infra/make/crypto.mk
TARGET_CLI = binflate
SOURCE_CLI = src/socketsecurity/binflate/extract_cli.c $(BUILD_INFRA_SRC)/binary_format_finder.c $(BIN_INFRA_SRC)/compression_common.c $(BIN_INFRA_SRC)/smol_segment.c $(BIN_INFRA_SRC)/smol_segment_reader.c $(BUILD_INFRA_SRC)/file_utils.c $(BUILD_INFRA_SRC)/path_utils.c
SRC_DIR = src
# CFLAGS/LDFLAGS can be set via environment (e.g., for musl include/lib paths).
CFLAGS := -Wall -Wextra $(OPT_FLAGS) -std=c11 $(POSIX_MACROS) $(COMMON_INCLUDES) $(ZSTD_CFLAGS) -DVERSION=\"$(VERSION)\" $(CFLAGS)
LDFLAGS := $(LDFLAGS_BASE) $(ZSTD_LDFLAGS) $(CRYPTO_LDFLAGS) $(LDFLAGS)
.PHONY: all check-tools clean install test
# Check that required build tools are available.
check-tools:
@command -v $(CC) >/dev/null 2>&1 || { echo "ERROR: $(CC) not found. Install build tools first."; exit 1; }
@command -v make >/dev/null 2>&1 || { echo "ERROR: make not found"; exit 1; }
# Build CLI extraction tool.
all: check-tools $(ZSTD_LIB) $(OUT_DIR)/$(TARGET_CLI)
$(OUT_DIR)/$(TARGET_CLI): $(SOURCE_CLI) $(ZSTD_LIB) | $(OUT_DIR)
$(CC) $(CFLAGS) -o $@ $(SOURCE_CLI) $(LDFLAGS)
$(call STRIP_BINARY,$@)
@echo "Built: $(OUT_DIR)/$(TARGET_CLI)"
$(OUT_DIR):
mkdir -p $@
clean:
$(call CLEAN_IMPL,binflate)
install: all
@echo "Decompression CLI tool built successfully: $(OUT_DIR)/$(TARGET_CLI)"
test: all
@echo "Running binflate tests..."
@cd $(PROJECT_ROOT) && pnpm exec vitest run