         let umbrellaHeader = Path.join(includeDir, c99name, "\(c99name).h")
         if umbrellaHeader.isFile {
             guard dirs.count == 1 && files.isEmpty else { throw ModuleMapError.unsupportedIncludeLayoutForModule(name) }
-            try createModuleMap(inDir: wd, type: .header(umbrellaHeader))
+            try createModuleMap(inDir: wd, type: .header(umbrellaHeader), modulemapStyle: modulemapStyle)
             return
         }
         diagnoseInvalidUmbrellaHeader(Path.join(includeDir, c99name))
 
-        try createModuleMap(inDir: wd, type: .directory(includeDir))
+        try createModuleMap(inDir: wd, type: .directory(includeDir), modulemapStyle: modulemapStyle)
     }
 
     ///warn user if in case module name and c99name are different and there a `name.h` umbrella header

        let umbrellaHeaderFlat = Path.join(includeDir, "\(c99name).h")
        if umbrellaHeaderFlat.isFile {
            guard dirs.isEmpty else { throw ModuleMapError.unsupportedIncludeLayoutForModule(name) }
            try createModuleMap(inDir: wd, type: .header(umbrellaHeaderFlat))
            return
        }
        diagnoseInvalidUmbrellaHeader(includeDir)

        case directory(String)
    }
    
    private func createModuleMap(inDir wd: String, type: UmbrellaType, modulemapStyle: ModuleMapStyle) throws {
        try Utility.makeDirectories(wd)
        let moduleMapFile = Path.join(wd, self.moduleMap)
        let moduleMap = try fopen(moduleMapFile, mode: .write)
        defer { moduleMap.closeFile() }
        
        var output = ""
        if let qualifier = modulemapStyle.moduleDeclQualifier {
            output += qualifier + " "
        }
        output += "module \(c99name) {\n"
        switch type {
        case .header(let header):
            output += "    umbrella header \"\(header)\"\n"
        case .directory(let path):
            output += "    umbrella \"\(path)\"\n"
        }
        output += "    \(modulemapStyle.linkDeclFlag) \"\(c99name)\"\n"
        output += "    export *\n"
        output += "}\n"

