1 |
#/************************************************************************** |
############################################################################# |
2 |
# * |
# |
3 |
# * Linux PPC makefile |
# GNU/Linux PPC Altivec Makefile |
4 |
# * |
# |
5 |
# * Adapted from linux x86 Makefile by Guillaume Morin <guillaume@morinfr.org> |
# Edit this file to enable/disable optimizations |
6 |
# * |
# |
7 |
# * libso: |
# $Id$ |
8 |
# * (-lm not neccessary if using -ffast-math) |
# |
9 |
# * |
############################################################################# |
|
# *************************************************************************/ |
|
|
|
|
10 |
|
|
11 |
include Makefile.inc |
include Makefile.inc |
12 |
|
|
13 |
CC = gcc |
# You can set/add options to CC and CFLAGS without editing this Makefile |
14 |
|
# You have just to export an environment CC/CFLAGS variable before running |
15 |
CFLAGS = -DLINUX -DARCH_PPC -DARCH_IS_BIG_ENDIAN -DARCH_PPC_ALTIVEC |
# make. |
16 |
LIBDIR = /usr/local/lib |
# |
17 |
|
# Examples : |
18 |
|
# $ export CC='gcc-3.1' |
19 |
|
# $ export CFLAGS='-maccumulate-outgoing-args' |
20 |
|
# $ make |
21 |
|
# ... |
22 |
|
|
23 |
CFLAGS += -Wall -O3 -funroll-loops -ffast-math |
# You can choose a specific compiler here removing the sharp symbol |
24 |
CFLAGS += -fstrict-aliasing -fomit-frame-pointer |
# - Default is 'cc' which is a symlink to your default distro gcc |
25 |
|
|
|
## for profiling, uncomment the next line. |
|
|
#CFLAGS += -D_PROFILING_ |
|
26 |
|
|
27 |
## for debugging, comment the previous lines and uncomment the next one. |
# CC = gcc |
28 |
#CFLAGS += -Wall -g |
# CC = gcc-3.1 |
29 |
|
|
30 |
|
# Assembler |
31 |
AS = as |
AS = as |
32 |
# if GNU as choke on Altivec instructions, try to comment the previous |
|
33 |
# line, and uncomment the next one. |
# Constants which should not be modified |
34 |
# AS = as -mvec |
CFLAGS += -DLINUX |
35 |
|
CFLAGS += -DARCH_PPC |
36 |
|
CFLAGS += -DARCH_PPC_ALTIVEC |
37 |
|
CFLAGS += -DARCH_IS_BIG_ENDIAN |
38 |
|
|
39 |
|
# Enable some experimental/debugging code |
40 |
|
# (Use only if you know what you're doing !) |
41 |
|
# PSNR during encoding |
42 |
|
# CFLAGS += -D_DEBUG_PSNR |
43 |
|
|
44 |
|
# Enable BFrame decoding (still beta) |
45 |
|
# CFLAGS += -DBRAMES_DEC |
46 |
|
|
47 |
|
LIBDIR = /usr/local/lib |
48 |
|
|
49 |
|
# Warning level options |
50 |
|
# Shows all warnings |
51 |
|
CFLAGS += -Wall |
52 |
|
# To detect non ANSI C code (xvid is not ANSI C (yet?)) |
53 |
|
# CFLAGS += -pedantic |
54 |
|
|
55 |
|
|
56 |
|
# General Optimization options |
57 |
|
# Optimize code for size (implies -O2) |
58 |
|
CFLAGS += -Os |
59 |
|
# Unroll loops code, this might speed up loops |
60 |
|
CFLAGS += -funroll-loops |
61 |
|
# Generates FPU math code |
62 |
|
CFLAGS += -ffast-math |
63 |
|
# ??? (man gcc) |
64 |
|
CFLAGS += -fstrict-aliasing |
65 |
|
# Omit the frame pointer saving at function beginning |
66 |
|
CFLAGS += -fomit-frame-pointer |
67 |
|
# Generates Position Independant Code depending on your nasm version, |
68 |
|
# this could generate shared libraries that segfault because of a nasm |
69 |
|
# bug |
70 |
|
CFLAGS += -fPIC |
71 |
|
|
72 |
|
# Debugging and Profiling options |
73 |
|
# Writes debugging symbols in object files |
74 |
|
# CFLAGS += -g |
75 |
|
# Includes profiling code in generated code, don't forget to disable |
76 |
|
# -fomit-frame-pointer as these 2 options are exclusive. |
77 |
|
# CFLAGS += -pg |
78 |
|
# Precise profiling + test coverage (-pg must be activated) |
79 |
|
# Build the library twice and execute a program using the lib twice too |
80 |
|
# First pass : Will create sourcefile.da files to keep branch statistics |
81 |
|
# CFLAGS += -fprofile-arcs |
82 |
|
# Second pass : Will create .bb and .bbg files suitable for coverage and |
83 |
|
# branch probabilities during compilation |
84 |
|
# CFLAGS += -fprofile-arcs -fbranch-probabilities -ftest-coverage |
85 |
|
|
86 |
|
############################################################################# |
87 |
|
# |
88 |
|
# Makefile rules |
89 |
|
# |
90 |
|
############################################################################# |
91 |
|
|
92 |
%.o: %.s |
%.o: %.s |
93 |
$(AS) $< -o $@ |
$(AS) $< -o $@ |
99 |
$(LIB): $(SRC:.c=.o) $(SRC_ALTIVEC:.s=.o) |
$(LIB): $(SRC:.c=.o) $(SRC_ALTIVEC:.s=.o) |
100 |
ar rcs $@ $^ |
ar rcs $@ $^ |
101 |
|
|
|
|
|
102 |
$(LIBSO): $(SRC:.c=.o) $(SRC_ALTIVEC:.s=.o) |
$(LIBSO): $(SRC:.c=.o) $(SRC_ALTIVEC:.s=.o) |
103 |
$(CC) $(CFLAGS) $^ -shared -lc -lm -o $@ |
$(CC) $(CFLAGS) $^ -shared -lc -lm -o $@ |
104 |
|
|
105 |
clean: |
clean: |
106 |
$(RM) `find $(SRCDIR) -name "*.o"` |
$(RM) `find $(SRCDIR) -name "*.o"` |
|
|
|
|
remove-all: |
|
|
$(RM) $(DIRS) |
|
|
$(RM) $(DIRS_PPC) |
|
107 |
$(RM) $(LIB) |
$(RM) $(LIB) |
108 |
$(RM) $(LIBSO) |
$(RM) $(LIBSO) |
109 |
|
|
110 |
|
install: $(LIBSO) $(LIB) |
111 |
install: libxvidcore.so |
cp $(LIBSO) $(LIBDIR) # you have to be root for this |
112 |
cp libxvidcore.so $(LIBDIR) # you have to be root for this |
cp $(LIB) $(LIBDIR) |
113 |
/sbin/ldconfig |
/sbin/ldconfig |
114 |
|
|
115 |
install-test: libxvidcore.so # if you don't want to overwrite previous compile |
install-test: $(LIBSO) # if you don't want to overwrite previous compile |
116 |
cp libxvidcore.so $(LIBDIR)/libtestcore.so |
cp $(LIBSO) $(LIBDIR)/libtestcore.so |
117 |
/sbin/ldconfig |
/sbin/ldconfig |