OSDN Git Service

This patch fixes locale-mbwc test failures when __UCLIBC_HAS_LOCALE__ is
[uclinux-h8/uClibc.git] / test / Rules.mak
1 # Rules.mak for uClibc test subdirs
2 #
3 # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 #
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 #
7
8 #
9 # Note: This does not read the top level Rules.mak file
10 #
11
12 top_builddir ?= ../
13
14 TESTDIR=$(top_builddir)test/
15
16 include $(top_builddir)/Rules.mak
17 ifndef TEST_INSTALLED_UCLIBC
18 ifdef UCLIBC_LDSO
19 ifeq (,$(findstring /,$(UCLIBC_LDSO)))
20 UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO)
21 endif
22 else
23 UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*))
24 endif
25 endif
26 #--------------------------------------------------------
27 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
28 LC_ALL:= C
29 export LC_ALL
30
31 ifeq ($(strip $(TARGET_ARCH)),)
32 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
33         -e 's/i.86/i386/' \
34         -e 's/sparc.*/sparc/' \
35         -e 's/arm.*/arm/g' \
36         -e 's/m68k.*/m68k/' \
37         -e 's/ppc/powerpc/g' \
38         -e 's/v850.*/v850/g' \
39         -e 's/sh[234]/sh/' \
40         -e 's/mips.*/mips/' \
41         -e 's/cris.*/cris/' \
42         -e 's/xtensa.*/xtensa/' \
43         )
44 endif
45 export TARGET_ARCH
46
47
48 #--------------------------------------------------------
49 # If you are running a cross compiler, you will want to set 'CROSS'
50 # to something more interesting...  Target architecture is determined
51 # by asking the CC compiler what arch it compiles things for, so unless
52 # your compiler is broken, you should not need to specify TARGET_ARCH
53 #
54 # Most people will set this stuff on the command line, i.e.
55 #        make CROSS=mipsel-linux-
56 # will build uClibc for 'mipsel'.
57
58 CROSS      = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
59 CC         = $(CROSS)gcc
60 RM         = rm -f
61 RM_R       = $(RM) -r
62
63 # Select the compiler needed to build binaries for your development system
64 HOSTCC     = gcc
65
66
67 #--------------------------------------------------------
68 # A nifty macro to make testing gcc features easier
69 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
70         then echo "$(1)"; else echo "$(2)"; fi)
71
72 # use '-Os' optimization if available, else use -O2, allow Config to override
73 # Override optimization settings when debugging
74 ifeq ($(DODEBUG),y)
75 OPTIMIZATION    = -O0
76 else
77 OPTIMIZATION   += $(call check_gcc,-Os,-O2)
78 endif
79
80 XWARNINGS      := $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
81 XARCH_CFLAGS   := $(subst ",, $(strip $(ARCH_CFLAGS))) $(CPU_CFLAGS)
82 XCOMMON_CFLAGS := -D_GNU_SOURCE -I$(top_builddir)test
83 CFLAGS         := $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) $(XARCH_CFLAGS) -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include
84
85 CC_IPREFIX:=$(shell $(CC) --print-file-name=include)
86 CFLAGS += -I$(dir $(CC_IPREFIX))/include-fixed -I$(CC_IPREFIX)
87
88 HOST_CFLAGS    += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS)
89
90 LDFLAGS        := $(CPU_LDFLAGS)
91 ifeq ($(DODEBUG),y)
92         CFLAGS        += -g
93         HOST_CFLAGS   += -g
94         LDFLAGS       += -g
95         HOST_LDFLAGS  += -g
96 else
97         LDFLAGS       += -s
98         HOST_LDFLAGS  += -s
99 endif
100
101 ifneq ($(strip $(HAVE_SHARED)),y)
102         LDFLAGS       += -static
103         HOST_LDFLAGS  += -static
104 endif
105
106 LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
107 UCLIBC_LDSO_ABSPATH=$(shell pwd)
108 ifdef TEST_INSTALLED_UCLIBC
109 LDFLAGS += -Wl,-rpath,./
110 UCLIBC_LDSO_ABSPATH=$(SHARED_LIB_LOADER_PREFIX)
111 endif
112
113 ifeq ($(findstring -static,$(LDFLAGS)),)
114         LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)
115 endif
116
117 ifeq ($(LDSO_GNU_HASH_SUPPORT),y)
118 # Check for binutils support is done on root Rules.mak
119 LDFLAGS += -Wl,${LDFLAGS_GNUHASH}
120 endif
121
122
123 # Filter output
124 MAKEFLAGS += --no-print-directory
125 ifneq ($(findstring s,$(MAKEFLAGS)),)
126 DISP := sil
127 Q    := @
128 SCAT := -@true
129 else
130 ifneq ($(V)$(VERBOSE),)
131 DISP := ver
132 Q    :=
133 SCAT := cat
134 else
135 DISP := pur
136 Q    := @
137 SCAT := -@true
138 endif
139 endif
140
141 banner := ---------------------------------
142 pur_showclean = echo "  "CLEAN $(notdir $(CURDIR))
143 pur_showdiff  = echo "  "TEST_DIFF $(notdir $(CURDIR))/
144 pur_showlink  = echo "  "TEST_LINK $(notdir $(CURDIR))/ $@
145 pur_showtest  = echo "  "TEST_EXEC $(notdir $(CURDIR))/ $(patsubst %.exe,%,$@)
146 sil_showclean =
147 sil_showdiff  = true
148 sil_showlink  = true
149 sil_showtest  = true
150 ver_showclean =
151 ver_showdiff  = true echo
152 ver_showlink  = true echo
153 ver_showtest  = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $(patsubst %.exe,%,$@)\n$(banner)\n"
154 do_showclean  = $($(DISP)_showclean)
155 do_showdiff   = $($(DISP)_showdiff)
156 do_showlink   = $($(DISP)_showlink)
157 do_showtest   = $($(DISP)_showtest)
158 showclean = @$(do_showclean)
159 showdiff  = @$(do_showdiff)
160 showlink  = @$(do_showlink)
161 showtest  = @$(do_showtest)