Import some more CM core/Makefile additions/fixes