Mercurial > mplayer.hg
annotate common.mak @ 26489:925b2b7a1f34
dependency generation infrastructure for C++ files
author | diego |
---|---|
date | Thu, 24 Apr 2008 21:46:50 +0000 |
parents | c7c1cc069961 |
children | 24e6708e030c |
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 | 6 |
26317 | 7 ifndef SUBDIR |
26246 | 8 vpath %.c $(SRC_DIR) |
9 vpath %.h $(SRC_DIR) | |
10 vpath %.S $(SRC_DIR) | |
26155 | 11 |
12 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
|
13 |
26315
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
14 CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
15 -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \ |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
16 $(addprefix -I$(SRC_PATH)/lib,$(ALLFFLIBS)) $(OPTFLAGS) |
17627
24238abbd150
Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff
changeset
|
17 |
24238abbd150
Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff
changeset
|
18 %.o: %.c |
24238abbd150
Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff
changeset
|
19 $(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
|
20 |
24238abbd150
Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff
changeset
|
21 %.o: %.S |
24238abbd150
Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff
changeset
|
22 $(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
|
23 |
24775 | 24 %.ho: %.h |
25 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $< | |
26 | |
26403 | 27 %.d: %.c |
28 $(DEPEND_CMD) > $@ | |
29 | |
30 %.d: %.S | |
31 $(DEPEND_CMD) > $@ | |
32 | |
33 %.d: %.cpp | |
34 $(DEPEND_CMD) > $@ | |
35 | |
17627
24238abbd150
Import common.mak v1.1 from ffmpeg cvs, now it's needed by the building
rtognimp
parents:
diff
changeset
|
36 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
|
37 |
19016 | 38 uninstall: uninstall-libs uninstall-headers |
39 | |
26315
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
40 .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
|
41 endif |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
42 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
43 CFLAGS += $(CFLAGS-yes) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
44 OBJS += $(OBJS-yes) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
45 ASM_OBJS += $(ASM_OBJS-yes) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
46 CPP_OBJS += $(CPP_OBJS-yes) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
47 FFLIBS := $(FFLIBS-yes) $(FFLIBS) |
26317 | 48 TESTS += $(TESTS-yes) |
26315
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
49 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
50 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
51 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
52 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
53 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
54 OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
55 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
56 SRCS := $(addprefix $(SUBDIR),$(SRCS)) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
57 OBJS := $(addprefix $(SUBDIR),$(OBJS)) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
58 TESTS := $(addprefix $(SUBDIR),$(TESTS)) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
59 |
26403 | 60 DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME)) |
61 | |
26315
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
62 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
|
63 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho)) |
19016 | 64 |
26403 | 65 DEPS := $(OBJS:.o=.d) |
66 depend dep: $(DEPS) | |
26315
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
67 |
26403 | 68 CLEANSUFFIXES = *.o *~ *.ho |
69 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map | |
70 DISTCLEANSUFFIXES = *.d | |
26315
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
71 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
72 define RULES |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
73 $(SUBDIR)%: $(SUBDIR)%.o $(LIBNAME) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
74 $(CC) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
75 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
76 $(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
77 $(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS) |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
78 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
79 clean:: |
26403 | 80 rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \ |
81 $(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
|
82 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
83 distclean:: clean |
26403 | 84 rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \ |
85 $(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
|
86 endef |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
87 |
a80f0a7d73f4
Sync with FFmpeg's shiny new non-recursive build system.
diego
parents:
26246
diff
changeset
|
88 $(eval $(RULES)) |
19016 | 89 |
26403 | 90 # Clear DIRS variable so that it is not used in other subdirectories. |
91 DIRS = | |
92 | |
26155 | 93 tests: $(TESTS) |
94 | |
26403 | 95 -include $(DEPS) |