> I'm looking for a good suggestion how to structure Makefiles for sharing > sourcecode between a kernel driver and userspace utilities. > > What I plan to do is to have a directory in usr/src/common/ that > contains the "generic" code. The dependencies that this will have are > going to be satisfied by a set of wrapper functions _not_ in there, but > in a separate sourcefile, one each for the kernel driver and the > userspace utility. This would allow me to get away without using > #ifdefs ... > > Is it a better idea to have a static library built from the sources in > usr/src/common/, or to have both the userspace utility and kernel > driver Makefiles refer to ../../common/.../*.c ? How would the > Makefiles look like for either variant ? (I'm anything but an adept at > writing makefiles ...)
I'd recommend having both look in usr/src/common. As an example, check out hexascii_to_octet(), which is used by boot, the kernel (nfs_dlinet), and userland utilities (through libinetutil). You may not need to do something that involved, but it should show you one way to do it. -- meem _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
