OSDN Git Service

* doc/install.texi (xtensa-*-elf): New target.
[pf3gnuchains/gcc-fork.git] / gcc / ada / Makefile.adalib
1 # This is the Unix/NT makefile used to build an alternate GNAT run-time.
2 # Note that no files in the original GNAT library dirctory will be
3 # modified by this procedure
4 #
5 # This Makefile requires Gnu make.
6 # Here is how to use this Makefile
7 #
8 # 1. Create a new directory (say adalib)
9 #    e.g.  $ mkdir adalib
10 #          $ cd adalib           
11 #
12 # 2. Copy this Makefile from the standard Adalib directory, e.g.
13 #    $ cp /usr/local/gnat/lib/gcc-lib/<target>/2.8.1/adalib/Makefile.adalib .
14 #
15 # 3. If needed (e.g for pragma Normalize_Scalars), create a gnat.adc
16 #    containing the configuration pragmas you want to use to build the library
17 #    e.g. $ echo pragma Normalize_Scalars; > gnat.adc
18 #    Note that this step is usually not needed, and most pragmas are not
19 #    relevant to the GNAT run time. 
20 #          
21 # 4. Determine the values of the following MACROS
22 #      ROOT   (location of GNAT installation, e.g /usr/local)
23 #    and optionnally
24 #      CFLAGS (back end compilation flags such as -g -O2)
25 #      ADAFLAGS (front end compilation flags such as -gnatpgn)
26 #                *beware* the minimum value for this MACRO is -gnatpg 
27 #                for proper compilation of the GNAT library
28 # 5a. If you are using a native compile, call make
29 #   e.g.  $ make -f Makefile.adalib ROOT=/usr/local CFLAGS="-g -O0"
30 #
31 # 5b. If you are using a cross compiler, you need to define two additional
32 #     MACROS:
33 #       CC    (name of the cross compiler)
34 #       AR    (name of the cross ar)
35 #
36 #   e.g.  $ make -f Makefile.adalib ROOT=/opt/gnu/gnat \
37 #     CFLAGS="-O2 -g -I/usr/wind/target/h" CC=powerpc-wrs-vxworks-gcc \
38 #     AR=arppc
39 #
40 # 6. put this new library on your Object PATH where you want to use it
41 # in place of the original one. This can be achieved for instance by
42 # updating the value of the environment variable ADA_OBJECTS_PATH
43
44 SHELL=sh
45
46 CC = gcc
47 AR = ar
48 GNAT_ROOT = $(shell cd $(ROOT);pwd)/
49 target = $(shell $(CC) -dumpmachine)
50 version = $(shell $(CC) -dumpversion)
51 ADA_INCLUDE_PATH = $(GNAT_ROOT)lib/gcc-lib/$(target)/$(version)/adainclude/
52 ADA_OBJECTS_PATH = $(GNAT_ROOT)lib/gcc-lib/$(target)/$(version)/adalib/
53
54 vpath %.adb $(ADA_INCLUDE_PATH)
55 vpath %.ads $(ADA_INCLUDE_PATH)
56 vpath %.c $(ADA_INCLUDE_PATH)
57 vpath %.h $(ADA_INCLUDE_PATH)
58
59 CFLAGS = -O2
60 ADAFLAGS = -gnatpgn
61 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) -I. 
62 FORCE_DEBUG_ADAFLAGS = -g
63 INCLUDES = -I$(ADA_INCLUDE_PATH)
64
65 # Say how to compile Ada programs.
66 .SUFFIXES: .ada .adb .ads
67
68 .c.o:
69         $(CC) -c $(CFLAGS) $(ADA_CFLAGS) $(INCLUDES) $<
70 .adb.o:
71         $(CC) -c $(ALL_ADAFLAGS) $<
72 .ads.o:
73         $(CC) -c $(ALL_ADAFLAGS) $<
74
75 GNAT_OBJS :=$(filter-out prefix.o __%,$(shell $(AR) t $(ADA_OBJECTS_PATH)libgnat.a))
76 GNARL_OBJS:=$(filter-out __%,$(shell $(AR) t $(ADA_OBJECTS_PATH)libgnarl.a))
77 OBJS := $(GNAT_OBJS) $(GNARL_OBJS)
78
79 all: libgnat.a libgnarl.a
80         chmod 0444 *.ali *.a
81         rm *.o
82
83 libgnat.a: $(GNAT_OBJS)
84         $(AR) r libgnat.a $(GNAT_OBJS)
85
86 libgnarl.a: $(GNARL_OBJS)
87         $(AR) r libgnarl.a $(GNARL_OBJS)
88
89 a-except.o: a-except.adb a-except.ads
90         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) -O0 -fno-inline $<
91
92 s-assert.o: s-assert.adb s-assert.ads a-except.ads
93         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
94
95 s-tasdeb.o: s-tasdeb.adb
96         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
97
98 s-vaflop.o: s-vaflop.adb
99         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) -O $(ALL_ADAFLAGS) $<
100
101 s-memory.o: s-memory.adb s-memory.ads
102         $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
103
104 a-init.o: a-init.c a-ada.h a-types.h a-raise.h
105         $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
106                 $(ALL_CPPFLAGS) $(INCLUDES) -fexceptions $<
107
108 a-traceb.o: a-traceb.c
109         $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
110                 $(ALL_CPPFLAGS) $(INCLUDES) -fno-omit-frame-pointer $<
111
112 prefix.o: prefix.c gansidecl.h
113         $(CC) -c $(CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
114                 -DPREFIX=\"$(GNAT_ROOT)\" $<