Browse code

Use common.mak in the top-level Makefile as well.

Originally committed as revision 12599 to svn://svn.ffmpeg.org/ffmpeg/trunk

Diego Biurrun authored on 2008/03/26 18:39:12
Showing 2 changed files
... ...
@@ -10,11 +10,6 @@ vpath %.c    $(SRC_PATH_BARE)
10 10
 vpath %.h    $(SRC_PATH_BARE)
11 11
 vpath %.texi $(SRC_PATH_BARE)
12 12
 
13
-CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
14
-       -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
15
-       -I$(SRC_PATH)/libavdevice -I$(SRC_PATH)/libavfilter \
16
-       -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
17
-
18 13
 PROGS-$(CONFIG_FFMPEG)   += ffmpeg
19 14
 PROGS-$(CONFIG_FFPLAY)   += ffplay
20 15
 PROGS-$(CONFIG_FFSERVER) += ffserver
... ...
@@ -53,6 +48,10 @@ main: lib $(PROGS_G) $(PROGS) $(ALL_TARGETS-yes)
53 53
 vhook/%.o: vhook/%.c
54 54
 	$(CC) $(VHOOKCFLAGS) -c -o $@ $<
55 55
 
56
+.depend: version.h $(PROGS_SRCS)
57
+
58
+include common.mak
59
+
56 60
 VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
57 61
 
58 62
 BASEHOOKS = fish null watermark
... ...
@@ -128,9 +127,6 @@ videohook: .libs $(HOOKS)
128 128
 vhook/%$(SLIBSUF): vhook/%.o
129 129
 	$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
130 130
 
131
-%.o: %.c
132
-	$(CC) $(CFLAGS) -c -o $@ $<
133
-
134 131
 documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
135 132
                                  ffplay-doc.html general.html hooks.html \
136 133
                                  $(ALLMANPAGES))
... ...
@@ -145,8 +141,6 @@ doc/%.pod: doc/%-doc.texi
145 145
 doc/%.1: doc/%.pod
146 146
 	pod2man --section=1 --center=" " --release=" " $< > $@
147 147
 
148
-install: install-libs install-headers $(INSTALL_TARGETS-yes)
149
-
150 148
 ifeq ($(BUILD_SHARED),yes)
151 149
 install-progs: install-libs
152 150
 endif
... ...
@@ -171,7 +165,7 @@ install-libs:
171 171
 	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  install-libs
172 172
 	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-libs
173 173
 
174
-install-headers:
174
+install-headers::
175 175
 	$(MAKE)                    -C libavutil   install-headers
176 176
 	$(MAKE)                    -C libavcodec  install-headers
177 177
 	$(MAKE)                    -C libavformat install-headers
... ...
@@ -180,7 +174,7 @@ install-headers:
180 180
 	$(MAKE)                    -C libswscale  install-headers
181 181
 	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter install-headers
182 182
 
183
-uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
183
+uninstall: uninstall-progs uninstall-man uninstall-vhook
184 184
 
185 185
 uninstall-progs:
186 186
 	rm -f $(addprefix "$(BINDIR)/", $(ALLPROGS))
... ...
@@ -192,7 +186,7 @@ uninstall-vhook:
192 192
 	rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
193 193
 	-rmdir "$(SHLIBDIR)/vhook/"
194 194
 
195
-uninstall-libs:
195
+uninstall-libs::
196 196
 	$(MAKE) -C libavutil   uninstall-libs
197 197
 	$(MAKE) -C libavcodec  uninstall-libs
198 198
 	$(MAKE) -C libavformat uninstall-libs
... ...
@@ -201,7 +195,7 @@ uninstall-libs:
201 201
 	$(MAKE) -C libswscale  uninstall-libs
202 202
 	$(MAKE) -C libavfilter uninstall-libs
203 203
 
204
-uninstall-headers:
204
+uninstall-headers::
205 205
 	$(MAKE) -C libavutil   uninstall-headers
206 206
 	$(MAKE) -C libavcodec  uninstall-headers
207 207
 	$(MAKE) -C libavformat uninstall-headers
... ...
@@ -211,7 +205,7 @@ uninstall-headers:
211 211
 	$(MAKE) -C libavfilter uninstall-headers
212 212
 	-rmdir "$(INCDIR)"
213 213
 
214
-depend dep: .depend .vhookdep
214
+depend dep: .vhookdep
215 215
 	$(MAKE)                    -C libavutil   depend
216 216
 	$(MAKE)                    -C libavcodec  depend
