Rombobjörn

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comfignat.gpr.gp39
-rw-r--r--comfignat.mk30
2 files changed, 58 insertions, 11 deletions
diff --git a/comfignat.gpr.gp b/comfignat.gpr.gp
index e024f90..e7acd58 100644
--- a/comfignat.gpr.gp
+++ b/comfignat.gpr.gp
@@ -1,5 +1,5 @@
-- Comfignat configuration variables for GNAT project files
--- Copyright 2013 - 2016 B. Persson, Bjorn@Rombobeorn.se
+-- Copyright 2013 - 2025 B. Persson, Bjorn@Rombobeorn.se
--
-- This material is provided as is, with absolutely no warranty expressed
-- or implied. Any use is at your own risk.
@@ -11,9 +11,9 @@
-- modified is included with the above copyright notice.
--- This file is part of Comfignat 1.5 – common, convenient, command-line-
+-- This file is part of Comfignat 1.6 – common, convenient, command-line-
-- controlled compile-time configuration of software built with the GNAT tools.
--- For information about Comfignat, see http://www.Rombobeorn.se/Comfignat/.
+-- For information about Comfignat, see https://www.Rombobeorn.se/Comfignat/.
-- This project file defines directory variables for use in build-controlling
@@ -229,6 +229,39 @@ abstract project Comfignat is
--
+ -- The following variables are convenient to use in Compiler'Switches or
+ -- Compiler'Default_Switches in project files.
+ --
+ -- There are no switch variables for:
+ -- · Unitdir, Userunitdir and GPRdir: A program working on such files would
+ -- need to use a search path, not just one directory.
+ -- · Includedir, Archincludedir and Alidir: Libraries have those pathnames
+ -- in usage project files. There doesn't seem to be a usecase for
+ -- compiling them into binaries.
+
+ Bindir_Switch := "-gnateDBindir=""" & Bindir & """";
+ Libexecdir_Switch := "-gnateDLibexecdir=""" & Libexecdir & """";
+ Datadir_Switch := "-gnateDDatadir=""" & Datadir & """";
+ Sysconfdir_Switch := "-gnateDSysconfdir=""" & Sysconfdir & """";
+ Statedir_Switch := "-gnateDStatedir=""" & Statedir & """";
+ Cachedir_Switch := "-gnateDCachedir=""" & Cachedir & """";
+ Logdir_Switch := "-gnateDLogdir=""" & Logdir & """";
+ Runstatedir_Switch := "-gnateDRunstatedir=""" & Runstatedir & """";
+ Lockdir_Switch := "-gnateDLockdir=""" & Lockdir & """";
+ Libdir_Switch := "-gnateDLibdir=""" & Libdir & """";
+ Localedir_Switch := "-gnateDLocaledir=""" & Localedir & """";
+ Mandir_Switch := "-gnateDMandir=""" & Mandir & """";
+ Infodir_Switch := "-gnateDInfodir=""" & Infodir & """";
+ Miscdocdir_Switch := "-gnateDMiscdocdir=""" & Miscdocdir & """";
+
+ All_Dir_Switches :=
+ (Bindir_Switch, Libexecdir_Switch, Datadir_Switch, Sysconfdir_Switch,
+ Statedir_Switch, Cachedir_Switch, Logdir_Switch, Runstatedir_Switch,
+ Lockdir_Switch, Libdir_Switch, Localedir_Switch, Mandir_Switch,
+ Infodir_Switch, Miscdocdir_Switch);
+
+
+ --
-- The following variables are for use in attributes to control where
-- generated files are placed.
--
diff --git a/comfignat.mk b/comfignat.mk
index b71efb2..a574a17 100644
--- a/comfignat.mk
+++ b/comfignat.mk
@@ -1,5 +1,5 @@
# Comfignat makefile foundation for configuring and building GNAT projects
-# Copyright 2013 - 2016 B. Persson, Bjorn@Rombobeorn.se
+# Copyright 2013 - 2025 B. Persson, Bjorn@Rombobeorn.se
#
# This material is provided as is, with absolutely no warranty expressed
# or implied. Any use is at your own risk.
@@ -11,9 +11,9 @@
# modified is included with the above copyright notice.
-# This file is part of Comfignat 1.5 – common, convenient, command-line-
+# This file is part of Comfignat 1.6 – common, convenient, command-line-
# controlled compile-time configuration of software built with the GNAT tools.
-# For information about Comfignat, see http://www.Rombobeorn.se/Comfignat/.
+# For information about Comfignat, see https://www.Rombobeorn.se/Comfignat/.
# This file contains generic Make code. It is designed to be included by other
@@ -168,6 +168,8 @@ cachedir = ${localstatedir}/cache
logdir = ${localstatedir}/log
runstatedir = /run
lockdir = ${runstatedir}/lock
+unitdir = ${prefix}/lib/systemd/system
+userunitdir = ${prefix}/lib/systemd/user
includedir = ${prefix}/include
archincludedir = ${includedir}
libdir = ${exec_prefix}/lib
@@ -233,6 +235,8 @@ stage_sysconfdir = ${stagedir}${sysconfdir}
stage_statedir = ${stagedir}${statedir}
stage_cachedir = ${stagedir}${cachedir}
stage_logdir = ${stagedir}${logdir}
+stage_unitdir = ${stagedir}${unitdir}
+stage_userunitdir = ${stagedir}${userunitdir}
stage_includedir = ${stagedir}${includedir}
stage_archincludedir = ${stagedir}${archincludedir}
stage_libdir = ${stagedir}${libdir}
@@ -257,6 +261,8 @@ Make_sysconfdir = ${call Make_pathname,stage_sysconfdir}
Make_statedir = ${call Make_pathname,stage_statedir}
Make_cachedir = ${call Make_pathname,stage_cachedir}
Make_logdir = ${call Make_pathname,stage_logdir}
+Make_unitdir = ${call Make_pathname,stage_unitdir}
+Make_userunitdir = ${call Make_pathname,stage_userunitdir}
Make_includedir = ${call Make_pathname,stage_includedir}
Make_archincludedir = ${call Make_pathname,stage_archincludedir}
Make_libdir = ${call Make_pathname,stage_libdir}
@@ -281,9 +287,7 @@ preprocess_file = "${GNATPREP}" ${firstword ${filter %.gp,$^}} $@ \
# it as Gnatprep symbols. Otherwise srcdir is conveyed, as it's needed by
# preprocessed build projects.
-build_GPR = "${GNAT_BUILDER}" -P ${firstword ${filter %.gpr,$^}} \
- ${addprefix -aP,${VPATH}} -p \
- ${options_building} ${builder_arguments} ${GNATFLAGS}
+build_GPR = ${call build_specified_GPR,${firstword ${filter %.gpr,$^}}}
# build_GPR is a command for use in recipes. It performs a build controlled by
# the first project file among the rule's prerequisites.
@@ -415,6 +419,7 @@ configuration_variables += \
prefix exec_prefix datarootdir localstatedir \
bindir libexecdir \
datadir sysconfdir statedir cachedir logdir runstatedir lockdir \
+ unitdir userunitdir \
includedir archincludedir libdir alidir gprdir \
localedir mandir infodir miscdocdir \
objdir stagedir \
@@ -614,6 +619,9 @@ preprocessed_files_in_builddir = ${addprefix ${Make_builddir}/,${preprocessed_fi
# preprocessed files are assumed to be needed during the build and are written
# to builddir.
+build_specified_GPR = "${GNAT_BUILDER}" -P ${1} ${addprefix -aP,${VPATH}} -p \
+ ${options_building} ${builder_arguments} ${GNATFLAGS}
+
#
# Make rules:
@@ -715,11 +723,17 @@ ${Make_gprdir}/%: % | ${Make_gprdir}/
preprocess: $${preprocessed_files_in_builddir}
# How to build a project:
-%.gpr.phony_target: %.gpr preprocess
- ${build_GPR}
+%.gpr.phony_target: preprocess
+ ${call build_specified_GPR,${basename $@}}
# Instead of tracking dependencies between project files, this rule simply
# requires that all preprocessing of files that are needed during the build is
# done before any project is built.
+# "%.gpr" isn't mentioned as a prerequisite because that stopped working in GNU
+# Make 4.4. This rule is phony so that the builder is always run and gets to
+# determine whether the project needs rebuilding. Thus there's no need to have
+# Make check whether the project file has been changed. The dependency on
+# preprocess ensures that the project file is generated if needed, and its name
+# is known from the target name.
.PHONY: base
base: $${build_targets} preprocess