1 # Rules.make for uClibc test apps.
3 # Copyright (C) 2001 by Lineo, inc.
6 #Note: This does not read the top level Rules.mak file
9 -include $(TESTDIR)../.config
10 include $(TESTDIR)Config
12 #--------------------------------------------------------
13 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
17 ifeq ($(strip $(TARGET_ARCH)),)
18 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
20 -e 's/sparc.*/sparc/' \
23 -e 's/ppc/powerpc/g' \
24 -e 's/v850.*/v850/g' \
26 -e 's/mips-.*/mips/' \
27 -e 's/mipsel-.*/mipsel/' \
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
40 # Most people will set this stuff on the command line, i.e.
41 # make CROSS=mipsel-linux-
42 # will build uClibc for 'mipsel'.
47 LDD=../$(TOPDIR)/utils/ldd
51 # Select the compiler needed to build binaries for your development system
56 #--------------------------------------------------------
57 # Check if 'ls -sh' works or not
60 # A nifty macro to make testing gcc features easier
61 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
62 then echo "$(1)"; else echo "$(2)"; fi)
64 # use '-Os' optimization if available, else use -O2, allow Config to override
65 OPTIMIZATION+=$(call check_gcc,-Os,-O2)
66 # Override optimization settings when debugging
67 ifeq ($(DODEBUG),true)
71 XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
72 XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
73 CFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS)
74 GLIBC_CFLAGS+=$(XWARNINGS) $(OPTIMIZATION)
77 ifeq ($(DODEBUG),true)
80 LDFLAGS += -g -Wl,-warn-common
81 GLIBC_LDFLAGS =-g -Wl,-warn-common
82 STRIPTOOL =true -Since_we_are_debugging
84 LDFLAGS +=-s -Wl,-warn-common
85 GLIBC_LDFLAGS =-s -Wl,-warn-common
86 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
89 ifneq ($(DODYNAMIC),true)
91 GLIBC_LDFLAGS +=-static