1 # Rules.mak for uClibc test subdirs
3 # Copyright (C) 2001 by Lineo, inc.
5 # Note: This does not read the top level Rules.mak file
11 -include $(TOPDIR).config
13 #--------------------------------------------------------
14 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
18 ifeq ($(strip $(TARGET_ARCH)),)
19 TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
21 -e 's/sparc.*/sparc/' \
24 -e 's/ppc/powerpc/g' \
25 -e 's/v850.*/v850/g' \
27 -e 's/mips-.*/mips/' \
28 -e 's/mipsel-.*/mipsel/' \
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
41 # Most people will set this stuff on the command line, i.e.
42 # make CROSS=mipsel-linux-
43 # will build uClibc for 'mipsel'.
49 ifeq ($(LDSO_LDD_SUPPORT),y)
50 LDD = $(TOPDIR)utils/ldd
55 # Select the compiler needed to build binaries for your development system
57 HOSTCFLAGS = -O2 -Wall
60 #--------------------------------------------------------
61 # Check if 'ls -sh' works or not
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)
68 # use '-Os' optimization if available, else use -O2, allow Config to override
69 # Override optimization settings when debugging
73 OPTIMIZATION += $(call check_gcc,-Os,-O2)
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)
85 LDFLAGS += -g -Wl,-warn-common
86 GLIBC_LDFLAGS = -g -Wl,-warn-common
87 STRIPTOOL = true -Since_we_are_debugging
89 LDFLAGS += -s -Wl,-warn-common
90 GLIBC_LDFLAGS = -s -Wl,-warn-common
91 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
94 ifneq ($(strip $(HAVE_SHARED)),y)
96 GLIBC_LDFLAGS += -static