task make(type: Exec) { outputs.file 'tpm_module' inputs.dir fileTree(dir: '.').include('main.cpp').include('*.hpp') commandLine 'make' } task cleanUp() { delete 'tpm_module', 'main.d', 'main.o' } task fullBuild(type: GradleBuild) { tasks = ['cleanUp', 'make'] } build.dependsOn tasks.fullBuild