1 # Dependencies for compiler sources that are generated at build time
3 # Note: can't use ?= here, not supported by older versions of GNU Make
5 ifeq ($(origin CP), undefined)
9 ifeq ($(origin MKDIR), undefined)
13 fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND})
15 GEN_IL_INCLUDES = -I$(fsrcdir)/ada
16 GEN_IL_FLAGS = -gnata -gnat2012 -gnatw.g -gnatyg -gnatU $(GEN_IL_INCLUDES)
18 ada/seinfo_tables.ads ada/seinfo_tables.adb ada/sinfo.h ada/einfo.h ada/nmake.ads ada/nmake.adb ada/seinfo.ads ada/sinfo-nodes.ads ada/sinfo-nodes.adb ada/einfo-entities.ads ada/einfo-entities.adb: ada/stamp-gen_il ; @true
19 ada/stamp-gen_il: $(fsrcdir)/ada/gen_il*
21 cd ada/gen_il; gnatmake -q -g $(GEN_IL_FLAGS) gen_il-main
22 # Ignore errors to work around finalization issues in older compilers
23 - cd ada/gen_il; ./gen_il-main
24 $(fsrcdir)/../move-if-change ada/gen_il/seinfo_tables.ads ada/seinfo_tables.ads
25 $(fsrcdir)/../move-if-change ada/gen_il/seinfo_tables.adb ada/seinfo_tables.adb
26 $(fsrcdir)/../move-if-change ada/gen_il/sinfo.h ada/sinfo.h
27 $(fsrcdir)/../move-if-change ada/gen_il/einfo.h ada/einfo.h
28 $(fsrcdir)/../move-if-change ada/gen_il/nmake.ads ada/nmake.ads
29 $(fsrcdir)/../move-if-change ada/gen_il/nmake.adb ada/nmake.adb
30 $(fsrcdir)/../move-if-change ada/gen_il/seinfo.ads ada/seinfo.ads
31 $(fsrcdir)/../move-if-change ada/gen_il/sinfo-nodes.ads ada/sinfo-nodes.ads
32 $(fsrcdir)/../move-if-change ada/gen_il/sinfo-nodes.adb ada/sinfo-nodes.adb
33 $(fsrcdir)/../move-if-change ada/gen_il/einfo-entities.ads ada/einfo-entities.ads
34 $(fsrcdir)/../move-if-change ada/gen_il/einfo-entities.adb ada/einfo-entities.adb
35 touch ada/stamp-gen_il
37 # We need -gnatX to compile seinfo_tables, because it uses extensions. This
38 # target is not currently used when building gnat, because these extensions
39 # would cause bootstrapping with older compilers to fail. You can call it by
40 # hand, as a sanity check that these files are legal.
41 ada/seinfo_tables.o: ada/seinfo_tables.ads ada/seinfo_tables.adb
42 cd ada ; gnatmake $(GEN_IL_INCLUDES) seinfo_tables.adb -gnatU -gnatX
44 ada/snames.h ada/snames.ads ada/snames.adb : ada/stamp-snames ; @true
45 ada/stamp-snames : ada/snames.ads-tmpl ada/snames.adb-tmpl ada/snames.h-tmpl ada/xsnamest.adb ada/xutil.ads ada/xutil.adb
46 -$(MKDIR) ada/bldtools/snamest
47 $(RM) $(addprefix ada/bldtools/snamest/,$(notdir $^))
48 $(CP) $^ ada/bldtools/snamest
49 cd ada/bldtools/snamest && gnatmake -q xsnamest && ./xsnamest
50 $(fsrcdir)/../move-if-change ada/bldtools/snamest/snames.ns ada/snames.ads
51 $(fsrcdir)/../move-if-change ada/bldtools/snamest/snames.nb ada/snames.adb
52 $(fsrcdir)/../move-if-change ada/bldtools/snamest/snames.nh ada/snames.h
53 touch ada/stamp-snames
55 ada/sdefault.adb: ada/stamp-sdefault ; @true
56 ada/stamp-sdefault : $(srcdir)/ada/version.c Makefile
57 $(ECHO) "pragma Style_Checks (Off);" >tmp-sdefault.adb
58 $(ECHO) "with Osint; use Osint;" >>tmp-sdefault.adb
59 $(ECHO) "package body Sdefault is" >>tmp-sdefault.adb
60 $(ECHO) " S0 : constant String := \"$(prefix)/\";" >>tmp-sdefault.adb
61 $(ECHO) " S1 : constant String := \"$(ADA_INCLUDE_DIR)/\";" >>tmp-sdefault.adb
62 $(ECHO) " S2 : constant String := \"$(ADA_RTL_OBJ_DIR)/\";" >>tmp-sdefault.adb
63 $(ECHO) " S3 : constant String := \"$(target_noncanonical)/\";" >>tmp-sdefault.adb
64 $(ECHO) " S4 : constant String := \"$(libsubdir)/\";" >>tmp-sdefault.adb
65 $(ECHO) " function Include_Dir_Default_Name return String_Ptr is" >>tmp-sdefault.adb
66 $(ECHO) " begin" >>tmp-sdefault.adb
67 $(ECHO) " return Relocate_Path (S0, S1);" >>tmp-sdefault.adb
68 $(ECHO) " end Include_Dir_Default_Name;" >>tmp-sdefault.adb
69 $(ECHO) " function Object_Dir_Default_Name return String_Ptr is" >>tmp-sdefault.adb
70 $(ECHO) " begin" >>tmp-sdefault.adb
71 $(ECHO) " return Relocate_Path (S0, S2);" >>tmp-sdefault.adb
72 $(ECHO) " end Object_Dir_Default_Name;" >>tmp-sdefault.adb
73 $(ECHO) " function Target_Name return String_Ptr is" >>tmp-sdefault.adb
74 $(ECHO) " begin" >>tmp-sdefault.adb
75 $(ECHO) " return new String'(S3);" >>tmp-sdefault.adb
76 $(ECHO) " end Target_Name;" >>tmp-sdefault.adb
77 $(ECHO) " function Search_Dir_Prefix return String_Ptr is" >>tmp-sdefault.adb
78 $(ECHO) " begin" >>tmp-sdefault.adb
79 $(ECHO) " return Relocate_Path (S0, S4);" >>tmp-sdefault.adb
80 $(ECHO) " end Search_Dir_Prefix;" >>tmp-sdefault.adb
81 $(ECHO) "end Sdefault;" >> tmp-sdefault.adb
82 $(fsrcdir)/../move-if-change tmp-sdefault.adb ada/sdefault.adb
83 touch ada/stamp-sdefault
85 ada/%: $(srcdir)/ada/libgnat/%