fix installation of header files (#3451)
authorSimon Marlow <marlowsd@gmail.com>
Thu, 10 Sep 2009 12:18:31 +0000 (12:18 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 10 Sep 2009 12:18:31 +0000 (12:18 +0000)
includes/ghc.mk

index 50107ed..007ce4b 100644 (file)
@@ -20,7 +20,7 @@ includes_H_PLATFORM = includes/ghcplatform.h
 #
 # All header files
 #
-includes_H_FILES = $(filter-out $(includes_H_CONFIG) $(includes_H_PLATFORM),$(wildcard includes/*.h))
+includes_H_FILES = $(filter-out $(includes_H_CONFIG) $(includes_H_PLATFORM),$(wildcard includes/*.h includes/*/*.h includes/*/*/*.h))
 
 #
 # Options
@@ -172,8 +172,6 @@ endif
 # ---------------------------------------------------------------------------
 # Install all header files
 
-INSTALL_HEADERS += $(includes_H_FILES) $(includes_H_CONFIG) $(includes_H_PLATFORM)
-
 $(eval $(call clean-target,includes,,\
   $(includes_H_CONFIG) $(includes_H_PLATFORM) \
   $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS)))
@@ -182,3 +180,16 @@ $(eval $(call all-target,includes,,\
   $(includes_H_CONFIG) $(includes_H_PLATFORM) \
   $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS)))
 
+includes_subdirs = $(sort $(subst includes/,,$(foreach d,$(includes_H_FILES),$(dir $(d)))))
+
+install: install_includes
+
+.PHONY: install_includes
+install_includes :
+       $(INSTALL_DIR) $(DESTDIR)$(ghcheaderdir)
+       for d in $(includes_subdirs); do \
+               $(INSTALL_DIR) $(DESTDIR)$(ghcheaderdir)/$$d; \
+       done
+       for i in $(subst includes/,,$(includes_H_FILES) $(includes_H_CONFIG) $(includes_H_PLATFORM)); do \
+               $(INSTALL_HEADER) $(INSTALL_OPTS) includes/$$i $(DESTDIR)$(ghcheaderdir)/$$i; \
+       done