Convert two tables to signed decimal
[ffmpeg-lucabe.git] / common.mak
blob03dea4d8bc3413569f24a556ca3d1c70320a6041
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)
11 vpath %.asm $(SRC_DIR)
13 ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
14 BUILD_ROOT_REL = .
15 else
16 BUILD_ROOT_REL = ..
17 endif
19 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
21 CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
22 -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
24 %.o: %.c
25 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
27 %.o: %.S
28 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
30 %.ho: %.h
31 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
33 %.d: %.c
34 $(DEPEND_CMD) > $@
36 %.d: %.S
37 $(DEPEND_CMD) > $@
39 %.d: %.cpp
40 $(DEPEND_CMD) > $@
42 %.o: %.d
44 %$(EXESUF): %.c
46 SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
47 ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
48 $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
49 endif
51 $(BUILD_ROOT_REL)/version.h:
52 $(SRC_PATH)/version.sh $(SRC_PATH) $@
54 install: install-libs install-headers
56 uninstall: uninstall-libs uninstall-headers
58 .PHONY: all depend dep clean distclean install* uninstall* tests
59 endif
61 CFLAGS += $(CFLAGS-yes)
62 OBJS += $(OBJS-yes)
63 ASM_OBJS += $(ASM_OBJS-yes)
64 CPP_OBJS += $(CPP_OBJS-yes)
65 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
66 TESTS += $(TESTS-yes)
68 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
69 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
71 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
72 OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
74 SRCS := $(addprefix $(SUBDIR),$(SRCS))
75 OBJS := $(addprefix $(SUBDIR),$(OBJS))
76 TESTS := $(addprefix $(SUBDIR),$(TESTS))
78 DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
80 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
81 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
83 DEPS := $(OBJS:.o=.d)
84 depend dep: $(DEPS)
86 CLEANSUFFIXES = *.o *~ *.ho
87 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
88 DISTCLEANSUFFIXES = *.d *.pc
90 define RULES
91 $(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
92 $(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
94 $(SUBDIR)%-test.o: $(SUBDIR)%.c
95 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
97 $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
98 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
100 $(SUBDIR)i386/%.o: $(SUBDIR)i386/%.asm
101 $(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
103 $(SUBDIR)i386/%.d: $(SUBDIR)i386/%.asm
104 $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
106 clean::
107 rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
108 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
110 distclean:: clean
111 rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
112 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
113 endef
115 $(eval $(RULES))
117 tests: $(TESTS)
119 -include $(DEPS)