-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
42 lines (32 loc) · 1.09 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
C_DEPS_DIR := $(abspath c-deps)
ZLIB_SRC_DIR := $(C_DEPS_DIR)/zlib
LIBJPEG_SRC_DIR := $(C_DEPS_DIR)/libjpeg-turbo
QPDF_SRC_DIR := $(C_DEPS_DIR)/qpdf
UNAME := $(shell uname)
ifneq ($(UNAME), Darwin)
XGO_LDFLAGS += -extldflags "-static"
endif
all: build
zlib: .submodules-initialized
cd $(ZLIB_SRC_DIR) && ./configure --static && make
libjpeg: .submodules-initialized
cd $(LIBJPEG_SRC_DIR) && cmake -G"Unix Makefiles" -DENABLE_SHARED=0 && make
qpdf: zlib libjpeg .submodules-initialized
export LDFLAGS="-L$(ZLIB_SRC_DIR) -L$(LIBJPEG_SRC_DIR)"; \
export CFLAGS="-I$(ZLIB_SRC_DIR) -I$(LIBJPEG_SRC_DIR)"; \
export CPPFLAGS="$${CFLAGS}"; \
cd $(QPDF_SRC_DIR) && ./autogen.sh && ./configure --disable-shared && make
bin/pdftilecut: qpdf zlib libjpeg
go build -o bin/pdftilecut -ldflags "$(XGO_LDFLAGS)"
.submodules-initialized:
ifneq ($$(git rev-parse --git-dir 2>/dev/null),)
git submodule update --init --recursive
endif
mkdir -p $(@D)
touch $@
build: bin/pdftilecut
.PHONY: clean
clean:
cd $(ZLIB_SRC_DIR) && make clean
cd $(LIBJPEG_SRC_DIR) && make clean
cd $(QPDF_SRC_DIR) && make clean