Reindent the whole file
[FFMpeg-mirror/DVCPRO-HD.git] / common.mak
blobc0ed6b957eb1720ea280f08a0e79b40b5378120d
2 # common bits used by all libraries
5 all: # make "all" default target
7 ifndef SUBDIR
8 vpath %.c $(SRC_DIR)
9 vpath %.h $(SRC_DIR)
10 vpath %.S $(SRC_DIR)
12 ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
13 BUILD_ROOT_REL = .
14 else
15 BUILD_ROOT_REL = ..
16 endif
18 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
20 CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
21 -D_ISOC9X_SOURCE -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
23 %.o: %.c
24 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
26 %.o: %.S
27 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
29 %.ho: %.h
30 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
32 %.d: %.c
33 $(DEPEND_CMD) > $@
35 %.d: %.S
36 $(DEPEND_CMD) > $@
38 %.d: %.cpp
39 $(DEPEND_CMD) > $@
41 %$(EXESUF): %.c
43 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
44 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
45 $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
46 endif
48 $(BUILD_ROOT_REL)/version.h:
49 $(SRC_PATH)/version.sh $(SRC_PATH) $@
51 install: install-libs install-headers
53 uninstall: uninstall-libs uninstall-headers
55 .PHONY: all depend dep clean distclean install* uninstall* tests
56 endif
58 CFLAGS += $(CFLAGS-yes)
59 OBJS += $(OBJS-yes)
60 ASM_OBJS += $(ASM_OBJS-yes)
61 CPP_OBJS += $(CPP_OBJS-yes)
62 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
63 TESTS += $(TESTS-yes)
65 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
66 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
68 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
69 OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
71 SRCS := $(addprefix $(SUBDIR),$(SRCS))
72 OBJS := $(addprefix $(SUBDIR),$(OBJS))
73 TESTS := $(addprefix $(SUBDIR),$(TESTS))
75 DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
77 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
78 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
80 DEPS := $(OBJS:.o=.d)
81 depend dep: $(DEPS)
83 CLEANSUFFIXES = *.o *~ *.ho
84 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
85 DISTCLEANSUFFIXES = *.d *.pc
87 define RULES
88 $(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
89 $(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
91 $(SUBDIR)%-test.o: $(SUBDIR)%.c
92 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
94 $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
95 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
97 clean::
98 rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
99 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
101 distclean:: clean
102 rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
103 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
104 endef
106 $(eval $(RULES))
108 tests: $(TESTS)
110 -include $(DEPS)