Parent Directory | Revision Log
Revision 1.21 - (view) (download)
1 : | edgomez | 1.4 | ############################################################################## |
2 : | # | ||
3 : | Isibaar | 1.17 | # - Unified Makefile for Xvid for *nix environments - |
4 : | edgomez | 1.4 | # |
5 : | edgomez | 1.14 | # Copyright(C) 2003-2004 Edouard Gomez <ed.gomez@free.fr> |
6 : | edgomez | 1.4 | # |
7 : | # | ||
8 : | # Description: | ||
9 : | Isibaar | 1.17 | # This Makefile allows building Xvid sources to obtain a shared library |
10 : | edgomez | 1.12 | # and a static library. This Makefile uses variables defined in the |
11 : | edgomez | 1.4 | # platform.inc file. This platform.inc file is usually created by the |
12 : | # ./configure script whenever a unix shell is available. | ||
13 : | # | ||
14 : | edgomez | 1.14 | # Makefile functional dependencies: |
15 : | edgomez | 1.12 | # - echo |
16 : | # - rm (with option -r and -f) | ||
17 : | # - cd | ||
18 : | # - make VPATH support (eg: GNU make, solaris 8 make) | ||
19 : | edgomez | 1.14 | # - ar |
20 : | edgomez | 1.4 | # |
21 : | edgomez | 1.12 | # Building output: |
22 : | # - C means "_C_ompiling" | ||
23 : | # - A means "_A_ssembling" | ||
24 : | # - I means "_I_nstalling" | ||
25 : | # - D means "creating _D_irectory" | ||
26 : | # - Cl means "_Cl_eaning" | ||
27 : | # | ||
28 : | # NB: (for mingw32/djgpp users) | ||
29 : | # These 2 environments do not provide a shell by default. So it's impossible | ||
30 : | # to use the configure script to generate a platform.inc file suitable for | ||
31 : | # your machine. You have two choices: | ||
32 : | # - install minsys from the mingw project or install cygwin and then use | ||
33 : | # the configure script as on a unix system. | ||
34 : | # - write a platform.inc file by hand. | ||
35 : | # | ||
36 : | # PS: default build directory is "=build", it fits naming conventions that | ||
37 : | # make the arch/tla revision control program ignore files contained in | ||
38 : | # this directory during commits operations. This choice is completly | ||
39 : | # arbitrary, but try not to change it. | ||
40 : | edgomez | 1.4 | # |
41 : | ############################################################################## | ||
42 : | Isibaar | 1.1 | |
43 : | edgomez | 1.4 | include sources.inc |
44 : | Isibaar | 1.21 | ifeq ($(findstring $(MAKECMDGOALS), clean distclean mrproper),) |
45 : | edgomez | 1.4 | include platform.inc |
46 : | Isibaar | 1.21 | endif |
47 : | Isibaar | 1.1 | |
48 : | RM = rm -rf | ||
49 : | |||
50 : | edgomez | 1.4 | ############################################################################## |
51 : | # | ||
52 : | # Build rules | ||
53 : | # | ||
54 : | ############################################################################## | ||
55 : | |||
56 : | # Their Objects | ||
57 : | edgomez | 1.12 | OBJECTS = $(GENERIC_OBJECTS) |
58 : | OBJECTS += $(ASSEMBLY_OBJECTS) | ||
59 : | OBJECTS += $(DCT_IA64_OBJECTS) | ||
60 : | edgomez | 1.13 | OBJECTS += $(PPC_ALTIVEC_OBJECTS) |
61 : | edgomez | 1.12 | |
62 : | edgomez | 1.14 | # The VPATH mechanism could use a "per target" build directory |
63 : | edgomez | 1.12 | # To keep it simple at the moment, the directory is fixed to "build" |
64 : | BUILD_DIR = =build | ||
65 : | VPATH = $(SRC_DIR):$(BUILD_DIR) | ||
66 : | edgomez | 1.4 | |
67 : | #----------------------------------------------------------------------------- | ||
68 : | # The default rule | ||
69 : | #----------------------------------------------------------------------------- | ||
70 : | |||
71 : | .SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c | ||
72 : | |||
73 : | Isibaar | 1.20 | all: info $(STATIC_LIB) $(SHARED_LIB) |
74 : | edgomez | 1.5 | @echo |
75 : | @echo "---------------------------------------------------------------" | ||
76 : | Isibaar | 1.17 | @echo " Xvid has been successfully built." |
77 : | edgomez | 1.12 | @echo |
78 : | @echo " * Binaries are currently located in the '$(BUILD_DIR)' directory" | ||
79 : | @echo " * To install them on your system, you can run '# make install'" | ||
80 : | @echo " as root." | ||
81 : | edgomez | 1.5 | @echo "---------------------------------------------------------------" |
82 : | @echo | ||
83 : | edgomez | 1.4 | |
84 : | edgomez | 1.12 | $(OBJECTS): platform.inc |
85 : | |||
86 : | $(BUILD_DIR): | ||
87 : | @echo " D: $(BUILD_DIR)" | ||
88 : | @$(INSTALL) -d $(BUILD_DIR) | ||
89 : | |||
90 : | edgomez | 1.4 | #----------------------------------------------------------------------------- |
91 : | # Generic assembly rule | ||
92 : | #----------------------------------------------------------------------------- | ||
93 : | Isibaar | 1.1 | |
94 : | edgomez | 1.4 | .$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION): |
95 : | edgomez | 1.12 | @echo " A: $(@D)/$(<F)" |
96 : | @$(INSTALL) -d $(BUILD_DIR)/$(@D) | ||
97 : | @$(AS) $(AFLAGS) $< -o $(BUILD_DIR)/$@ | ||
98 : | Isibaar | 1.1 | |
99 : | edgomez | 1.4 | #----------------------------------------------------------------------------- |
100 : | # Generic C rule | ||
101 : | #----------------------------------------------------------------------------- | ||
102 : | |||
103 : | Isibaar | 1.18 | $(PPC_ALTIVEC_OBJECTS): CFLAGS+= $(ALTIVEC_CFLAGS) |
104 : | |||
105 : | edgomez | 1.4 | .c.$(OBJECT_EXTENSION): |
106 : | edgomez | 1.12 | @echo " C: $(@D)/$(<F)" |
107 : | @$(INSTALL) -d $(BUILD_DIR)/$(@D) | ||
108 : | @$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $(BUILD_DIR)/$@ | ||
109 : | edgomez | 1.4 | |
110 : | #----------------------------------------------------------------------------- | ||
111 : | # Static Library | ||
112 : | #----------------------------------------------------------------------------- | ||
113 : | |||
114 : | edgomez | 1.12 | $(STATIC_LIB): $(BUILD_DIR) $(OBJECTS) |
115 : | @echo " L: $(@F)" | ||
116 : | Isibaar | 1.19 | @cd $(BUILD_DIR) && $(AR) rc $(@F) $(OBJECTS) && $(RANLIB) $(@F) |
117 : | edgomez | 1.4 | |
118 : | #----------------------------------------------------------------------------- | ||
119 : | # Shared Library | ||
120 : | edgomez | 1.12 | # |
121 : | # NB: This rule is used a nasty way by the MacOSX module build process | ||
122 : | # In this only case, it uses the SPECIFIC_LDFLAGS to append an additionnal | ||
123 : | # linking step: | ||
124 : | # 1/ it links a pre shared lib (libxvidcore.so-temp.4) | ||
125 : | # 2/ it links that pre shared lib outputing the real shared lib (module) | ||
126 : | # In all other cases this rule is straight forward and simple. | ||
127 : | # PRE_SHARED_LIB == SHARED_LIB and no nasty command appending. | ||
128 : | # | ||
129 : | # NB': we copy the def file for the win32 target, the file is unused on other | ||
130 : | # platforms | ||
131 : | edgomez | 1.4 | #----------------------------------------------------------------------------- |
132 : | |||
133 : | edgomez | 1.12 | $(SHARED_LIB): $(BUILD_DIR) $(OBJECTS) |
134 : | @echo " L: $(@F)" | ||
135 : | @$(INSTALL) -m 644 libxvidcore.def $(BUILD_DIR)/libxvidcore.def | ||
136 : | Skal | 1.16 | @$(INSTALL) -m 644 libxvidcore.ld $(BUILD_DIR)/libxvidcore.ld |
137 : | edgomez | 1.12 | @cd $(BUILD_DIR) && $(CC) $(LDFLAGS) $(OBJECTS) -o $(PRE_SHARED_LIB) $(SPECIFIC_LDFLAGS) |
138 : | edgomez | 1.4 | |
139 : | #----------------------------------------------------------------------------- | ||
140 : | # Installation | ||
141 : | #----------------------------------------------------------------------------- | ||
142 : | |||
143 : | edgomez | 1.12 | install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB) |
144 : | @echo " D: $(libdir)" | ||
145 : | edgomez | 1.15 | @$(INSTALL) -d $(DESTDIR)$(libdir) |
146 : | edgomez | 1.12 | @echo " I: $(libdir)/$(SHARED_LIB)" |
147 : | Skal | 1.16 | @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB) |
148 : | edgomez | 1.12 | @echo " I: $(libdir)/$(STATIC_LIB)" |
149 : | Skal | 1.16 | @$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB) |
150 : | edgomez | 1.12 | @echo " D: $(includedir)" |
151 : | edgomez | 1.15 | @$(INSTALL) -d $(DESTDIR)$(includedir) |
152 : | edgomez | 1.12 | @echo " I: $(includedir)/xvid.h" |
153 : | edgomez | 1.15 | @$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(DESTDIR)$(includedir)/xvid.h |
154 : | edgomez | 1.4 | |
155 : | #----------------------------------------------------------------------------- | ||
156 : | edgomez | 1.12 | # Platorm specific file -- dumb rules for people executing make before |
157 : | # ./configure or even ./bootstrap.sh | ||
158 : | edgomez | 1.4 | #----------------------------------------------------------------------------- |
159 : | |||
160 : | edgomez | 1.12 | platform.inc: configure platform.inc.in |
161 : | edgomez | 1.4 | ./configure |
162 : | |||
163 : | edgomez | 1.12 | configure: |
164 : | ./bootstrap.sh | ||
165 : | |||
166 : | edgomez | 1.4 | #----------------------------------------------------------------------------- |
167 : | # .PHONY targets | ||
168 : | #----------------------------------------------------------------------------- | ||
169 : | |||
170 : | edgomez | 1.12 | .PHONY: mrproper distclean clean info \ |
171 : | list-objects list-targets list-install-path list-cflags | ||
172 : | edgomez | 1.4 | |
173 : | clean: | ||
174 : | edgomez | 1.12 | @echo " Cl: Build directory" |
175 : | @$(RM) $(BUILD_DIR) | ||
176 : | edgomez | 1.4 | |
177 : | distclean: clean | ||
178 : | edgomez | 1.12 | @echo " Cl: Generated build files" |
179 : | edgomez | 1.5 | @$(RM) platform.inc |
180 : | @$(RM) config.log | ||
181 : | edgomez | 1.11 | @$(RM) config.status |
182 : | edgomez | 1.5 | @$(RM) autom4te.cache |
183 : | edgomez | 1.12 | |
184 : | mrproper: distclean | ||
185 : | edgomez | 1.14 | @echo " Cl: Bootstrapped build files" |
186 : | edgomez | 1.12 | @$(RM) configure |
187 : | @$(RM) install-sh | ||
188 : | @$(RM) missing | ||
189 : | @$(RM) config.guess | ||
190 : | @$(RM) mkinstalldirs | ||
191 : | @$(RM) config.sub | ||
192 : | edgomez | 1.4 | |
193 : | list-objects: | ||
194 : | @echo | ||
195 : | edgomez | 1.12 | @echo "---------------------------------------------------------------" |
196 : | edgomez | 1.4 | @echo "Object files used for this build" |
197 : | @echo "---------------------------------------------------------------" | ||
198 : | @echo | ||
199 : | @echo $(OBJECTS) | ||
200 : | @echo | ||
201 : | |||
202 : | list-targets: | ||
203 : | @echo | ||
204 : | edgomez | 1.12 | @echo "---------------------------------------------------------------" |
205 : | edgomez | 1.4 | @echo "Target Libraries" |
206 : | @echo "---------------------------------------------------------------" | ||
207 : | @echo | ||
208 : | @echo Shared library: $(SHARED_LIB) | ||
209 : | @echo Static library: $(STATIC_LIB) | ||
210 : | @echo | ||
211 : | |||
212 : | list-install-path: | ||
213 : | @echo | ||
214 : | edgomez | 1.12 | @echo "---------------------------------------------------------------" |
215 : | edgomez | 1.4 | @echo "Install Paths" |
216 : | @echo "---------------------------------------------------------------" | ||
217 : | @echo | ||
218 : | edgomez | 1.12 | @echo Include Directory: $(includedir) |
219 : | @echo Library Directory: $(libdir) | ||
220 : | edgomez | 1.4 | @echo |
221 : | Isibaar | 1.1 | |
222 : | edgomez | 1.6 | list-cflags: |
223 : | @echo | ||
224 : | edgomez | 1.12 | @echo "---------------------------------------------------------------" |
225 : | edgomez | 1.6 | @echo "Using CFLAGS" |
226 : | @echo "---------------------------------------------------------------" | ||
227 : | @echo | ||
228 : | @echo CFLAGS=$(CFLAGS) | ||
229 : | @echo | ||
230 : | |||
231 : | info: list-objects list-cflags list-targets list-install-path |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |