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
13 TESTDIR=$(top_builddir)test/
15 include $(top_builddir)/Rules.mak
17 UCLIBC_LDSO ?= $(firstword $(wildcard $(top_builddir)lib/ld*))
19 #--------------------------------------------------------
20 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
24 ifeq ($(strip $(TARGET_ARCH)),)
25 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
27 -e 's/sparc.*/sparc/' \
30 -e 's/ppc/powerpc/g' \
31 -e 's/v850.*/v850/g' \
40 #--------------------------------------------------------
41 # If you are running a cross compiler, you will want to set 'CROSS'
42 # to something more interesting... Target architecture is determined
43 # by asking the CC compiler what arch it compiles things for, so unless
44 # your compiler is broken, you should not need to specify TARGET_ARCH
46 # Most people will set this stuff on the command line, i.e.
47 # make CROSS=mipsel-linux-
48 # will build uClibc for 'mipsel'.
50 CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
54 # Select the compiler needed to build binaries for your development system
58 #--------------------------------------------------------
59 # A nifty macro to make testing gcc features easier
60 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
61 then echo "$(1)"; else echo "$(2)"; fi)
63 # use '-Os' optimization if available, else use -O2, allow Config to override
64 # Override optimization settings when debugging
68 OPTIMIZATION += $(call check_gcc,-Os,-O2)
71 XWARNINGS := $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
72 XARCH_CFLAGS := $(subst ",, $(strip $(ARCH_CFLAGS))) $(CPU_CFLAGS)
73 XCOMMON_CFLAGS := -D_GNU_SOURCE -I$(top_builddir)test
74 CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) $(XARCH_CFLAGS) -I$(top_builddir)include $(PTINC)
75 HOST_CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS)
77 LDFLAGS := $(CPU_LDFLAGS)
81 LDFLAGS += -g -Wl,-warn-common
82 HOST_LDFLAGS += -g -Wl,-warn-common
84 LDFLAGS += -s -Wl,-warn-common
85 HOST_LDFLAGS += -s -Wl,-warn-common
88 ifneq ($(strip $(HAVE_SHARED)),y)
90 HOST_LDFLAGS += -static
92 LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
93 ifeq ($(findstring -static,$(LDFLAGS)),)
94 LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO)
99 MAKEFLAGS += --no-print-directory
100 ifneq ($(findstring s,$(MAKEFLAGS)),)
105 ifneq ($(V)$(VERBOSE),)
116 banner := ---------------------------------
117 pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
118 pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
119 pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
120 pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $@
126 ver_showdiff = true echo
127 ver_showlink = true echo
128 ver_showtest = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $@\n$(banner)\n"
129 do_showclean = $($(DISP)_showclean)
130 do_showdiff = $($(DISP)_showdiff)
131 do_showlink = $($(DISP)_showlink)
132 do_showtest = $($(DISP)_showtest)
133 showclean = @$(do_showclean)
134 showdiff = @$(do_showdiff)
135 showlink = @$(do_showlink)
136 showtest = @$(do_showtest)