Skip to content

Commit 4bf1340

Browse files
authored
Do not generate src/templates_parser-version.adb (#35)
Do not generate src/templates_parser-version.adb. Instead pass the version information via the Binder's environment to the source code. This way no code needs to be generated which makes the build process independent from make.
1 parent a77bcdf commit 4bf1340

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

Makefile

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,9 @@ force:
142142

143143
makefile.setup: setup
144144

145-
version_path := src/templates_parser-version.adb
146-
147-
setup: tp_xmlada.gpr $(version_path) force
145+
setup: tp_xmlada.gpr force
148146
printf " $(foreach v,$(ALL_OPTIONS),$(v) = $($(v))\n)" > makefile.setup
149147

150-
build: $(version_path)
151-
152-
$(version_path):
153-
echo "-- Generated, by ../Makefile" > $(version_path)
154-
echo "separate (Templates_Parser)" >> $(version_path)
155-
echo "function Version return String is" >> $(version_path)
156-
echo "begin" >> $(version_path)
157-
echo " return \"$(VERSION)\";" >> $(version_path)
158-
echo "end Version;" >> $(version_path)
159-
160148
#######################################################################
161149
# install
162150

@@ -194,7 +182,6 @@ endif
194182
$(MAKE) -C docs clean
195183
$(MAKE) -C regtests clean
196184
rm -f auto.cgpr config/setup/auto.cgpr
197-
rm -f src/templates_parser-version.adb
198185
rm -fr .build makefile.setup
199186
rm -f config/setup/foo.ali config/setup/foo.o tp_xmlada.gpr
200187
rm -f config/setup/foo.ads.std*

src/templates_parser-version.adb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
with GNAT.Bind_Environment;
2+
3+
separate (Templates_Parser)
4+
function Version return String is
5+
use GNAT;
6+
begin
7+
return Bind_Environment.Get ("version");
8+
end Version;

tp_shared.gpr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract project TP_Shared is
7373
------------
7474

7575
package Binder is
76-
for Default_Switches ("Ada") use ("-E");
76+
for Default_Switches ("Ada") use ("-E", "-Vversion=" & Version);
7777
end Binder;
7878

7979
-------------

0 commit comments

Comments
 (0)