Add PIC flags early so tests they affect give correct results
[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
04a803be 21CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
8b2121e3
MR
22
23%.o: %.c
07dec06e 24 $(CCDEP)
bce7b696 25 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
8b2121e3
MR
26
27%.o: %.S
07dec06e 28 $(ASDEP)
bce7b696 29 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
8b2121e3 30
e4d86a57 31%.ho: %.h
bce7b696 32 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
e4d86a57 33
bf237413
MR
34%$(EXESUF): %.c
35
9e6165b5
MR
36SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
37ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
38$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
39endif
40
873b0923 41$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
1db2c5c9 42 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
9e6165b5 43
71c61f62 44install: install-libs install-headers
7716f7ff 45
71c61f62 46uninstall: uninstall-libs uninstall-headers
8b2121e3 47
661ce289 48.PHONY: all depend dep *clean install* uninstall* examples testprogs
71c61f62 49endif
8b2121e3 50
c5662879
DB
51OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
52
6ccf540f
DB
53CFLAGS += $(CFLAGS-yes)
54OBJS += $(OBJS-yes)
55FFLIBS := $(FFLIBS-yes) $(FFLIBS)
56TESTPROGS += $(TESTPROGS-yes)
8b2121e3 57
71c61f62 58FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
bdc2cc16 59FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
8b2121e3 60
43a0cb7c 61EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
6ccf540f 62OBJS := $(addprefix $(SUBDIR),$(OBJS))
7304c2c4 63TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
8b2121e3 64
bea81a52 65DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
76ca42a8 66
7b5e8a27 67ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
95f2c769
MR
68SKIPHEADERS = $(addprefix $(SUBDIR),$(SKIPHEADERS-))
69checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
8b2121e3 70
caec74dd
MR
71DEPS := $(OBJS:.o=.d)
72depend dep: $(DEPS)
8b2121e3 73
8e8a67fa 74CLEANSUFFIXES = *.o *~ *.ho *.map
25cd5cb3 75DISTCLEANSUFFIXES = *.d *.pc
8e8a67fa 76LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76a448ed 77
c1c3933a 78-include $(wildcard $(DEPS))