Here are some notes for the bsd.compiler.mk first draft. It is a file which will be unconditionally included (early) in bsd.port.mk. It is based in part on the following (incomplete) GSoC work, with rework by me: http://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/projects/soc2010/clangports/ports/Mk/bsd.compiler.mk&REV=3 ------------------------------------------------------------------- The concept of PORTS_CC is introduced for optional use by the user. It may be set in e.g. /etc/make.conf to e.g. 'gcc', 'clang', or something else. If not set, it defaults to gcc (_not_ whatever is base cc; this is kind of the point :-) ) If set to 'gcc*', that value is extracted and used like USE_GCC is currently used. (See bsd.gcc.mk.) To be honest, I haven't taken that block of code apart to check it. If set to 'clang' or something else, CC and CXX are set to follow PORTS_CC. (But see "clang note", below.) The concept of USE_CC is introduced for optional use in a port Makefile. If undefined, CC and CXX are set to whatever PORTS_CC specifies. If set to 'base', CC and CXX are set to whatever the system default is (e.g. current behavior); this is needed for the ports lang/gcc* and lang/clang*, for example, to avoid chicken- and-egg. ------------------------------------------------------------------- I am quite sure that this patch is insufficient. Comments welcome. (clang note: there is code in bsd.gcc.mk to be able to depend on a particular version of gcc or "particular version or later". This functionality probably needs to be included for clang as well, but let's start with this code.) mcl Post Scriptum: I am not married to the string "PORTS_CC". It may be painted whatever color.