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
18 ifeq (,$(findstring /,$(UCLIBC_LDSO)))
19 UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO)
22 UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*))
25 #--------------------------------------------------------
26 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
30 ifeq ($(strip $(TARGET_ARCH)),)
31 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
33 -e 's/sparc.*/sparc/' \
36 -e 's/ppc/powerpc/g' \
37 -e 's/v850.*/v850/g' \
46 #--------------------------------------------------------
47 # If you are running a cross compiler, you will want to set 'CROSS'
48 # to something more interesting... Target architecture is determined
49 # by asking the CC compiler what arch it compiles things for, so unless
50 # your compiler is broken, you should not need to specify TARGET_ARCH
52 # Most people will set this stuff on the command line, i.e.
53 # make CROSS=mipsel-linux-
54 # will build uClibc for 'mipsel'.
56 CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
60 # Select the compiler needed to build binaries for your development system
64 #--------------------------------------------------------
65 # A nifty macro to make testing gcc features easier
66 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
67 then echo "$(1)"; else echo "$(2)"; fi)
69 # use '-Os' optimization if available, else use -O2, allow Config to override
70 # Override optimization settings when debugging
74 OPTIMIZATION += $(call check_gcc,-Os,-O2)
77 XWARNINGS := $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
78 XARCH_CFLAGS := $(subst ",, $(strip $(ARCH_CFLAGS))) $(CPU_CFLAGS)
79 XCOMMON_CFLAGS := -D_GNU_SOURCE -I$(top_builddir)test
80 CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) $(XARCH_CFLAGS) -I$(top_builddir)include $(PTINC)
81 HOST_CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS)
83 LDFLAGS := $(CPU_LDFLAGS)
87 LDFLAGS += -g -Wl,-warn-common
88 HOST_LDFLAGS += -g -Wl,-warn-common
90 LDFLAGS += -s -Wl,-warn-common
91 HOST_LDFLAGS += -s -Wl,-warn-common
94 ifneq ($(strip $(HAVE_SHARED)),y)
96 HOST_LDFLAGS += -static
98 LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
99 ifeq ($(findstring -static,$(LDFLAGS)),)
100 LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO)
105 MAKEFLAGS += --no-print-directory
106 ifneq ($(findstring s,$(MAKEFLAGS)),)
111 ifneq ($(V)$(VERBOSE),)
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))/ $@
132 ver_showdiff = true echo
133 ver_showlink = true echo
134 ver_showtest = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $@\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)