This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
86 lines (74 loc) · 2.05 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
76
77
78
79
80
81
82
83
84
85
86
# Makefile for building application launcher
#
# Makefile targets:
#
# all/install build and install the NIF
# clean clean build products and intermediates
#
# Variables to override:
#
# MIX_APP_PATH path to the build directory
#
# CC C compiler
# CFLAGS compiler flags for compiling all C files
# LDFLAGS linker flags for linking all binaries
#
ifeq ($(MIX_APP_PATH),)
calling_from_make:
mix compile
endif
PREFIX = $(MIX_APP_PATH)/launcher
BUILD = $(MIX_APP_PATH)/obj
CFLAGS ?= -O2 -Wall -Wextra -Wno-unused-parameter -pedantic
CFLAGS += -D_GNU_SOURCE
LDFLAGS ?=
OUTPUT_FLAGS = -o
ifeq ($(OS),Windows_NT)
OUTPUT_FLAGS = -pipe -Wl,-o
SHELL = cmd
endif
BAKEWARE_OBJECTS = \
$(BUILD)/cache.o \
$(BUILD)/cpio.o \
$(BUILD)/index.o \
$(BUILD)/main.o \
$(BUILD)/rm_fr.o \
$(BUILD)/sha1.o \
$(BUILD)/sha_read.o \
$(BUILD)/trailer.o \
$(BUILD)/unzstd.o \
$(BUILD)/utils.o
ZSTD_OBJECTS = $(BUILD)/zstd/lib/decompress/huf_decompress.o \
$(BUILD)/zstd/lib/decompress/zstd_ddict.o \
$(BUILD)/zstd/lib/decompress/zstd_decompress.o \
$(BUILD)/zstd/lib/decompress/zstd_decompress_block.o \
$(BUILD)/zstd/lib/common/debug.o \
$(BUILD)/zstd/lib/common/entropy_common.o \
$(BUILD)/zstd/lib/common/error_private.o \
$(BUILD)/zstd/lib/common/fse_decompress.o \
$(BUILD)/zstd/lib/common/pool.o \
$(BUILD)/zstd/lib/common/threading.o \
$(BUILD)/zstd/lib/common/xxhash.o \
$(BUILD)/zstd/lib/common/zstd_common.o
ZSTD_BUILD_DIRS = $(BUILD)/zstd/lib/decompress $(BUILD)/zstd/lib/common
all: $(BUILD) $(PREFIX) $(ZSTD_BUILD_DIRS) $(PREFIX)/launcher
$(BUILD)/%.o: src/%.c
@echo " CC $(notdir $@)"
$(CC) -c $(CFLAGS) -o $@ $<
$(PREFIX)/launcher: $(BAKEWARE_OBJECTS) $(ZSTD_OBJECTS)
@echo " LD $(notdir $@)"
$(CC) $^ $(LDFLAGS) $(OUTPUT_FLAGS)$@
strip $@
ifeq ($(OS),Windows_NT)
$(PREFIX) $(BUILD) $(ZSTD_BUILD_DIRS):
if not exist "$@" mkdir "$@"
else
$(PREFIX) $(BUILD) $(ZSTD_BUILD_DIRS):
mkdir -p $@
endif
clean:
$(RM) $(PREFIX)/launcher \
$(BUILD)/*.o
.PHONY: all clean calling_from_make
# Don't echo commands unless the caller exports "V=1"
${V}.SILENT: