1 # Rules.mak for uClibc test subdirs
3 # Copyright (C) 2001 by Lineo, inc.
4 # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
6 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 # Note: This does not read the top level Rules.mak file
12 TESTDIR=$(top_builddir)test/
14 -include $(top_builddir).config
17 UCLIBC_LDSO := ld-uClibc.so.0
20 #--------------------------------------------------------
21 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
25 ifeq ($(strip $(TARGET_ARCH)),)
26 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
28 -e 's/sparc.*/sparc/' \
31 -e 's/ppc/powerpc/g' \
32 -e 's/v850.*/v850/g' \
34 -e 's/mips-.*/mips/' \
35 -e 's/mipsel-.*/mipsel/' \
42 #--------------------------------------------------------
43 # If you are running a cross compiler, you will want to set 'CROSS'
44 # to something more interesting... Target architecture is determined
45 # by asking the CC compiler what arch it compiles things for, so unless
46 # your compiler is broken, you should not need to specify TARGET_ARCH
48 # Most people will set this stuff on the command line, i.e.
49 # make CROSS=mipsel-linux-
50 # will build uClibc for 'mipsel'.
52 CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
57 # Select the compiler needed to build binaries for your development system
59 BUILD_CFLAGS = -O2 -Wall
62 #--------------------------------------------------------
63 # Check if 'ls -sh' works or not
66 # A nifty macro to make testing gcc features easier
67 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
68 then echo "$(1)"; else echo "$(2)"; fi)
70 # use '-Os' optimization if available, else use -O2, allow Config to override
71 # Override optimization settings when debugging
75 OPTIMIZATION += $(call check_gcc,-Os,-O2)
78 XWARNINGS = $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
79 XARCH_CFLAGS = $(subst ",, $(strip $(ARCH_CFLAGS)))
80 CFLAGS = $(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) -D_GNU_SOURCE
81 HOST_CFLAGS += $(XWARNINGS) $(OPTIMIZATION) -D_GNU_SOURCE
86 LDFLAGS += -g -Wl,-warn-common
87 HOST_LDFLAGS = -g -Wl,-warn-common
88 STRIPTOOL = true -Since_we_are_debugging
90 LDFLAGS += -s -Wl,-warn-common
91 HOST_LDFLAGS = -s -Wl,-warn-common
92 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
95 ifneq ($(strip $(HAVE_SHARED)),y)
97 HOST_LDFLAGS += -static
99 LDFLAGS += -B$(top_builddir)lib
103 MAKEFLAGS += --no-print-directory
104 ifneq ($(findstring s,$(MAKEFLAGS)),)
109 ifneq ($(V)$(VERBOSE),)
120 banner := ---------------------------------
121 pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
122 pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
123 pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
124 pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $@
130 ver_showdiff = true echo
131 ver_showlink = true echo
132 ver_showtest = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $@\n$(banner)\n"
133 do_showclean = $($(DISP)_showclean)
134 do_showdiff = $($(DISP)_showdiff)
135 do_showlink = $($(DISP)_showlink)
136 do_showtest = $($(DISP)_showtest)
137 showclean = @$(do_showclean)
138 showdiff = @$(do_showdiff)
139 showlink = @$(do_showlink)
140 showtest = @$(do_showtest)