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)
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. Copy or create a gnat.adc containing the configuration pragmas
16 # you want to use to build the library
17 # e.g. $ cp ~/gnat.adc gnat.adc
19 # 4. Determine the values of the following MACROS
20 # ROOT (location of GNAT installation, e.g /usr/local)
22 # CFLAGS (back end compilation flags such as -g -O2)
23 # ADAFLAGS (front end compilation flags such as -gnatpgn)
24 # *beware* the minimum value for this MACRO is -gnatpg
25 # for proper compilation of the GNAT library
26 # 5a. If you are using a native compile, call make
27 # e.g. $ make -f Makefile.adalib ROOT=/usr/local CFLAGS="-g -O0"
29 # 5b. If you are using a cross compiler, you need to define two additional
31 # CC (name of the cross compiler)
32 # AR (name of the cross ar)
34 # e.g. $ make -f Makefile.adalib ROOT=/opt/gnu/gnat \
35 # CFLAGS="-O2 -g -I/usr/wind/target/h" CC=powerpc-wrs-vxworks-gcc \
38 # 6. put this new library on your Object PATH where you want to use it
39 # in place of the original one. This can be achieved for instance by
40 # updating the value of the environment variable ADA_OBJECTS_PATH
46 GNAT_ROOT = $(shell cd $(ROOT);pwd)/
47 target = $(shell $(CC) -dumpmachine)
48 version = $(shell $(CC) -dumpversion)
49 ADA_INCLUDE_PATH = $(GNAT_ROOT)lib/gcc-lib/$(target)/$(version)/adainclude/
50 ADA_OBJECTS_PATH = $(GNAT_ROOT)lib/gcc-lib/$(target)/$(version)/adalib/
52 vpath %.adb $(ADA_INCLUDE_PATH)
53 vpath %.ads $(ADA_INCLUDE_PATH)
54 vpath %.c $(ADA_INCLUDE_PATH)
55 vpath %.h $(ADA_INCLUDE_PATH)
59 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) -I.
60 FORCE_DEBUG_ADAFLAGS = -g
61 INCLUDES = -I$(ADA_INCLUDE_PATH)
63 # Say how to compile Ada programs.
64 .SUFFIXES: .ada .adb .ads
67 $(CC) -c $(CFLAGS) $(ADA_CFLAGS) $(INCLUDES) $<
69 $(CC) -c $(ALL_ADAFLAGS) $<
71 $(CC) -c $(ALL_ADAFLAGS) $<
73 GNAT_OBJS :=$(filter-out prefix.o __%,$(shell $(AR) t $(ADA_OBJECTS_PATH)libgnat.a))
74 GNARL_OBJS:=$(filter-out __%,$(shell $(AR) t $(ADA_OBJECTS_PATH)libgnarl.a))
75 OBJS := $(GNAT_OBJS) $(GNARL_OBJS)
77 all: libgnat.a libgnarl.a
81 libgnat.a: $(GNAT_OBJS)
82 $(AR) r libgnat.a $(GNAT_OBJS)
84 libgnarl.a: $(GNARL_OBJS)
85 $(AR) r libgnarl.a $(GNARL_OBJS)
87 a-except.o: a-except.adb a-except.ads
88 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) -O0 -fno-inline $<
90 s-assert.o: s-assert.adb s-assert.ads a-except.ads
91 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
93 s-tasdeb.o: s-tasdeb.adb
94 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
96 s-vaflop.o: s-vaflop.adb
97 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) -O $(ALL_ADAFLAGS) $<
99 s-memory.o: s-memory.adb s-memory.ads
100 $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
102 a-init.o: a-init.c a-ada.h a-types.h a-raise.h
103 $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
104 $(ALL_CPPFLAGS) $(INCLUDES) -fexceptions $<
106 a-traceb.o: a-traceb.c
107 $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
108 $(ALL_CPPFLAGS) $(INCLUDES) -fno-omit-frame-pointer $<
110 prefix.o: prefix.c gansidecl.h
111 $(CC) -c $(CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
112 -DPREFIX=\"$(GNAT_ROOT)\" $<