Line 0
Link Here
|
|
|
1 |
--- Makefile.orig 2015-01-11 16:17:07 UTC |
2 |
+++ Makefile |
3 |
@@ -17,7 +17,7 @@ USE_BPGVIEW=y |
4 |
# Enable for compilation on MacOS X |
5 |
#CONFIG_APPLE=y |
6 |
# Installation prefix |
7 |
-prefix=/usr/local |
8 |
+prefix=${DESTDIR}${PREFIX} |
9 |
|
10 |
|
11 |
################################# |
12 |
@@ -31,19 +31,20 @@ CROSS_PREFIX:= |
13 |
EXE:= |
14 |
endif |
15 |
|
16 |
-CC=$(CROSS_PREFIX)gcc |
17 |
-CXX=$(CROSS_PREFIX)g++ |
18 |
-AR=$(CROSS_PREFIX)ar |
19 |
+CC?=$(CROSS_PREFIX)gcc |
20 |
+CXX?=$(CROSS_PREFIX)g++ |
21 |
+AR?=$(CROSS_PREFIX)ar |
22 |
+LD?=$(CROSS_PREFIX)ld |
23 |
EMCC=emcc |
24 |
|
25 |
PWD:=$(shell pwd) |
26 |
|
27 |
-CFLAGS:=-Os -Wall -MMD -fno-asynchronous-unwind-tables -fdata-sections -ffunction-sections -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer |
28 |
-CFLAGS+=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT |
29 |
-CFLAGS+=-I. |
30 |
-CFLAGS+=-DCONFIG_BPG_VERSION=\"$(shell cat VERSION)\" |
31 |
+CFLAGS_DIST:=-Os -Wall -MMD -fno-asynchronous-unwind-tables -fdata-sections -ffunction-sections -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer |
32 |
+CFLAGS_DIST+=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT |
33 |
+CFLAGS_DIST+=-I. |
34 |
+CFLAGS_DIST+=-DCONFIG_BPG_VERSION=\"$(shell cat VERSION)\" |
35 |
ifdef USE_JCTVC_HIGH_BIT_DEPTH |
36 |
-CFLAGS+=-DRExt__HIGH_BIT_DEPTH_SUPPORT |
37 |
+CFLAGS_DIST+=-DRExt__HIGH_BIT_DEPTH_SUPPORT |
38 |
endif |
39 |
|
40 |
# Emscriptem config |
41 |
@@ -53,14 +54,17 @@ EMLDFLAGS+=-s NO_FILESYSTEM=1 -s NO_BROW |
42 |
EMLDFLAGS+=-O3 --memory-init-file 0 --closure 1 --post-js post.js |
43 |
EMCFLAGS:=$(CFLAGS) |
44 |
|
45 |
-LDFLAGS=-g |
46 |
+LDFLAGS_DIST=-g |
47 |
ifdef CONFIG_APPLE |
48 |
-LDFLAGS+=-Wl,-dead_strip |
49 |
+LDFLAGS_DIST+=-Wl,-dead_strip |
50 |
else |
51 |
-LDFLAGS+=-Wl,--gc-sections |
52 |
+LDFLAGS_DIST+=-Wl,--gc-sections |
53 |
endif |
54 |
-CFLAGS+=-g |
55 |
-CXXFLAGS=$(CFLAGS) |
56 |
+CFLAGS_DIST+=-g |
57 |
+ |
58 |
+CFLAGS:=${CFLAGS_DIST} ${CFLAGS} |
59 |
+LDFLAGS:=${LDFLAGS_DIST} ${LDFLAGS} |
60 |
+CXXFLAGS=${CFLAGS} |
61 |
|
62 |
PROGS=bpgdec$(EXE) bpgenc$(EXE) |
63 |
ifdef USE_BPGVIEW |
64 |
@@ -70,7 +74,7 @@ ifdef USE_EMCC |
65 |
PROGS+=bpgdec.js bpgdec8.js bpgdec8a.js |
66 |
endif |
67 |
|
68 |
-all: $(PROGS) |
69 |
+all: libbpg.a libbpg.so $(PROGS) |
70 |
|
71 |
LIBBPG_OBJS:=$(addprefix libavcodec/, \ |
72 |
hevc_cabac.o hevc_filter.o hevc.o hevcpred.o hevc_refs.o\ |
73 |
@@ -158,6 +162,9 @@ bpgenc.o: CFLAGS+=-Wno-unused-but-set-va |
74 |
libbpg.a: $(LIBBPG_OBJS) |
75 |
$(AR) rcs $@ $^ |
76 |
|
77 |
+libbpg.so: $(LIBBPG_OBJS) |
78 |
+ $(CC) $(LDFLAGS) -shared -o $@ $^ |
79 |
+ |
80 |
bpgdec$(EXE): bpgdec.o libbpg.a |
81 |
$(CC) $(LDFLAGS) -o $@ $^ $(BPGDEC_LIBS) |
82 |
|