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 ADA_GEN_SUBDIR), undefined)
9 ifeq ($(origin CP), undefined)
13 ifeq ($(origin MKDIR), undefined)
17 ifeq ($(origin MOVE_IF_CHANGE), undefined)
21 .PHONY: ada_extra_files
22 ada_extra_files : $(ADA_GEN_SUBDIR)/treeprs.ads $(ADA_GEN_SUBDIR)/einfo.h $(ADA_GEN_SUBDIR)/sinfo.h $(ADA_GEN_SUBDIR)/nmake.adb \
23 $(ADA_GEN_SUBDIR)/nmake.ads $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb $(ADA_GEN_SUBDIR)/snames.h
25 # We delete the files before copying, below, in case they are read-only.
27 $(ADA_GEN_SUBDIR)/treeprs.ads : $(ADA_GEN_SUBDIR)/treeprs.adt $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/xtreeprs.adb
28 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/treeprs
29 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/treeprs/,$(notdir $^))
30 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/treeprs
31 (cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs treeprs.ads )
32 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/treeprs/treeprs.ads $(ADA_GEN_SUBDIR)/treeprs.ads
34 $(ADA_GEN_SUBDIR)/einfo.h : $(ADA_GEN_SUBDIR)/einfo.ads $(ADA_GEN_SUBDIR)/einfo.adb $(ADA_GEN_SUBDIR)/xeinfo.adb $(ADA_GEN_SUBDIR)/ceinfo.adb
35 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/einfo
36 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/einfo/,$(notdir $^))
37 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/einfo
38 (cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo einfo.h )
39 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/einfo/einfo.h $(ADA_GEN_SUBDIR)/einfo.h
41 $(ADA_GEN_SUBDIR)/sinfo.h : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/sinfo.adb $(ADA_GEN_SUBDIR)/xsinfo.adb $(ADA_GEN_SUBDIR)/csinfo.adb
42 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/sinfo
43 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/sinfo/,$(notdir $^))
44 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/sinfo
45 (cd $(ADA_GEN_SUBDIR)/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h )
46 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/sinfo/sinfo.h $(ADA_GEN_SUBDIR)/sinfo.h
48 $(ADA_GEN_SUBDIR)/snames.h $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb : $(ADA_GEN_SUBDIR)/stamp-snames ; @true
49 $(ADA_GEN_SUBDIR)/stamp-snames : $(ADA_GEN_SUBDIR)/snames.ads-tmpl $(ADA_GEN_SUBDIR)/snames.adb-tmpl $(ADA_GEN_SUBDIR)/snames.h-tmpl $(ADA_GEN_SUBDIR)/xsnamest.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
50 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/snamest
51 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/snamest/,$(notdir $^))
52 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/snamest
53 (cd $(ADA_GEN_SUBDIR)/bldtools/snamest; gnatmake -q xsnamest ; ./xsnamest )
54 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.ns $(ADA_GEN_SUBDIR)/snames.ads
55 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nb $(ADA_GEN_SUBDIR)/snames.adb
56 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nh $(ADA_GEN_SUBDIR)/snames.h
57 touch $(ADA_GEN_SUBDIR)/stamp-snames
59 $(ADA_GEN_SUBDIR)/nmake.adb $(ADA_GEN_SUBDIR)/nmake.ads: $(ADA_GEN_SUBDIR)/stamp-nmake ; @true
60 $(ADA_GEN_SUBDIR)/stamp-nmake: $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/nmake.adt $(ADA_GEN_SUBDIR)/xnmake.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
61 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake
62 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake/,$(notdir $^))
63 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake
64 (cd $(ADA_GEN_SUBDIR)/bldtools/nmake; gnatmake -q xnmake ; ./xnmake -b nmake.adb ; ./xnmake -s nmake.ads)
65 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/nmake/nmake.ads $(ADA_GEN_SUBDIR)/nmake.ads
66 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/nmake/nmake.adb $(ADA_GEN_SUBDIR)/nmake.adb
67 touch $(ADA_GEN_SUBDIR)/stamp-nmake
69 # GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
70 # for running it from $(ADA_GEN_SUBDIR)/bldtools/oscons
71 OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
72 | sed -e 's^\./xgcc^../../../xgcc^' -e 's^-B./^-B../../../^'`
73 OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
74 -DTARGET=\"$(target)\" s-oscons-tmplt.c > s-oscons-tmplt.i
75 OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
77 # Note: if you need to build with a non-GNU compiler, you could adapt the
78 # following definitions (written for VMS DEC-C)
79 #OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
80 # -DTARGET='""$(target)""' s-oscons-tmplt.c
82 #OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
83 # -DTARGET='""$(target)""' s-oscons-tmplt.c ; \
84 # ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
85 # ./s-oscons-tmplt.exe > s-oscons-tmplt.s
87 $(ADA_GEN_SUBDIR)/s-oscons.ads : $(ADA_GEN_SUBDIR)/s-oscons-tmplt.c $(ADA_GEN_SUBDIR)/gsocket.h $(ADA_GEN_SUBDIR)/xoscons.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
88 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/oscons
89 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/oscons/,$(notdir $^))
90 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/oscons
91 (cd $(ADA_GEN_SUBDIR)/bldtools/oscons ; gnatmake -q xoscons ; \
92 $(RM) s-oscons-tmplt.i s-oscons-tmplt.s ; \
95 ./xoscons s-oscons ) ; \
96 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/oscons/s-oscons.ads $(ADA_GEN_SUBDIR)/s-oscons.ads ; \
97 $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/oscons/s-oscons.h $(ADA_GEN_SUBDIR)/s-oscons.h
99 $(ADA_GEN_SUBDIR)/sdefault.adb: $(ADA_GEN_SUBDIR)/stamp-sdefault ; @true
100 $(ADA_GEN_SUBDIR)/stamp-sdefault : $(srcdir)/version.c Makefile
101 $(ECHO) "pragma Style_Checks (Off);" >tmp-sdefault.adb
102 $(ECHO) "with Osint; use Osint;" >>tmp-sdefault.adb
103 $(ECHO) "package body Sdefault is" >>tmp-sdefault.adb
104 $(ECHO) " S0 : constant String := \"$(prefix)/\";" >>tmp-sdefault.adb
105 $(ECHO) " S1 : constant String := \"$(ADA_INCLUDE_DIR)/\";" >>tmp-sdefault.adb
106 $(ECHO) " S2 : constant String := \"$(ADA_RTL_OBJ_DIR)/\";" >>tmp-sdefault.adb
107 $(ECHO) " S3 : constant String := \"$(target_noncanonical)/\";" >>tmp-sdefault.adb
108 $(ECHO) " S4 : constant String := \"$(libsubdir)/\";" >>tmp-sdefault.adb
109 $(ECHO) " function Include_Dir_Default_Name return String_Ptr is" >>tmp-sdefault.adb
110 $(ECHO) " begin" >>tmp-sdefault.adb
111 $(ECHO) " return Relocate_Path (S0, S1);" >>tmp-sdefault.adb
112 $(ECHO) " end Include_Dir_Default_Name;" >>tmp-sdefault.adb
113 $(ECHO) " function Object_Dir_Default_Name return String_Ptr is" >>tmp-sdefault.adb
114 $(ECHO) " begin" >>tmp-sdefault.adb
115 $(ECHO) " return Relocate_Path (S0, S2);" >>tmp-sdefault.adb
116 $(ECHO) " end Object_Dir_Default_Name;" >>tmp-sdefault.adb
117 $(ECHO) " function Target_Name return String_Ptr is" >>tmp-sdefault.adb
118 $(ECHO) " begin" >>tmp-sdefault.adb
119 $(ECHO) " return new String'(S3);" >>tmp-sdefault.adb
120 $(ECHO) " end Target_Name;" >>tmp-sdefault.adb
121 $(ECHO) " function Search_Dir_Prefix return String_Ptr is" >>tmp-sdefault.adb
122 $(ECHO) " begin" >>tmp-sdefault.adb
123 $(ECHO) " return Relocate_Path (S0, S4);" >>tmp-sdefault.adb
124 $(ECHO) " end Search_Dir_Prefix;" >>tmp-sdefault.adb
125 $(ECHO) "end Sdefault;" >> tmp-sdefault.adb
126 $(MOVE_IF_CHANGE) tmp-sdefault.adb $(ADA_GEN_SUBDIR)/sdefault.adb
127 touch $(ADA_GEN_SUBDIR)/stamp-sdefault
129 $(ADA_GEN_SUBDIR)/gnat.hlp : $(ADA_GEN_SUBDIR)/vms_help.adb $(ADA_GEN_SUBDIR)/vms_cmds.ads $(ADA_GEN_SUBDIR)/gnat.help_in $(ADA_GEN_SUBDIR)/vms_data.ads
130 -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp
131 $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp/,$(notdir $^))
132 $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp
133 (cd $(ADA_GEN_SUBDIR)/bldtools/gnat_hlp; \
134 gnatmake -q vms_help; \
135 ./vms_help$(build_exeext) gnat.help_in vms_data.ads ../../gnat.hlp)