217 217
 	$(MAKE)                    -C libavformat depend
... ...
@@ -220,9 +214,6 @@ depend dep: .depend .vhookdep
220 220
 	$(MAKE-$(CONFIG_SWSCALE))  -C libswscale  depend
221 221
 	$(MAKE-$(CONFIG_AVFILTER)) -C libavfilter depend
222 222
 
223
-.depend: $(PROGS_SRCS) version.h
224
-	$(DEPEND_CMD) > $@
225
-
226 223
 .vhookdep: $(ALLHOOKS_SRCS) version.h
227 224
 	$(VHOOK_DEPEND_CMD) > $@
228 225
 
... ...
@@ -231,7 +222,7 @@ $(DEP_LIBS): lib
231 231
 .libs: $(DEP_LIBS)
232 232
 	touch $@
233 233
 
234
-clean:
234
+clean::
235 235
 	$(MAKE) -C libavutil   clean
236 236
 	$(MAKE) -C libavcodec  clean
237 237
 	$(MAKE) -C libavformat clean
... ...
@@ -239,7 +230,7 @@ clean:
239 239
 	$(MAKE) -C libpostproc clean
240 240
 	$(MAKE) -C libswscale  clean
241 241
 	$(MAKE) -C libavfilter clean
242
-	rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
242
+	rm -f .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
243 243
 	   output_example$(EXESUF)
244 244
 	rm -f doc/*.html doc/*.pod doc/*.1
245 245
 	rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
... ...
@@ -247,7 +238,7 @@ clean:
247 247
 	rm -f $(addprefix tools/,$(addsuffix $(EXESUF),cws2fws pktdumper qt-faststart trasher))
248 248
 	rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
249 249
 
250
-distclean: clean
250
+distclean::
251 251
 	$(MAKE) -C libavutil   distclean
252 252
 	$(MAKE) -C libavcodec  distclean
253 253
 	$(MAKE) -C libavformat distclean
... ...
@@ -255,7 +246,7 @@ distclean: clean
255 255
 	$(MAKE) -C libpostproc distclean
256 256
 	$(MAKE) -C libswscale  distclean
257 257
 	$(MAKE) -C libavfilter distclean
258
-	rm -f .depend .vhookdep version.h config.* *.pc
258
+	rm -f .vhookdep version.h config.* *.pc
259 259
 
260 260
 TAGS:
261 261
 	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
... ...
@@ -430,10 +421,8 @@ tests/seek_test$(EXESUF): tests/seek_test.c .libs
430 430
 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(EXTRALIBS)
431 431
 
432 432
 
433
-.PHONY: all lib videohook documentation install* uninstall*
434
-.PHONY: dep depend clean distclean TAGS
433
+.PHONY: lib videohook documentation TAGS
435 434
 .PHONY: codectest libavtest seektest test-server fulltest test
436 435
 .PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
437 436
 
438
--include .depend
439 437
 -include .vhookdep
... ...
@@ -59,14 +59,16 @@ $(SLIBNAME_WITH_MAJOR): $(OBJS)
59 59
 ALLHEADERS = $(subst $(SRC_DIR)/,,$(wildcard $(SRC_DIR)/*.h))
60 60
 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
61 61
 
62
-depend dep: $(SRCS)
62
+depend dep: .depend
63
+
64
+.depend: $(SRCS)
63 65
 	$(DEPEND_CMD) > .depend
64 66
 
65 67
 clean::
66 68
 	rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
67 69
 	      *.def *.dll.a *.exp *.ho *.map $(TESTS)
68 70
 
69
-distclean: clean
71
+distclean:: clean
70 72
 	rm -f .depend
71 73
 
72 74
 INSTALL_TARGETS-$(BUILD_SHARED) += install-lib-shared
... ...
@@ -93,7 +95,7 @@ install-lib-static: $(LIBNAME)
93 93
 
94 94
 INCINSTDIR = $(INCDIR)/lib$(NAME)
95 95
 
96
-install-headers:
96
+install-headers::
97 97
 	install -d "$(INCINSTDIR)"
98 98
 	install -d "$(LIBDIR)/pkgconfig"
99 99
 	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
... ...
@@ -101,7 +103,7 @@ install-headers:
101 101
 
102 102
 uninstall: uninstall-libs uninstall-headers
103 103
 
104
-uninstall-libs:
104
+uninstall-libs::
105 105
 	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
106 106
 	       "$(SHLIBDIR)/$(SLIBNAME)"            \
107 107
 	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"