Fix building of optional packages
[ghc-hetmet.git] / rules / extra-packages.mk
index 7218a6f..e3af94f 100644 (file)
@@ -27,7 +27,7 @@
 #        add P to the list of packages
 
 define extra-packages
-$$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ ]\+ \+\(dph\|extra\) \+[^ ]\+ \+[^ ]\+ \+[^ ]\+' packages | sed 's/ .*//'))),\
+$$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ #][^ ]* \+\(dph\|extra\) \+[^ ]\+ \+[^ ]\+$$$$' packages | sed 's/ .*//'))),\
     $$(if $$(wildcard libraries/$$p/ghc-packages),\
         $$(eval BUILD_DIRS += libraries/$$p) \
         $$(foreach q,$$(shell cat libraries/$$p/ghc-packages2),$$(eval $$(call extra-package,$$p,$$p/$$q))),\
@@ -39,10 +39,6 @@ define extra-package # $1 = package root, $2 = package
 $(call trace, extra-package($1,$2))
 
 EXTRA_PACKAGES += $2
-ifeq "$(wildcard libraries/$1/ghc-stage2-package)" ""
 $$(eval $$(call addPackage,$2))
-else
-$$(eval $$(call addPackage2,$2))
-endif
 
 endef