1 |
281 |
jeremybenn |
# Dependencies for compiler sources that are generated at build time
|
2 |
|
|
|
3 |
|
|
# Note: can't use ?= here, not supported by older versions of GNU Make
|
4 |
|
|
|
5 |
|
|
ifeq ($(origin ADA_GEN_SUBDIR), undefined)
|
6 |
|
|
ADA_GEN_SUBDIR=ada
|
7 |
|
|
endif
|
8 |
|
|
|
9 |
|
|
ifeq ($(origin CP), undefined)
|
10 |
|
|
CP=cp
|
11 |
|
|
endif
|
12 |
|
|
|
13 |
|
|
ifeq ($(origin MKDIR), undefined)
|
14 |
|
|
MKDIR=mkdir -p
|
15 |
|
|
endif
|
16 |
|
|
|
17 |
|
|
ifeq ($(origin MOVE_IF_CHANGE), undefined)
|
18 |
|
|
MOVE_IF_CHANGE=mv -f
|
19 |
|
|
endif
|
20 |
|
|
|
21 |
|
|
ada_extra_files : $(ADA_GEN_SUBDIR)/treeprs.ads $(ADA_GEN_SUBDIR)/einfo.h $(ADA_GEN_SUBDIR)/sinfo.h $(ADA_GEN_SUBDIR)/nmake.adb \
|
22 |
|
|
$(ADA_GEN_SUBDIR)/nmake.ads $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb $(ADA_GEN_SUBDIR)/snames.h
|
23 |
|
|
|
24 |
|
|
# We delete the files before copying, below, in case they are read-only.
|
25 |
|
|
|
26 |
|
|
$(ADA_GEN_SUBDIR)/treeprs.ads : $(ADA_GEN_SUBDIR)/treeprs.adt $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/xtreeprs.adb
|
27 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/treeprs
|
28 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/treeprs/,$(notdir $^))
|
29 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/treeprs
|
30 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs ../../treeprs.ads )
|
31 |
|
|
|
32 |
|
|
$(ADA_GEN_SUBDIR)/einfo.h : $(ADA_GEN_SUBDIR)/einfo.ads $(ADA_GEN_SUBDIR)/einfo.adb $(ADA_GEN_SUBDIR)/xeinfo.adb
|
33 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/einfo
|
34 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/einfo/,$(notdir $^))
|
35 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/einfo
|
36 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo ../../einfo.h )
|
37 |
|
|
|
38 |
|
|
$(ADA_GEN_SUBDIR)/sinfo.h : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/xsinfo.adb
|
39 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/sinfo
|
40 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/sinfo/,$(notdir $^))
|
41 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/sinfo
|
42 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo ../../sinfo.h )
|
43 |
|
|
|
44 |
|
|
$(ADA_GEN_SUBDIR)/snames.h $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb : $(ADA_GEN_SUBDIR)/stamp-snames ; @true
|
45 |
|
|
$(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
|
46 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/snamest
|
47 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/snamest/,$(notdir $^))
|
48 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/snamest
|
49 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/snamest; gnatmake -q xsnamest ; ./xsnamest )
|
50 |
|
|
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.ns $(ADA_GEN_SUBDIR)/snames.ads
|
51 |
|
|
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nb $(ADA_GEN_SUBDIR)/snames.adb
|
52 |
|
|
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nh $(ADA_GEN_SUBDIR)/snames.h
|
53 |
|
|
touch $(ADA_GEN_SUBDIR)/stamp-snames
|
54 |
|
|
|
55 |
|
|
$(ADA_GEN_SUBDIR)/nmake.adb : $(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
|
56 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake_b
|
57 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake_b/,$(notdir $^))
|
58 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake_b
|
59 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/nmake_b; gnatmake -q xnmake ; ./xnmake -b ../../nmake.adb )
|
60 |
|
|
|
61 |
|
|
$(ADA_GEN_SUBDIR)/nmake.ads : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/nmake.adt $(ADA_GEN_SUBDIR)/xnmake.adb $(ADA_GEN_SUBDIR)/nmake.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
|
62 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake_s
|
63 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake_s/,$(notdir $^))
|
64 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake_s
|
65 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/nmake_s; gnatmake -q xnmake ; ./xnmake -s ../../nmake.ads )
|
66 |
|
|
|
67 |
|
|
ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
|
68 |
|
|
OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
|
69 |
|
|
-DTARGET='""$(target)""' s-oscons-tmplt.c
|
70 |
|
|
|
71 |
|
|
OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
|
72 |
|
|
-DTARGET='""$(target)""' s-oscons-tmplt.c ; \
|
73 |
|
|
ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
|
74 |
|
|
./s-oscons-tmplt.exe > s-oscons-tmplt.s
|
75 |
|
|
|
76 |
|
|
else
|
77 |
|
|
# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to ajust
|
78 |
|
|
# for running it from $(ADA_GEN_SUBDIR)/bldtools/oscons
|
79 |
|
|
OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
|
80 |
|
|
| sed -e 's^\./xgcc^../../../xgcc^' -e 's^-B./^-B../../../^'`
|
81 |
|
|
OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
|
82 |
|
|
-DTARGET=\"$(target)\" s-oscons-tmplt.c > s-oscons-tmplt.i
|
83 |
|
|
OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
|
84 |
|
|
endif
|
85 |
|
|
|
86 |
|
|
$(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
|
87 |
|
|
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/oscons
|
88 |
|
|
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/oscons/,$(notdir $^))
|
89 |
|
|
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/oscons
|
90 |
|
|
(cd $(ADA_GEN_SUBDIR)/bldtools/oscons ; gnatmake -q xoscons ; \
|
91 |
|
|
$(RM) s-oscons-tmplt.i s-oscons-tmplt.s ; \
|
92 |
|
|
$(OSCONS_CPP) ; \
|
93 |
|
|
$(OSCONS_EXTRACT) ; \
|
94 |
|
|
./xoscons ; \
|
95 |
|
|
$(RM) ../../s-oscons.ads ; \
|
96 |
|
|
$(CP) s-oscons.ads s-oscons.h ../../)
|
97 |
|
|
|
98 |
|
|
$(ADA_GEN_SUBDIR)/sdefault.adb: $(ADA_GEN_SUBDIR)/stamp-sdefault ; @true
|
99 |
|
|
$(ADA_GEN_SUBDIR)/stamp-sdefault : $(srcdir)/version.c Makefile
|
100 |
|
|
$(ECHO) "pragma Style_Checks (Off);" >tmp-sdefault.adb
|
101 |
|
|
$(ECHO) "with Osint; use Osint;" >>tmp-sdefault.adb
|
102 |
|
|
$(ECHO) "package body Sdefault is" >>tmp-sdefault.adb
|
103 |
|
|
$(ECHO) " S0 : constant String := \"$(prefix)/\";" >>tmp-sdefault.adb
|
104 |
|
|
$(ECHO) " S1 : constant String := \"$(ADA_INCLUDE_DIR)/\";" >>tmp-sdefault.adb
|
105 |
|
|
$(ECHO) " S2 : constant String := \"$(ADA_RTL_OBJ_DIR)/\";" >>tmp-sdefault.adb
|
106 |
|
|
$(ECHO) " S3 : constant String := \"$(target)/\";" >>tmp-sdefault.adb
|
107 |
|
|
$(ECHO) " S4 : constant String := \"$(libsubdir)/\";" >>tmp-sdefault.adb
|
108 |
|
|
$(ECHO) " function Include_Dir_Default_Name return String_Ptr is" >>tmp-sdefault.adb
|
109 |
|
|
$(ECHO) " begin" >>tmp-sdefault.adb
|
110 |
|
|
$(ECHO) " return Relocate_Path (S0, S1);" >>tmp-sdefault.adb
|
111 |
|
|
$(ECHO) " end Include_Dir_Default_Name;" >>tmp-sdefault.adb
|
112 |
|
|
$(ECHO) " function Object_Dir_Default_Name return String_Ptr is" >>tmp-sdefault.adb
|
113 |
|
|
$(ECHO) " begin" >>tmp-sdefault.adb
|
114 |
|
|
$(ECHO) " return Relocate_Path (S0, S2);" >>tmp-sdefault.adb
|
115 |
|
|
$(ECHO) " end Object_Dir_Default_Name;" >>tmp-sdefault.adb
|
116 |
|
|
$(ECHO) " function Target_Name return String_Ptr is" >>tmp-sdefault.adb
|
117 |
|
|
$(ECHO) " begin" >>tmp-sdefault.adb
|
118 |
|
|
$(ECHO) " return new String'(S3);" >>tmp-sdefault.adb
|
119 |
|
|
$(ECHO) " end Target_Name;" >>tmp-sdefault.adb
|
120 |
|
|
$(ECHO) " function Search_Dir_Prefix return String_Ptr is" >>tmp-sdefault.adb
|
121 |
|
|
$(ECHO) " begin" >>tmp-sdefault.adb
|
122 |
|
|
$(ECHO) " return Relocate_Path (S0, S4);" >>tmp-sdefault.adb
|
123 |
|
|
$(ECHO) " end Search_Dir_Prefix;" >>tmp-sdefault.adb
|
124 |
|
|
$(ECHO) "end Sdefault;" >> tmp-sdefault.adb
|
125 |
|
|
$(MOVE_IF_CHANGE) tmp-sdefault.adb $(ADA_GEN_SUBDIR)/sdefault.adb
|
126 |
|
|
touch $(ADA_GEN_SUBDIR)/stamp-sdefault
|