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