Installing Generated Header Files
Neal H. Walfield
neal at walfield.org
Fri Jun 29 12:45:33 CEST 2007
Hi,
I'm using BID and generating header files at compile time. I looked
at the include role, however, as far as I can tell, it only installs
files from the source tree, not from the object tree. The attached
patch improves the include role-file to allow this mode of operation.
The patch consists of two changes. First, before listing the
directory, we change to $(INCSRC_DIR). (This also requires evaluating
TARGET_CMD lazily, i.e., using a recursive variable, not a simple one,
as INCSRC_DIR may be set later.) Second, an additional target has
been added, headers, which can depend on generated header files. I
also updated the documentation.
The current patch doesn't allow installing header files from both the
source directory and the object directory. This might be useful,
however, it appears to require modifying the perl code, which I have
done my best to forget.
Thanks,
Neal
Index: mk/include.mk
===================================================================
--- mk/include.mk (revision 74)
+++ mk/include.mk (working copy)
@@ -27,9 +27,9 @@
ifeq ($(origin TARGET),undefined)
# use POSIX -print here
-TARGET_CMD := find . -name '*.[ih]' -print
+TARGET_CMD = (cd $(INCSRC_DIR); find . -name '*.[ih]' -print)
else
-TARGET_CMD := echo $(TARGET)
+TARGET_CMD = echo $(TARGET)
endif
INSTALL_INC_PREFIX ?= l4/$(PKGNAME)
INCSRC_DIR ?= $(SRC_DIR)
@@ -64,7 +64,9 @@
} \
}'
-all::
+headers::
+
+all:: headers
@$(TARGET_CMD) | $(call installscript,1)
install::
Index: doc/bid-spec/spec.tex
===================================================================
--- doc/bid-spec/spec.tex (revision 73)
+++ doc/bid-spec/spec.tex (working copy)
@@ -2274,22 +2274,32 @@
\subsubsection{Purpose}
-The purpose of the include role is to install the local include-files
-into the local install-tree or into the drops install-tree. The
-role-file achieves two goals when managing include-files:
+The purpose of the include role is to install all .h and .i under
+INCSRC_DIR into the local install-tree or into the drops
+install-tree. This role facilitates two goals with respect to managing
+include-files:
+
\begin{enumerate}
-\item The path where the include-files are to be found in is entirely
+\item The path where the include-files are found is entirely
defined by the package name and the target system of the
include-files.
-\item Once written, the makefile needs not to be modified, even if new
- include files are added or old include files are removed from the package.
+\item Once written, the make file need not be modified, even when new
+ include files are added or old include files are removed from the
+ package.
\end{enumerate}
The target system of an include file is determined by putting it into
-a specific subdirectory. The role-file will install it accordingly
-then. The following table defines the subdirectories depending on the
-target systems.
+a specific subdirectory. The role-file will then install it
+accordingly. By default, INCSRC_DIR points is set to the source
+directory. To install generated header files, set INCSRC_DIR to
+§OBJ_DIR. There is currently no mechanism to exclude header files.
+When generating header files, add them to the headers target (which
+all depends on).
+
+The following table defines the subdirectories depending on the target
+systems.
+
\begin{center}
\begin{tabular}{|l|l|}
\hline
More information about the l4-hackers
mailing list