OSDN Git Service

Fix compilation on mips
[uclinux-h8/uclibc-ng.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 # Use NATIVE_ARCH here since running these test is not
14 # even possible when cross compiling...
15 NATIVE_ARCH:= $(shell uname -m | sed \
16                 -e 's/i.86/i386/' \
17                 -e 's/sparc.*/sparc/' \
18                 -e 's/arm.*/arm/g' \
19                 -e 's/m68k.*/m68k/' \
20                 -e 's/ppc/powerpc/g' \
21                 -e 's/v850.*/v850/g' \
22                 -e 's/sh[234].*/sh/' \
23                 -e 's/mips.*/mips/' \
24                 )
25 ifeq ($(strip $(TARGET_ARCH)),)
26 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
27                 -e 's/i.86/i386/' \
28                 -e 's/sparc.*/sparc/' \
29                 -e 's/arm.*/arm/g' \
30                 -e 's/m68k.*/m68k/' \
31                 -e 's/ppc/powerpc/g' \
32                 -e 's/v850.*/v850/g' \
33                 -e 's/sh[234]/sh/' \
34                 -e 's/mips-.*/mips/' \
35                 -e 's/mipsel-.*/mipsel/' \
36                 -e 's/cris.*/cris/' \
37                 )
38 endif
39 export TARGET_ARCH
40
41 # If you are running a cross compiler, you may want to set this
42 # to something more interesting...
43 CC = ../$(TESTDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
44 HOST_CC = gcc
45 STRIPTOOL=strip
46 LDD = ../$(TESTDIR)ldso/util/ldd
47
48
49 # Check if 'ls -sh' works or not
50 LSFLAGS = -l
51
52 # turn all the warnings on
53 WARNINGS=-Wall
54
55 # use '-Os' optimization if available, else use -O2
56 OPTIMIZATION = ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
57     then echo "-Os"; else echo "-O2" ; fi}
58
59 ifeq ($(DODEBUG),true)
60     CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -g
61     GLIBC_CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -g
62     LDFLAGS =-Wl,-warn-common
63     GLIBC_LDFLAGS =-Wl,-warn-common 
64     STRIPTOOL =true -Since_we_are_debugging
65 else
66     CFLAGS  +=$(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer
67     GLIBC_CFLAGS  +=$(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer
68     LDFLAGS  =-s -Wl,-warn-common
69     GLIBC_LDFLAGS  =-s -Wl,-warn-common
70     STRIP    = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
71 endif
72
73 ifneq ($(DODYNAMIC),true)
74     LDFLAGS +=--static
75     GLIBC_LDFLAGS +=--static
76 endif
77 CFLAGS+=--uclibc-use-build-dir
78 LDFLAGS+=--uclibc-use-build-dir