-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
72 lines (63 loc) · 1.66 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
# ---------------------------------------------------------------------
# shasum flags
SPI = 3.0
CFLAGS = -Wall -O3 $(OSFLAGS)
EXTRA=
# build.py
# src/tests.do
# src/shasum.c
# ---------------------------------------------------------------------
# OS parsing
INCLUDE=
ifeq ($(OS),Windows_NT)
LIBSSL = libssl.a
LIBCRYPTO = libcrypto.a
LIBPATH = ./lib/openssl/windows
SSL = -L$(LIBPATH) -l:$(LIBSSL) -l:$(LIBCRYPTO)
# SSL = -l:$(LIBSSL) -l:$(LIBCRYPTO)
#
OSFLAGS = -shared
OUT = lib/plugin/shasum_windows.plugin
# GCC = x86_64-w64-mingw32-gcc-5.4.0.exe
GCC = x86_64-w64-mingw32-gcc.exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIBSSL = libssl.a
LIBCRYPTO = libcrypto.a
LIBPATH = ./lib/openssl/unix
SSL = -L$(LIBPATH) -l:$(LIBSSL) -l:$(LIBCRYPTO)
# SSL = -l:$(LIBSSL) -l:$(LIBCRYPTO)
#
OSFLAGS = -shared -fPIC -DSYSTEM=OPUNIX
OUT = lib/plugin/shasum_unix.plugin
endif
ifeq ($(UNAME_S),Darwin)
LIBSSL = libssl.a
LIBCRYPTO = libcrypto.a
LIBPATH = ./lib/openssl/macosx
SSL = $(LIBPATH)/$(LIBSSL) $(LIBPATH)/$(LIBCRYPTO)
# SSL = -l:$(LIBSSL) -l:$(LIBCRYPTO)
#
OSFLAGS = -bundle -DSYSTEM=APPLEMAC
OUT = lib/plugin/shasum_macosx.plugin
endif
GCC = gcc
endif
# ---------------------------------------------------------------------
# Rules
all: clean links shasum
links:
rm -f src/lib
rm -f src/spi
ln -sf ../lib src/lib
ln -sf lib/spi-$(SPI) src/spi
shasum: src/shasum.c src/spi/stplugin.c
mkdir -p ./build
mkdir -p ./lib/plugin
mkdir -p ./lib/openssl
$(GCC) $(CFLAGS) $(EXTRA) $(INCLUDE) -o $(OUT) src/spi/stplugin.c src/shasum.c $(SSL)
cp lib/plugin/shasum*plugin build/
.PHONY: clean
clean:
rm -f $(OUT) $(OUTE)