1 |
#/************************************************************************** |
############################################################################# |
2 |
# * |
# |
3 |
# * cygwin makefile (only static library) |
# GNU/Linux Makefile |
4 |
# * |
# |
5 |
# * nasm args: |
# Edit this file to enable/disable optimizations |
6 |
# * -f fmt elf (linux), coff (djgpp), win32 (cygwin) |
# |
7 |
# * -DPREFIX add '_' prefix to symbol names |
# $Id$ |
8 |
# * |
# |
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 |
#CC = /usr/local/gcc-3.0.4/bin/gcc |
# You have just to export an environment CC/CFLAGS variable before running |
15 |
|
# make. |
16 |
|
# |
17 |
|
# Examples : |
18 |
|
# $ export CC='gcc-3.1' |
19 |
|
# $ export CFLAGS='-maccumulate-outgoing-args' |
20 |
|
# $ make |
21 |
|
# ... |
22 |
|
|
23 |
|
# You can choose a specific compiler here removing the sharp symbol |
24 |
|
# - Default is 'cc' which is a symlink to your default distro gcc |
25 |
|
|
26 |
|
|
27 |
|
# CC = gcc |
28 |
|
# CC = gcc-3.1 |
29 |
|
# CC = icc |
30 |
|
|
31 |
|
# Assembler |
32 |
|
AS = nasm |
33 |
|
AFLAGS = -f win32 -DPREFIX |
34 |
|
|
35 |
|
# Constants which should not be modified |
36 |
|
CFLAGS += -DARCH_X86 |
37 |
|
CFLAGS += -DLINUX |
38 |
|
CFLAGS += -UWIN32 |
39 |
|
CFLAGS += -mno-cygwin |
40 |
|
|
41 |
|
# Enable some experimental/debugging code |
42 |
|
# (Use only if you know what you're doing !) |
43 |
|
# PSNR during encoding |
44 |
|
# CFLAGS += -D_DEBUG_PSNR |
45 |
|
|
|
CFLAGS = -DARCH_X86 -DLINUX -UWIN32 |
|
46 |
LIBDIR = /usr/local/lib |
LIBDIR = /usr/local/lib |
47 |
|
|
48 |
CFLAGS += -O3 -funroll-loops -ffast-math -fstrict-aliasing -fomit-frame-pointer |
# Warning level options |
49 |
# CFLAGS += -m486 |
# Shows all warnings |
50 |
|
CFLAGS += -Wall |
51 |
|
# To detect non ANSI C code (xvid is not ANSI C (yet?)) |
52 |
|
# CFLAGS += -pedantic |
53 |
|
|
54 |
|
|
55 |
|
# General Optimization options |
56 |
|
# Optimize code for size (implies -O2) |
57 |
|
CFLAGS += -Os |
58 |
|
# Unroll loops code, this might speed up loops |
59 |
|
CFLAGS += -funroll-loops |
60 |
|
# Generates FPU math code |
61 |
|
CFLAGS += -ffast-math |
62 |
|
# ??? (man gcc) |
63 |
|
CFLAGS += -fstrict-aliasing |
64 |
|
# Omit the x86 push ebp; mov ebp, esp function |
65 |
|
# header and its corresponding function tailer |
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 (win32 produces PIC all the time) |
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 |
|
# Try a first run with -fprofile-arcs only then build the lib again |
78 |
|
# with add branch and coverage... this will allow you to profile |
79 |
|
# the lib line a line. |
80 |
|
# CFLAGS += -pg -fprofile-arcs -fbranch-probabilities -ftest-coverage |
81 |
|
|
82 |
|
|
83 |
|
# Architecture options : Valid for every gcc version |
84 |
|
# Uncomment the one which you want to compile for |
85 |
|
|
86 |
|
# CFLAGS += -march=i386 -mcpu=i386 |
87 |
|
# CFLAGS += -march=i486 -mcpu=i486 |
88 |
|
# CFLAGS += -march=i586 -mcpu=i586 |
89 |
|
# CFLAGS += -march=i686 -mcpu=i686 |
90 |
# CFLAGS += -march=pentium -mcpu=pentium |
# CFLAGS += -march=pentium -mcpu=pentium |
91 |
CFLAGS += -march=pentiumpro -mcpu=pentiumpro |
# CFLAGS += -march=pentiumpro -mcpu=pentiumpro |
|
# CFLAGS += -march=athlon -mcpu=athlon |
|
|
CFLAGS += -mno-cygwin |
|
92 |
|
|
93 |
AS = nasm |
# Architecture options : Valid for every gcc >= 3.1 |
94 |
AFLAGS = -f win32 -DPREFIX |
# Uncomment the one which you want to compile for |
95 |
|
|
96 |
|
# CFLAGS += -march=pentium-mmx -mcpu=pentium-mmx |
97 |
|
# CFLAGS += -march=pentium3 -mcpu=pentium3 |
98 |
|
# CFLAGS += -march=pentium4 -mcpu=pentium4 |
99 |
|
# CFLAGS += -march=athlon -mcpu=athlon |
100 |
|
# CFLAGS += -march=k6 -mcpu=k6 |
101 |
|
# CFLAGS += -march=k6-2 -mcpu=k6-2 |
102 |
|
# CFLAGS += -march=k6-3 -mcpu=k6-3 |
103 |
|
# CFLAGS += -march=athlon-tbird -mcpu=athlon-tbird |
104 |
|
# CFLAGS += -march=athlon-xp -mcpu=athlon-xp |
105 |
|
# CFLAGS += -march=athlon-mp -mcpu=athlon-mp |
106 |
|
|
107 |
|
# x86 specific optimization for every gcc |
108 |
|
# Aligns the stack to 2^4=16bytes boundaries in each function |
109 |
|
# Local variables should be aligned and make the code faster |
110 |
|
# some gcc versions (3.0.4) have problems with this option |
111 |
|
# we can't really trust gcc output :-( You're warned. |
112 |
|
CFLAGS += -mpreferred-stack-boundary=4 |
113 |
|
|
114 |
|
# Architecture specific optimization available in gcc >= 3.1 |
115 |
|
# generates floating point sse code (for >= pentium 3) |
116 |
|
# CFLAGS += -mfpmath=sse |
117 |
|
# generates both floating point sse and 387 code, this double the amount |
118 |
|
# of fp registers and could make the code faster |
119 |
|
# (Still experimental in gcc 3.1.0) |
120 |
|
# CFLAGS += -mfpmath=sse,387 |
121 |
|
|
122 |
|
endif |
123 |
|
|
124 |
|
############################################################################# |
125 |
|
# |
126 |
|
# Makefile rules |
127 |
|
# |
128 |
|
############################################################################# |
129 |
|
|
130 |
%.o: %.asm |
%.o: %.asm |
131 |
$(AS) $(AFLAGS) $< -o $@ |
$(AS) $(AFLAGS) $< -o $@ |
132 |
|
|
133 |
RM = rm -rf |
RM = rm -rf |
134 |
|
|
135 |
all: $(LIB) |
|
136 |
|
all: $(LIB) $(LIBSO:.so=.dll) |
137 |
|
|
138 |
|
|
139 |
$(LIB): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) |
$(LIB): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) |
140 |
ar rcs $@ $^ |
ar rcs $@ $^ |
141 |
|
|
142 |
|
$(LIBSO:.so=.dll): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) |
143 |
|
$(CC) $(CFLAGS) -shared -Wl,--dll,--out-implib,$@.a -o $@ $^ libxvidcore.def |
144 |
|
|
145 |
clean: |
clean: |
146 |
$(RM) `find $(SRCDIR) -name "*.o"` |
$(RM) `find $(SRCDIR) -name "*.o"` |
|
|
|
|
remove-all: |
|
|
$(RM) $(DIRS) |
|
|
$(RM) $(DIRS_INTEL) |
|
147 |
$(RM) $(LIB) |
$(RM) $(LIB) |
148 |
|
$(RM) $(LIBSO:.so=.dll) |
149 |
|
|
150 |
install: $(LIB) |
install: $(LIBSO:.so=.dll) $(LIBSO:.so=.dll) $(LIB) |
151 |
cp $(LIB) $(LIBDIR)/libxvidcore.a |
cp $(LIBSO:.so=.dll) $(LIBDIR) # you have to bee root for this |
152 |
|
cp $(LIBSO:.so=.dll.a) $(LIBDIR) |
153 |
install-test: $(LIB) # if you don't want to overwrite previous compile |
cp $(LIB) $(LIBDIR) |
154 |
cp $(LIB) $(LIBDIR)/libtestcore.a |
/sbin/ldconfig |