+sub read_MODULES {
+ local($flavor,$lib) = @_;
+
+ local($m_dir) = '';
+ if ($flavor eq 'prelude') {
+ $m_dir = ( $(INSTALLING) ) ? "$InstDataDirGhc/imports" : "$TopPwd/$(CURRENT_DIR)/$(GHC_LIBSRC)";
+ } else {
+ $m_dir = ( $(INSTALLING) ) ? "$InstSysLibDir/$lib" : "$TopPwd/hslibs/$lib";
+ }
+ local($m_file) = "$m_dir/MODULES";
+
+ open(MFILE, "< $m_file") || die "$Pgm: can't open $m_file to read\n";
+ while (<MFILE>) {
+ chop;
+ # strip comments and leading/trailing whitespace
+ s/#.*//;
+ s/^\s+//;
+ s/\s+$//;
+ next if /^$/; # nothing left!
+
+ $LibIfaces{"$lib:$_"} = 1; # record that this library provides this iface
+ }
+ close(MFILE);
+}
+