OSDN Git Service

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