1 |
39 |
lampret |
# These are set by configure.
|
2 |
|
|
program_transform_name=
|
3 |
|
|
|
4 |
|
|
# Find the tools used to build newlib.
|
5 |
|
|
# ${rootpre} should be set to the name of the top level newlib build directory
|
6 |
|
|
# followed by a '/'. Likewise with ${srcrootpre}. If ${rootpre} is not set,
|
7 |
|
|
# we use program_transform_name to guess the name of the program.
|
8 |
|
|
# Each Makefile must define $(TOP) and $(SRCTOP); they will usually be the
|
9 |
|
|
# same, but they are different when building multiple versions with
|
10 |
|
|
# different compilation flags: $(TOP) will typically contain extra ../'s.
|
11 |
|
|
CC = `if [ -f $${rootpre}$(TOP)/../../gcc/xgcc ] ; \
|
12 |
|
|
then echo $${rootpre}$(TOP)/../../gcc/xgcc -B$${rootpre}$(TOP)/../../gcc/ ; \
|
13 |
|
|
else t='$(program_transform_name)'; echo gcc | sed -e '' $$t ; fi`
|
14 |
|
|
AS = `if [ -f $${rootpre}$(TOP)/../../gas/as.new ] ; \
|
15 |
|
|
then echo $${rootpre}$(TOP)/../../gas/as.new ; \
|
16 |
|
|
else t='$(program_transform_name)'; echo as | sed -e '' $$t ; fi`
|
17 |
|
|
DLLTOOL = `if [ -f $${rootpre}$(TOP)/../../binutils/dlltool ] ; \
|
18 |
|
|
then echo $${rootpre}$(TOP)/../../binutils/dlltool ; \
|
19 |
|
|
else t='$(program_transform_name)'; echo dlltool | sed -e '' $$t ; fi`
|
20 |
|
|
AR = `if [ -f $${rootpre}$(TOP)/../../binutils/ar ] ; \
|
21 |
|
|
then echo $${rootpre}$(TOP)/../../binutils/ar ; \
|
22 |
|
|
else t='$(program_transform_name)'; echo ar | sed -e '' $$t ; fi`
|
23 |
|
|
AR_FLAGS = qc
|
24 |
|
|
RANLIB = `if [ -f $${rootpre}$(TOP)/../../binutils/ranlib ] ; \
|
25 |
|
|
then echo $${rootpre}$(TOP)/../../binutils/ranlib ; \
|
26 |
|
|
else t='$(program_transform_name)'; echo ranlib | sed -e '' $$t ; fi`
|
27 |
|
|
|
28 |
|
|
# CFLAGS is the general CFLAGS. CROSS_CFLAGS is for special newlib
|
29 |
|
|
# flags. TARGET_CFLAGS is for target specific flags, and is
|
30 |
|
|
# initialized by the configure script. NEWLIB_CFLAGS is for flags we
|
31 |
|
|
# must always pass to gcc.
|
32 |
|
|
CFLAGS = -g
|
33 |
|
|
CROSS_CFLAGS =
|
34 |
|
|
TARGET_CFLAGS =
|
35 |
|
|
NEWLIB_CFLAGS = -fno-builtin
|
36 |
|
|
|
37 |
|
|
# Get the include directories. Note that in subdirectories, the
|
38 |
|
|
# string passed down from the top newlib Makefile will override this
|
39 |
|
|
# expression.
|
40 |
|
|
|
41 |
|
|
# If we are doing a cygwin32 build, we need to add a -I for the winsup
|
42 |
|
|
# header files. We can't check whether winsup has been configured at
|
43 |
|
|
# this point, because newlib is normally built before winsup is
|
44 |
|
|
# configured.
|
45 |
|
|
|
46 |
|
|
INCLUDES = ` \
|
47 |
|
|
srcrootpre=$${srcrootpre-$(srcdir)/}; \
|
48 |
|
|
if [ x$(target_os) = xcygwin32 ]; then \
|
49 |
|
|
echo -I$${rootpre}$(TOP)/targ-include -I$${srcrootpre}$(SRCTOP)/libc/include -I$${srcrootpre}$(SRCTOP)/../winsup/include; \
|
50 |
|
|
else \
|
51 |
|
|
echo -I$${rootpre}$(TOP)/targ-include -I$${srcrootpre}$(SRCTOP)/libc/include; \
|
52 |
|
|
fi`
|
53 |
|
|
|
54 |
|
|
# Using CFLAGS here may be confusing if the user has given a special
|
55 |
|
|
# CFLAGS intended for use on the host, since we are passing it to the
|
56 |
|
|
# cross-compiler; I'm not sure what to do about this. INCLUDES is
|
57 |
|
|
# from the top level Makefile.
|
58 |
|
|
.c.o:
|
59 |
|
|
$(CC) $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<
|
60 |
|
|
|
61 |
|
|
.s.o:
|
62 |
|
|
$(AS) $(INCLUDES) -o $*.o $<
|
63 |
|
|
|
64 |
|
|
.S.o:
|
65 |
|
|
$(CC) $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<
|
66 |
|
|
|
67 |
|
|
# Build documentation from a .c file.
|
68 |
|
|
CHEW = `srcrootpre=$${srcrootpre-$(srcdir)/}; echo $${rootpre}$(TOP)/doc/makedoc -f $${srcrootpre}$(SRCTOP)/doc/doc.str`
|
69 |
|
|
|
70 |
|
|
.c.def:
|
71 |
|
|
$(CHEW) < $< >$*.def 2>$*.ref
|