Deviced a general compilation routine