[OpenAFS-devel] [RFC] splitting out CRULE_TARGET from libafs/Makefile.common

Benjamin Kaduk kaduk@MIT.EDU
Sat, 25 Jun 2011 00:57:44 -0400 (EDT)


Hi everyone,

In the course of my work to use the system makefile bsd.kmod.mk to build 
libafs.ko for FreeBSD, I have come to the conclusion that I need to modify 
the CRULE_OPT and CRULE_NOOPT variables that are used as the build rules 
for the object files listed in libafs/Makefile.common.  The system 
makefiles somehow add some extra items as dependencies of every target, 
which causes CRULE_OPT to become a command line such as:
gcc [...] -o afs_analyze.o -c afs_analyze.c vnode_if.h @ x86 machine
This fails, because it is not possible to specify multiple sources when -c 
and -o are both given.
For FreeBSD, I can remove the extra sources by using make variable 
expansion rules to pull out just the .c file, but obviously these are not 
available in all makes.

I am not particularly inclined to redefine CRULE_{NO,}OPT in 
MakefileProto.FBSD.in after including Makefile.common, because if these 
variables are changed in Makefile.common in the future, it is likely that 
the FreeBSD-specific definition will be missed at that time.  Instead, I 
have introduced a new variable, CRULE_TARGET, which is defined in the 
individual MakefileProtos, that Makefile.common uses as the source file 
for its CC invocation in CRULE_{NO,}OPT.  This variable can then be 
tweaked as appropriate for each OS, allowing me to use the extra features 
of FreeBSD's make.

The patch is submitted as gerrit.openafs.org/4885
I request your comments.

-Ben