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. 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.
21 # 4. Determine the values of the following MACROS
22 # ROOT (location of GNAT installation, e.g /usr/local)
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
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 \
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
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/
54 vpath %.adb $(ADA_INCLUDE_PATH)
55 vpath %.ads $(ADA_INCLUDE_PATH)
56 vpath %.c $(ADA_INCLUDE_PATH)
57 vpath %.h $(ADA_INCLUDE_PATH)
61 ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) -I.
62 FORCE_DEBUG_ADAFLAGS = -g
63 INCLUDES = -I$(ADA_INCLUDE_PATH)
65 # Say how to compile Ada programs.
66 .SUFFIXES: .ada .adb .ads
69 $(CC) -c $(CFLAGS) $(ADA_CFLAGS) $(INCLUDES) $<
71 $(CC) -c $(ALL_ADAFLAGS) $<
73 $(CC) -c $(ALL_ADAFLAGS) $<
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)
79 all: libgnat.a libgnarl.a
83 libgnat.a: $(GNAT_OBJS)
84 $(AR) r libgnat.a $(GNAT_OBJS)
86 libgnarl.a: $(GNARL_OBJS)
87 $(AR) r libgnarl.a $(GNARL_OBJS)
89 a-except.o: a-except.adb a-except.ads
90 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) -O0 -fno-inline $<
92 s-assert.o: s-assert.adb s-assert.ads a-except.ads
93 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
95 s-tasdeb.o: s-tasdeb.adb
96 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) $(ALL_ADAFLAGS) $<
98 s-vaflop.o: s-vaflop.adb
99 $(CC) -c $(FORCE_DEBUG_ADAFLAGS) -O $(ALL_ADAFLAGS) $<
101 s-memory.o: s-memory.adb s-memory.ads
102 $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) $<
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 $<
108 a-traceb.o: a-traceb.c
109 $(CC) -c $(CFLAGS) $(ADA_CFLAGS) \
110 $(ALL_CPPFLAGS) $(INCLUDES) -fno-omit-frame-pointer $<
112 prefix.o: prefix.c gansidecl.h
113 $(CC) -c $(CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
114 -DPREFIX=\"$(GNAT_ROOT)\" $<