-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.win
More file actions
49 lines (36 loc) · 1.98 KB
/
Makefile.win
File metadata and controls
49 lines (36 loc) · 1.98 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
# binflate Makefile for Windows.
# PE binary decompression tool.
# Include common definitions.
include ../build-infra/make/common.mk
include ../build-infra/make/platform-win.mk
include ../bin-infra/make/zstd.mk
TARGET_CLI = binflate.exe
SOURCE_CLI = src/socketsecurity/binflate/extract_cli.c ../build-infra/src/socketsecurity/build-infra/binary_format_finder.c ../bin-infra/src/socketsecurity/bin-infra/compression_common.c ../bin-infra/src/socketsecurity/bin-infra/smol_segment.c ../bin-infra/src/socketsecurity/bin-infra/smol_segment_reader.c ../build-infra/src/socketsecurity/build-infra/file_utils.c ../build-infra/src/socketsecurity/build-infra/path_utils.c
SRC_DIR = src
# := + $(CFLAGS)/$(LDFLAGS) suffix so env-supplied flags append rather
# than override — Linux form; Windows previously dropped env flags.
CFLAGS := -Wall -Wextra $(OPT_FLAGS) -std=c11 $(POSIX_MACROS) $(COMMON_INCLUDES) $(ZSTD_CFLAGS) -DVERSION=\"$(VERSION)\" $(CFLAGS)
LDFLAGS := $(LDFLAGS_BASE) $(ZSTD_LDFLAGS) -lbcrypt $(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; }
$(CHECK_TOOLS_EXTRA)
# Build CLI extraction tool.
all: check-tools $(ZSTD_LIB) $(OUT_DIR)/$(TARGET_CLI)
# Generate Cabinet.dll import library.
$(IMPORT_LIB): ../bin-infra/src/socketsecurity/bin-infra/cabinet.def | $(OUT_DIR)
dlltool -d ../bin-infra/src/socketsecurity/bin-infra/cabinet.def -l $@
$(OUT_DIR)/$(TARGET_CLI): $(SOURCE_CLI) $(ZSTD_LIB) $(IMPORT_LIB) | $(OUT_DIR)
$(CC) $(CFLAGS) -o $@ $(SOURCE_CLI) $(LDFLAGS)
@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