annotate common.mak @ 28190:321b70afabe1

Code simplification
author reimar
date Thu, 01 Jan 2009 11:41:09 +0000
parents 10d81013bb5f
children bffc31262b0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17627
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
1 #
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
2 # common bits used by all libraries
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
3 #
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
4
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
5 all: # make "all" default target
26155
ba3e34112e47 sync with FFmpeg r12354
diego
parents: 24858
diff changeset
6
26317
955f4b8ac094 Merge simplifications from FFmpeg r12764.
diego
parents: 26315
diff changeset
7 ifndef SUBDIR
26246
84e71e0a0546 sync with FFmpeg r12599
diego
parents: 26185
diff changeset
8 vpath %.c $(SRC_DIR)
84e71e0a0546 sync with FFmpeg r12599
diego
parents: 26185
diff changeset
9 vpath %.h $(SRC_DIR)
84e71e0a0546 sync with FFmpeg r12599
diego
parents: 26185
diff changeset
10 vpath %.S $(SRC_DIR)
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
11 vpath %.asm $(SRC_DIR)
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
12
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
13 ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
14 BUILD_ROOT_REL = .
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
15 else
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
16 BUILD_ROOT_REL = ..
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
17 endif
26155
ba3e34112e47 sync with FFmpeg r12354
diego
parents: 24858
diff changeset
18
ba3e34112e47 sync with FFmpeg r12354
diego
parents: 24858
diff changeset
19 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
17627
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
20
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
21 CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
22 -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
17627
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
23
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
24 %.o: %.c
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
25 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
26
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
27 %.o: %.S
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
28 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
29
24775
16f77f3eb187 Sync with FFmpeg r10774.
diego
parents: 23524
diff changeset
30 %.ho: %.h
16f77f3eb187 Sync with FFmpeg r10774.
diego
parents: 23524
diff changeset
31 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
16f77f3eb187 Sync with FFmpeg r10774.
diego
parents: 23524
diff changeset
32
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
33 %.d: %.c
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
34 $(DEPEND_CMD) > $@
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
35
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
36 %.d: %.S
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
37 $(DEPEND_CMD) > $@
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
38
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
39 %.d: %.cpp
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
40 $(DEPEND_CMD) > $@
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
41
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
42 %.o: %.d
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
43
26671
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
44 %$(EXESUF): %.c
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
45
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
46 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
47 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
48 $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
49 endif
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
50
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
51 $(BUILD_ROOT_REL)/version.h:
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
52 $(SRC_PATH)/version.sh $(SRC_PATH) $@ $(EXTRA_VERSION)
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
53
17627
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
54 install: install-libs install-headers
24238abbd150 Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff changeset
55
19016
837e543350b3 sync with FFmpeg r5718
diego
parents: 18311
diff changeset
56 uninstall: uninstall-libs uninstall-headers
837e543350b3 sync with FFmpeg r5718
diego
parents: 18311
diff changeset
57
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
58 .PHONY: all depend dep clean distclean install* uninstall* tests
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
59 endif
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
60
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
61 CFLAGS += $(CFLAGS-yes)
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
62 OBJS += $(OBJS-yes)
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
63 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
26317
955f4b8ac094 Merge simplifications from FFmpeg r12764.
diego
parents: 26315
diff changeset
64 TESTS += $(TESTS-yes)
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
65
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
66 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
67 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
68
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
69 OBJS := $(addprefix $(SUBDIR),$(OBJS))
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
70 TESTS := $(addprefix $(SUBDIR),$(TESTS))
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
71
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
72 DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
73
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
74 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
75 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
19016
837e543350b3 sync with FFmpeg r5718
diego
parents: 18311
diff changeset
76
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
77 DEPS := $(OBJS:.o=.d)
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
78 depend dep: $(DEPS)
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
79
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
80 CLEANSUFFIXES = *.o *~ *.ho
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
81 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
82 DISTCLEANSUFFIXES = *.d *.pc
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
83
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
84 define RULES
26671
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
85 $(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
86 $(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
87
26671
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
88 $(SUBDIR)%-test.o: $(SUBDIR)%.c
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
89 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
90
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
91 $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
24e6708e030c Sync with latest FFmpeg changes.
diego
parents: 26403
diff changeset
92 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
93
28143
10d81013bb5f Sync with latest FFmpeg changes.
diego
parents: 27868
diff changeset
94 $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
95 $(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
96
28143
10d81013bb5f Sync with latest FFmpeg changes.
diego
parents: 27868
diff changeset
97 $(SUBDIR)x86/%.d: $(SUBDIR)x86/%.asm
27868
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
98 $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
c4913507c4ba Sync with latest FFmpeg changes.
diego
parents: 26671
diff changeset
99
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
100 clean::
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
101 rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
102 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
103
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
104 distclean:: clean
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
105 rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
106 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
26315
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
107 endef
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
108
a80f0a7d73f4 Sync with FFmpeg's shiny new non-recursive build system.
diego
parents: 26246
diff changeset
109 $(eval $(RULES))
19016
837e543350b3 sync with FFmpeg r5718
diego
parents: 18311
diff changeset
110
26155
ba3e34112e47 sync with FFmpeg r12354
diego
parents: 24858
diff changeset
111 tests: $(TESTS)
ba3e34112e47 sync with FFmpeg r12354
diego
parents: 24858
diff changeset
112
26403
c7c1cc069961 Sync with latest FFmpeg changes.
diego
parents: 26317
diff changeset
113 -include $(DEPS)