1 # Rules.mak for uClibc test subdirs
3 # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
9 # Note: This does not read the top level Rules.mak file
14 TESTDIR=$(top_builddir)test/
16 include $(top_builddir)/Rules.mak
17 ifndef TEST_INSTALLED_UCLIBC
19 ifeq (,$(findstring /,$(UCLIBC_LDSO)))
20 UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO)
23 UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*))
26 #--------------------------------------------------------
27 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
31 ifeq ($(strip $(TARGET_ARCH)),)
32 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
34 -e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \
35 -e 's/sa110/arm/' -e 's/arm.*/arm/g' \
37 -e 's/parisc.*/hppa/' \
38 -e 's/ppc/powerpc/g' \
39 -e 's/v850.*/v850/g' \
43 -e 's/xtensa.*/xtensa/' \
50 ifneq ($(KERNEL_HEADERS),)
51 ifeq ($(patsubst /%,/,$(KERNEL_HEADERS)),/)
52 # Absolute path in KERNEL_HEADERS
53 KERNEL_INCLUDES += -I$(KERNEL_HEADERS)
55 # Relative path in KERNEL_HEADERS
56 KERNEL_INCLUDES += -I$(top_builddir)$(KERNEL_HEADERS)
60 XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE
61 XWARNINGS += $(call check_gcc,-Wstrict-prototypes,)
62 CFLAGS := -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include
63 CFLAGS += $(XCOMMON_CFLAGS) $(KERNEL_INCLUDES) $(CC_INC)
64 CFLAGS += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS)
66 # Can't add $(OPTIMIZATION) here, it may be target-specific.
67 # Just adding -Os for now.
68 HOST_CFLAGS += $(XCOMMON_CFLAGS) -Os $(XWARNINGS)
70 LDFLAGS := $(CPU_LDFLAGS-y) -Wl,-z,defs -Wl,-z,now
75 HOST_LDFLAGS += -Wl,-g
78 HOST_LDFLAGS += -Wl,-s
81 ifneq ($(HAVE_SHARED),y)
82 LDFLAGS += -Wl,-static
83 HOST_LDFLAGS += -Wl,-static
86 LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
87 UCLIBC_LDSO_ABSPATH=$(shell pwd)
88 ifdef TEST_INSTALLED_UCLIBC
89 LDFLAGS += -Wl,-rpath,./
90 UCLIBC_LDSO_ABSPATH=$(SHARED_LIB_LOADER_PREFIX)
93 ifeq ($(findstring -static,$(LDFLAGS)),)
94 LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)
97 ifeq ($(LDSO_GNU_HASH_SUPPORT),y)
98 # Check for binutils support is done on root Rules.mak
99 LDFLAGS += -Wl,${LDFLAGS_GNUHASH}
103 ifneq ($(findstring -s,$(MAKEFLAGS)),)
108 ifneq ($(V)$(VERBOSE),)
119 MAKEFLAGS += --no-print-directory
122 banner := ---------------------------------
123 pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
124 pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
125 pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
126 pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $(@:.exe=)
132 ver_showdiff = true echo
133 ver_showlink = true echo
134 ver_showtest = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n"
135 do_showclean = $($(DISP)_showclean)
136 do_showdiff = $($(DISP)_showdiff)
137 do_showlink = $($(DISP)_showlink)
138 do_showtest = $($(DISP)_showtest)
139 showclean = @$(do_showclean)
140 showdiff = @$(do_showdiff)
141 showlink = @$(do_showlink)
142 showtest = @$(do_showtest)