not perfect, not sure makefiles are the ideal solution