OSDN Git Service

dont try to run ldd if LDSO_LDD_SUPPORT is disabled in .config
[uclinux-h8/uClibc.git] / test / Rules.mak
1 # Rules.mak for uClibc test subdirs
2 #
3 # Copyright (C) 2001 by Lineo, inc.
4 #
5 # Note: This does not read the top level Rules.mak file
6 #
7
8 TOPDIR = ../../
9 TESTDIR=$(TOPDIR)test/
10
11 -include $(TOPDIR).config
12
13 #--------------------------------------------------------
14 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. 
15 LC_ALL:= C
16 export LC_ALL
17
18 ifeq ($(strip $(TARGET_ARCH)),)
19 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
20         -e 's/i.86/i386/' \
21         -e 's/sparc.*/sparc/' \
22         -e 's/arm.*/arm/g' \
23         -e 's/m68k.*/m68k/' \
24         -e 's/ppc/powerpc/g' \
25         -e 's/v850.*/v850/g' \
26         -e 's/sh[234]/sh/' \
27         -e 's/mips-.*/mips/' \
28         -e 's/mipsel-.*/mipsel/' \
29         -e 's/cris.*/cris/' \
30         )
31 endif
32 export TARGET_ARCH
33
34
35 #--------------------------------------------------------
36 # If you are running a cross compiler, you will want to set 'CROSS'
37 # to something more interesting...  Target architecture is determined
38 # by asking the CC compiler what arch it compiles things for, so unless
39 # your compiler is broken, you should not need to specify TARGET_ARCH
40 #
41 # Most people will set this stuff on the command line, i.e.
42 #        make CROSS=mipsel-linux-
43 # will build uClibc for 'mipsel'.
44
45 CROSS      = 
46 CC         = $(CROSS)gcc
47 STRIPTOOL  = strip
48 RM         = rm -f
49 ifeq ($(LDSO_LDD_SUPPORT),y)
50 LDD        = $(TOPDIR)utils/ldd
51 else
52 LDD        = @true
53 endif
54
55 # Select the compiler needed to build binaries for your development system
56 HOSTCC     = gcc
57 HOSTCFLAGS = -O2 -Wall
58
59
60 #--------------------------------------------------------
61 # Check if 'ls -sh' works or not
62 LSFLAGS = -l
63
64 # A nifty macro to make testing gcc features easier
65 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
66         then echo "$(1)"; else echo "$(2)"; fi)
67
68 # use '-Os' optimization if available, else use -O2, allow Config to override
69 # Override optimization settings when debugging
70 ifeq ($(DODEBUG),y)
71 OPTIMIZATION    = -O0
72 else
73 OPTIMIZATION   += $(call check_gcc,-Os,-O2)
74 endif
75
76 XWARNINGS       = $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
77 XARCH_CFLAGS    = $(subst ",, $(strip $(ARCH_CFLAGS)))
78 CFLAGS          = $(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS)
79 GLIBC_CFLAGS   += $(XWARNINGS) $(OPTIMIZATION)
80 LDFLAGS         =
81
82 ifeq ($(DODEBUG),y)
83         CFLAGS        += -g
84         GLIBC_CFLAGS  += -g
85         LDFLAGS       += -g -Wl,-warn-common
86         GLIBC_LDFLAGS  = -g -Wl,-warn-common 
87         STRIPTOOL      = true -Since_we_are_debugging
88 else
89         LDFLAGS       += -s -Wl,-warn-common
90         GLIBC_LDFLAGS  = -s -Wl,-warn-common
91         STRIP          = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
92 endif
93
94 ifneq ($(strip $(HAVE_SHARED)),y)
95         LDFLAGS       += -static
96         GLIBC_LDFLAGS += -static
97 endif