Pass ASFLAGS to assembler instead of CFLAGS
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
71c61f62 5all: # make "all" default target
0e32c8c6 6
8e255b8b 7ifndef SUBDIR
6ccf540f
DB
8vpath %.c $(SRC_DIR)
9vpath %.h $(SRC_DIR)
10vpath %.S $(SRC_DIR)
304d586d 11vpath %.asm $(SRC_DIR)
8b2121e3 12
9e6165b5
MR
13ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
14BUILD_ROOT_REL = .
15else
16BUILD_ROOT_REL = ..
17endif
18
5671fc14
MR
19ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
20
50a334e4 21CPPFLAGS += -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
8b2121e3
MR
22
23%.o: %.c
7e6c86e6 24 $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c $(CC_O) $<
8b2121e3
MR
25
26%.o: %.S
2f2e6c7c 27 $(AS) $(CPPFLAGS) $(ASFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
8b2121e3 28
e4d86a57 29%.ho: %.h
50a334e4 30 $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
e4d86a57 31
caec74dd
MR
32%.d: %.c
33 $(DEPEND_CMD) > $@
34
35%.d: %.S
36 $(DEPEND_CMD) > $@
37
38%.d: %.cpp
39 $(DEPEND_CMD) > $@
40
18c64005
MR
41%.o: %.d
42
bf237413
MR
43%$(EXESUF): %.c
44
9e6165b5
MR
45SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
46ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
47$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
48endif
49
873b0923 50$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
1db2c5c9 51 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
9e6165b5 52
71c61f62 53install: install-libs install-headers
7716f7ff 54
71c61f62 55uninstall: uninstall-libs uninstall-headers
8b2121e3 56
661ce289 57.PHONY: all depend dep *clean install* uninstall* examples testprogs
71c61f62 58endif
8b2121e3 59
c5662879
DB
60OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
61
6ccf540f
DB
62CFLAGS += $(CFLAGS-yes)
63OBJS += $(OBJS-yes)
64FFLIBS := $(FFLIBS-yes) $(FFLIBS)
65TESTPROGS += $(TESTPROGS-yes)
8b2121e3 66
71c61f62 67FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
bdc2cc16 68FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
8b2121e3 69
43a0cb7c 70EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
6ccf540f 71OBJS := $(addprefix $(SUBDIR),$(OBJS))
7304c2c4 72TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
8b2121e3 73
b4c80b64 74DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
76ca42a8 75
7b5e8a27 76ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
71c61f62 77checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
8b2121e3 78
caec74dd
MR
79DEPS := $(OBJS:.o=.d)
80depend dep: $(DEPS)
8b2121e3 81
8e8a67fa 82CLEANSUFFIXES = *.o *~ *.ho *.map
25cd5cb3 83DISTCLEANSUFFIXES = *.d *.pc
8e8a67fa 84LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76a448ed 85
488b1ca4 86-include $(DEPS)