2006-02-13 14:53:25 +02:00
|
|
|
#
|
|
|
|
# common bits used by all libraries
|
|
|
|
#
|
|
|
|
|
2010-03-09 16:58:18 +02:00
|
|
|
# first so "all" becomes default target
|
|
|
|
all: all-yes
|
2008-03-07 21:27:17 +02:00
|
|
|
|
2011-06-24 10:02:57 +03:00
|
|
|
ifndef SUBDIR
|
|
|
|
|
2011-06-24 10:10:25 +03:00
|
|
|
ifndef MAIN_MAKEFILE
|
|
|
|
ifeq ($(SRC_PATH),.)
|
|
|
|
SRC_PATH = ..
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-06-24 10:02:57 +03:00
|
|
|
ifndef V
|
|
|
|
Q = @
|
|
|
|
ECHO = printf "$(1)\t%s\n" $(2)
|
2011-06-24 20:51:16 +03:00
|
|
|
BRIEF = CC AS YASM AR LD HOSTCC STRIP CP
|
2011-06-24 10:02:57 +03:00
|
|
|
SILENT = DEPCC YASMDEP RM RANLIB
|
|
|
|
MSG = $@
|
|
|
|
M = @$(call ECHO,$(TAG),$@);
|
|
|
|
$(foreach VAR,$(BRIEF), \
|
|
|
|
$(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
|
|
|
$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
|
|
|
|
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
|
|
|
|
endif
|
|
|
|
|
|
|
|
IFLAGS := -I. -I$(SRC_PATH)
|
|
|
|
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
|
|
|
CFLAGS += $(ECFLAGS)
|
|
|
|
YASMFLAGS += $(IFLAGS) -Pconfig.asm
|
|
|
|
|
|
|
|
HOSTCFLAGS += $(IFLAGS)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CCDEP)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(ASDEP)
|
|
|
|
$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.ho: %.h
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
|
|
|
|
|
|
|
|
%.ver: %.v
|
|
|
|
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
|
|
|
|
|
|
|
%.c %.h: TAG = GEN
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2009-04-13 01:48:44 +03:00
|
|
|
OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
|
|
|
|
|
2009-03-25 20:14:28 +02:00
|
|
|
OBJS += $(OBJS-yes)
|
|
|
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
|
|
|
TESTPROGS += $(TESTPROGS-yes)
|
2006-02-13 14:53:25 +02:00
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
|
2011-05-28 15:10:01 +03:00
|
|
|
FFLDFLAGS := $(addprefix -Llib,$(ALLFFLIBS)) $(LDFLAGS)
|
2006-02-13 14:53:25 +02:00
|
|
|
|
2009-03-29 17:35:20 +03:00
|
|
|
EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
|
2010-03-09 16:58:08 +02:00
|
|
|
OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS)))
|
2011-03-30 23:23:04 +03:00
|
|
|
TESTOBJS := $(addprefix $(SUBDIR),$(TESTOBJS) $(TESTPROGS:%=%-test.o))
|
2009-03-25 20:19:20 +02:00
|
|
|
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
|
2009-10-29 02:55:35 +02:00
|
|
|
HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
|
|
|
|
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
|
2006-02-13 14:53:25 +02:00
|
|
|
|
2011-05-28 15:10:01 +03:00
|
|
|
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
2008-04-10 00:11:39 +03:00
|
|
|
|
2009-01-12 00:48:07 +02:00
|
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
2010-03-08 22:17:47 +02:00
|
|
|
SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
|
2010-03-08 20:43:38 +02:00
|
|
|
SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
|
2009-08-23 14:02:37 +03:00
|
|
|
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
|
2006-02-13 14:53:25 +02:00
|
|
|
|
2009-10-29 02:55:35 +02:00
|
|
|
$(HOSTOBJS): %.o: %.c
|
|
|
|
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
|
|
|
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
|
|
|
|
|
2010-01-16 06:49:02 +02:00
|
|
|
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
|
2009-11-22 16:22:13 +02:00
|
|
|
DISTCLEANSUFFIXES = *.pc
|
2009-05-29 14:56:54 +03:00
|
|
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
|
2008-02-25 11:22:11 +02:00
|
|
|
|
2011-03-30 23:23:04 +03:00
|
|
|
-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))
|