xref: /OK3568_Linux_fs/buildroot/package/dmalloc/dmalloc.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# dmalloc
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunDMALLOC_VERSION = 5.5.2
8*4882a593SmuzhiyunDMALLOC_SOURCE = dmalloc-$(DMALLOC_VERSION).tgz
9*4882a593SmuzhiyunDMALLOC_SITE = http://dmalloc.com/releases
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunDMALLOC_LICENSE = MIT-like
12*4882a593Smuzhiyun# license is in each file, dmalloc.h.1 is the smallest one
13*4882a593SmuzhiyunDMALLOC_LICENSE_FILES = dmalloc.h.1
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunDMALLOC_INSTALL_STAGING = YES
16*4882a593SmuzhiyunDMALLOC_CFLAGS = $(TARGET_CFLAGS)
17*4882a593Smuzhiyun
18*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),y)
19*4882a593SmuzhiyunDMALLOC_CONF_OPTS += --disable-shlib
20*4882a593Smuzhiyunelse
21*4882a593SmuzhiyunDMALLOC_CONF_OPTS += --enable-shlib
22*4882a593SmuzhiyunDMALLOC_CFLAGS += -fPIC
23*4882a593Smuzhiyunendif
24*4882a593Smuzhiyun
25*4882a593Smuzhiyunifeq ($(BR2_INSTALL_LIBSTDCPP),y)
26*4882a593SmuzhiyunDMALLOC_CONF_OPTS += --enable-cxx
27*4882a593Smuzhiyunelse
28*4882a593SmuzhiyunDMALLOC_CONF_OPTS += --disable-cxx
29*4882a593Smuzhiyunendif
30*4882a593Smuzhiyun
31*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
32*4882a593SmuzhiyunDMALLOC_CONF_OPTS += --enable-threads
33*4882a593Smuzhiyunelse
34*4882a593SmuzhiyunDMALLOC_CONF_OPTS += --disable-threads
35*4882a593Smuzhiyunendif
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun# dmalloc has some assembly function that are not present in thumb1 mode:
38*4882a593Smuzhiyun# Error: lo register required -- `str lr,[sp,#4]'
39*4882a593Smuzhiyun# so, we desactivate thumb mode
40*4882a593Smuzhiyunifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
41*4882a593SmuzhiyunDMALLOC_CFLAGS += -marm
42*4882a593Smuzhiyunendif
43*4882a593Smuzhiyun
44*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_63261),y)
45*4882a593SmuzhiyunDMALLOC_CFLAGS += -O0
46*4882a593Smuzhiyunendif
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunDMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
49*4882a593Smuzhiyun
50*4882a593Smuzhiyundefine DMALLOC_POST_PATCH
51*4882a593Smuzhiyun	$(SED) 's/^ac_cv_page_size=0$$/ac_cv_page_size=12/' $(@D)/configure
52*4882a593Smuzhiyun	$(SED) 's/(ld -/($${LD-ld} -/' $(@D)/configure
53*4882a593Smuzhiyun	$(SED) 's/'\''ld -/"$${LD-ld}"'\'' -/' $(@D)/configure
54*4882a593Smuzhiyun	$(SED) 's/ar cr/$$(AR) cr/' $(@D)/Makefile.in
55*4882a593Smuzhiyunendef
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunDMALLOC_POST_PATCH_HOOKS += DMALLOC_POST_PATCH
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun# both DESTDIR and PREFIX are ignored..
60*4882a593Smuzhiyundefine DMALLOC_INSTALL_STAGING_CMDS
61*4882a593Smuzhiyun	$(TARGET_MAKE_ENV) $(MAKE) includedir="$(STAGING_DIR)/usr/include" \
62*4882a593Smuzhiyun		bindir="$(STAGING_DIR)/usr/bin" \
63*4882a593Smuzhiyun		libdir="$(STAGING_DIR)/usr/lib" \
64*4882a593Smuzhiyun		shlibdir="$(STAGING_DIR)/usr/lib" \
65*4882a593Smuzhiyun		infodir="$(STAGING_DIR)/usr/share/info/" \
66*4882a593Smuzhiyun		-C $(@D) install
67*4882a593Smuzhiyunendef
68*4882a593Smuzhiyun
69*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),)
70*4882a593Smuzhiyundefine DMALLOC_INSTALL_SHARED_LIB
71*4882a593Smuzhiyun	cp -dpf $(STAGING_DIR)/usr/lib/libdmalloc*.so $(TARGET_DIR)/usr/lib
72*4882a593Smuzhiyunendef
73*4882a593Smuzhiyunendif
74*4882a593Smuzhiyun
75*4882a593Smuzhiyundefine DMALLOC_INSTALL_TARGET_CMDS
76*4882a593Smuzhiyun	$(DMALLOC_INSTALL_SHARED_LIB)
77*4882a593Smuzhiyun	cp -dpf $(STAGING_DIR)/usr/bin/dmalloc $(TARGET_DIR)/usr/bin/dmalloc
78*4882a593Smuzhiyunendef
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun$(eval $(autotools-package))
81