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.
12 TESTDIR=$(top_builddir)test/
14 include $(top_builddir)/Rules.mak
15 ifndef TEST_INSTALLED_UCLIBC
17 ifeq (,$(findstring /,$(UCLIBC_LDSO)))
18 UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO)
21 UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*))
24 #--------------------------------------------------------
25 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
29 ifeq ($(strip $(TARGET_ARCH)),)
30 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
32 -e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \
33 -e 's/sa110/arm/' -e 's/arm.*/arm/g' \
35 -e 's/parisc.*/hppa/' \
36 -e 's/ppc/powerpc/g' \
37 -e 's/v850.*/v850/g' \
41 -e 's/xtensa.*/xtensa/' \
49 ifneq ($(KERNEL_HEADERS),)
50 ifeq ($(patsubst /%,/,$(KERNEL_HEADERS)),/)
51 # Absolute path in KERNEL_HEADERS
52 KERNEL_INCLUDES += -I$(KERNEL_HEADERS)
54 # Relative path in KERNEL_HEADERS
55 KERNEL_INCLUDES += -I$(top_builddir)$(KERNEL_HEADERS)
59 XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE
60 CFLAG_-Wstrict-prototypes ?= $(call check_gcc,-Wstrict-prototypes,)
61 XWARNINGS += $(CFLAG_-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) -std=gnu99
70 LDFLAGS := $(CPU_LDFLAGS-y) -Wl,-z,now
75 HOST_LDFLAGS += -Wl,-g
78 HOST_LDFLAGS += -Wl,-s
81 ifneq ($(HAVE_SHARED),y)
82 LDFLAGS += -Wl,-static -static-libgcc
85 LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
86 UCLIBC_LDSO_ABSPATH=$(shell pwd)
87 ifdef TEST_INSTALLED_UCLIBC
88 LDFLAGS += -Wl,-rpath,./
89 UCLIBC_LDSO_ABSPATH=$(RUNTIME_PREFIX)$(MULTILIB_DIR)
92 ifeq ($(findstring -static,$(LDFLAGS)),)
93 LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)
96 ifeq ($(LDSO_GNU_HASH_SUPPORT),y)
97 # Check for binutils support is done on root Rules.mak
98 LDFLAGS += -Wl,${LDFLAGS_GNUHASH}
102 ifneq ($(findstring -s,$(MAKEFLAGS)),)
107 ifneq ($(V)$(VERBOSE),)
118 MAKEFLAGS += --no-print-directory
121 banner := ---------------------------------
122 pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
123 pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
124 pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
125 pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $(@:.exe=)
131 ver_showdiff = true echo
132 ver_showlink = true echo
133 ver_showtest = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n"
134 do_showclean = $($(DISP)_showclean)
135 do_showdiff = $($(DISP)_showdiff)
136 do_showlink = $($(DISP)_showlink)
137 do_showtest = $($(DISP)_showtest)
138 showclean = @$(do_showclean)
139 showdiff = @$(do_showdiff)
140 showlink = @$(do_showlink)
141 showtest = @$(do_showtest)