Add hppa-openbsd target
[official-gcc.git] / gcc / ada / Makefile.adalib
blob3ac2561e61eb014f44d0f504606d5020bbd9a1d9
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
5 # This Makefile requires Gnu make.
6 # Here is how to use this Makefile
8 # 1. Create a new directory (say adalib)
9 #    e.g.  $ mkdir adalib
10 #          $ cd adalib           
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 .
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"
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)
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
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
44 SHELL=sh
45 PWD=$${PWDCMD-pwd}
47 CC = gcc
48 AR = ar
49 GNAT_ROOT = $(shell cd $(ROOT);${PWD})/
50 target = $(shell $(CC) -dumpmachine)
51 version = $(shell $(CC) -dumpversion)
52 ADA_INCLUDE_PATH = $(GNAT_ROOT)lib/gcc-lib/$(target)/$(version)/adainclude/
53 ADA_OBJECTS_PATH = $(GNAT_ROOT)lib/gcc-lib/$(target)/$(version)/adalib/
55 vpath %.adb $(ADA_INCLUDE_PATH)
56 vpath %.ads $(ADA_INCLUDE_PATH)
57 vpath %.c $(ADA_INCLUDE_PATH)
58 vpath %.h $(ADA_INCLUDE_PATH)
60 CFLAGS = -O2
61 ADAFLAGS = -gnatpgn
62 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) -I. 
63 FORCE_DEBUG_ADAFLAGS = -g
64 INCLUDES = -I$(ADA_INCLUDE_PATH)
66 # Say how to compile Ada programs.
67 .SUFFIXES: .ada .adb .ads
69 .c.o:
70         $(CC) -c $(CFLAGS) $(ADA_CFLAGS) $(INCLUDES) $<
71 .adb.o:
72         $(CC) -c $(ALL_ADAFLAGS) $<
73 .ads.o:
74         $(CC) -c $(ALL_ADAFLAGS) $<
76 GNAT_OBJS :=$(filter-out prefix.o __%,$(shell $(AR) t $(ADA_OBJECTS_PATH)libgnat.a))
77 GNARL_OBJS:=$(filter-out __%,$(shell $(AR) t $(ADA_OBJECTS_PATH)libgnarl.a))
78 OBJS := $(GNAT_OBJS) $(GNARL_OBJS)
80 all: libgnat.a libgnarl.a
81         chmod 0444 *.ali *.a
82         rm *.o
84 libgnat.a: $(GNAT_OBJS)
85         $(AR) r libgnat.a $(GNAT_OBJS)
87 libgnarl.a: $(GNARL_OBJS)
88         $(AR) r libgnarl.a $(GNARL_OBJS)
90 a-except.o: a-except.adb a-except.ads
91         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) -O0 -fno-inline $<
93 s-assert.o: s-assert.adb s-assert.ads a-except.ads
94         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
96 s-tasdeb.o: s-tasdeb.adb
97         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
99 s-vaflop.o: s-vaflop.adb
100         $(CC) -c $(FORCE_DEBUG_ADAFLAGS) -O $(ALL_ADAFLAGS) $<
102 s-memory.o: s-memory.adb s-memory.ads
103         $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
105 a-init.o: a-init.c a-ada.h a-types.h a-raise.h
106         $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
107                 $(ALL_CPPFLAGS) $(INCLUDES) -fexceptions $<
109 a-traceb.o: a-traceb.c
110         $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
111                 $(ALL_CPPFLAGS) $(INCLUDES) -fno-omit-frame-pointer $<
113 prefix.o: prefix.c gansidecl.h
114         $(CC) -c $(CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
115                 -DPREFIX=\"$(GNAT_ROOT)\" $<