More build system changes; hasktags is now built with Cabal
authorIan Lynagh <igloo@earth.li>
Fri, 18 Jul 2008 15:34:59 +0000 (15:34 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 18 Jul 2008 15:34:59 +0000 (15:34 +0000)
mk/cabal.mk [new file with mode: 0644]
utils/Makefile
utils/ghc-pkg/Makefile
utils/hasktags/Makefile
utils/hasktags/hasktags.cabal [new file with mode: 0644]
utils/hsc2hs/Makefile

diff --git a/mk/cabal.mk b/mk/cabal.mk
new file mode 100644 (file)
index 0000000..5e0de0d
--- /dev/null
@@ -0,0 +1,55 @@
+
+include $(TOP)/mk/cabal-flags.mk
+
+# XXX We would like to turn this on, but Cabal generates paths files
+#     that are not -Wall clean!
+# SRC_HC_OPTS      += -Wall
+
+ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
+INSTALL_FLAGS =
+else
+ifeq "$(ENABLE_SHELL_WRAPPERS)" "YES"
+INSTALL_FLAGS = --enable-shell-wrappers
+else
+INSTALL_FLAGS =
+endif
+endif
+
+.PHONY: default all with-bootstrapping-compiler with-stage-1 clean distclean
+
+default all: with-bootstrapping-compiler
+
+with-bootstrapping-compiler:
+       $(CABAL) configure --distpref dist-inplace         \
+                          $(INPLACE_DIRS_CONFIGURE_FLAGS) \
+                          $(USE_BOOT_CONFIGURE_FLAGS)     \
+                          $(COMMON_CONFIGURE_FLAGS)
+       $(CABAL) build     --distpref dist-inplace $(BUILD_FLAGS)
+       $(CABAL) install   --distpref dist-inplace $(INSTALL_FLAGS)
+
+with-stage-1:
+       $(CABAL) configure --distpref dist-install         \
+                          $(INSTALL_DIRS_CONFIGURE_FLAGS) \
+                          $(USE_STAGE1_CONFIGURE_FLAGS)   \
+                          $(COMMON_CONFIGURE_FLAGS)
+       $(CABAL) build     --distpref dist-install $(BUILD_FLAGS)
+
+install:
+       $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
+                          '$(prefix)' '$(bindir)' '$(libdir)'            \
+                       '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
+                       '$(docdir)' '$(htmldir)' '$(haddockdir)'       \
+                          --distpref dist-install                        \
+                          $(INSTALL_FLAGS)
+
+clean: distclean
+
+distclean:
+       -$(CABAL) clean --distpref dist-inplace
+       -$(CABAL) clean --distpref dist-install
+ifneq "$(EXTRA_CLEAN)" ""
+       $(RM) -f $(EXTRA_CLEAN)
+endif
+
+# XXX fix binary-dist
+
index 4ecbd72..9f2b1b0 100644 (file)
@@ -3,12 +3,12 @@ include $(TOP)/mk/boilerplate.mk
 
 ifeq "$(DOING_BIN_DIST)" "YES"
 # We're doing a binary-dist, descend into a subset of the dirs.
 
 ifeq "$(DOING_BIN_DIST)" "YES"
 # We're doing a binary-dist, descend into a subset of the dirs.
-SUBDIRS = mkdirhier hasktags hp2ps parallel unlit runghc hpc pwd
+SUBDIRS = mkdirhier hp2ps parallel unlit runghc hpc pwd
 else
 ifeq "$(BootingFromHc)" "YES"
 SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode unlit
 else
 else
 ifeq "$(BootingFromHc)" "YES"
 SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode unlit
 else
-SUBDIRS = mkdependC mkdirhier runstdtest hasktags hp2ps \
+SUBDIRS = mkdependC mkdirhier runstdtest hp2ps \
          installPackage parallel unlit genprimopcode genapply runghc hpc pwd
 endif
 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
          installPackage parallel unlit genprimopcode genapply runghc hpc pwd
 endif
 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
@@ -55,11 +55,14 @@ endif
 
 WITH_BOOTSTRAPPING_COMPILER = ghc-pkg hsc2hs
 
 
 WITH_BOOTSTRAPPING_COMPILER = ghc-pkg hsc2hs
 
-WITH_STAGE1 = ghc-pkg
+WITH_STAGE1 = ghc-pkg hasktags
 ifneq "$(NO_INSTALL_HSC2HS)" "YES"
 WITH_STAGE1 += hsc2hs
 endif
 
 ifneq "$(NO_INSTALL_HSC2HS)" "YES"
 WITH_STAGE1 += hsc2hs
 endif
 
+# sort removes duplicates - we don't actually care about the order
+WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE1))
+
 with-bootstrapping-compiler: \
     $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
 
 with-bootstrapping-compiler: \
     $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
 
index 6f62b63..61e4893 100644 (file)
@@ -1,51 +1,13 @@
 
 TOP=../..
 
 TOP=../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/cabal-flags.mk
-
-SRC_HC_OPTS += -Wall
-
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-INSTALL_FLAGS =
-else
-INSTALL_FLAGS = --enable-shell-wrappers
-endif
+ENABLE_SHELL_WRAPPERS = YES
+EXTRA_CLEAN = Version.hs
 
 
-default all: with-bootstrapping-compiler
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/cabal.mk
 
 with-bootstrapping-compiler: Version.hs
 
 with-bootstrapping-compiler: Version.hs
-       $(CABAL) configure --distpref dist-inplace         \
-                          $(INPLACE_DIRS_CONFIGURE_FLAGS) \
-                          $(USE_BOOT_CONFIGURE_FLAGS)     \
-                          $(COMMON_CONFIGURE_FLAGS)
-       $(CABAL) build     --distpref dist-inplace $(BUILD_FLAGS)
-       $(CABAL) install   --distpref dist-inplace $(INSTALL_FLAGS)
-
 with-stage-1: Version.hs
 with-stage-1: Version.hs
-       $(CABAL) configure --distpref dist-install         \
-                          $(INSTALL_DIRS_CONFIGURE_FLAGS) \
-                          $(USE_STAGE1_CONFIGURE_FLAGS)   \
-                          $(COMMON_CONFIGURE_FLAGS)
-       $(CABAL) build     --distpref dist-install $(BUILD_FLAGS)
-
-install:
-       $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
-                          '$(prefix)' '$(bindir)' '$(libdir)'            \
-                       '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
-                       '$(docdir)' '$(htmldir)' '$(haddockdir)'
-                          --distpref dist-install                        \
-                          $(INSTALL_FLAGS)
-
-clean: distclean
-
-distclean:
-       -$(CABAL) clean --distpref dist-inplace
-       -$(CABAL) clean --distpref dist-install
-       $(RM) -f Version.hs
-
-# XXX fix binary-dist
-
-##### Here down is unique to ghc-pkg
 
 Version.hs: Makefile $(TOP)/mk/config.mk
        $(RM) -f Version.hs
 
 Version.hs: Makefile $(TOP)/mk/config.mk
        $(RM) -f Version.hs
index 20c52ba..0f34de9 100644 (file)
@@ -1,32 +1,5 @@
+
 TOP=../..
 include $(TOP)/mk/boilerplate.mk
 TOP=../..
 include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/cabal.mk
 
 
-# Beyond stage 1, honour any Mac OS X depolyment target options.  If we use 
-# these options in stage 1 we get a linker error if the bootstrap compiler is
-#  for a more recent OS version
-ifeq "$(stage)" "2"
-SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
-SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
-SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
-endif
-
-# We have two version: the inplace version compiled by the bootstrap compiler
-#   and the install version compiled by the stage 1 compiler
-ifeq "$(stage)" "2"
-HS_PROG           = hasktags
-else
-HS_PROG           = hasktags-inplace
-endif
-
-CLEAN_FILES += Main.hi
-
-SRC_HC_OPTS += -Wall
-
-INSTALL_PROGS += $(HS_PROG)
-
-binary-dist:
-       $(INSTALL_DIR)                $(BIN_DIST_DIR)/utils/hasktags
-       $(INSTALL_DATA)    Makefile   $(BIN_DIST_DIR)/utils/hasktags/
-       $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/hasktags/
-
-include $(TOP)/mk/target.mk
diff --git a/utils/hasktags/hasktags.cabal b/utils/hasktags/hasktags.cabal
new file mode 100644 (file)
index 0000000..045256d
--- /dev/null
@@ -0,0 +1,19 @@
+Name: hasktags
+-- XXX version number:
+Version: 0.67
+Copyright: XXX
+License: BSD3
+-- XXX License-File: LICENSE
+Author: XXX
+Maintainer: XXX
+Synopsis: XXX
+Description:
+       XXX
+Category: Development
+build-type: Simple
+cabal-version: >=1.2
+
+Executable hasktags
+    Main-Is: HaskTags.hs
+    Build-Depends: haskell98, base
+
index 66fb9de..1856d27 100644 (file)
@@ -1,54 +1,7 @@
 
 TOP=../..
 
 TOP=../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/cabal-flags.mk
-
-# XXX We would like to turn this on, but Cabal generates paths files
-#     that are not -Wall clean!
-# SRC_HC_OPTS      += -Wall
-
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-INSTALL_FLAGS =
-else
-INSTALL_FLAGS = --enable-shell-wrappers
-endif
-
-default all: with-bootstrapping-compiler
-
-with-bootstrapping-compiler:
-       $(CABAL) configure --distpref dist-inplace         \
-                          $(INPLACE_DIRS_CONFIGURE_FLAGS) \
-                          $(USE_BOOT_CONFIGURE_FLAGS)     \
-                          $(COMMON_CONFIGURE_FLAGS)
-       $(CABAL) build     --distpref dist-inplace $(BUILD_FLAGS)
-       $(CABAL) install   --distpref dist-inplace $(INSTALL_FLAGS)
+ENABLE_SHELL_WRAPPERS = YES
 
 
-with-stage-1:
-       $(CABAL) configure --distpref dist-install         \
-                          $(INSTALL_DIRS_CONFIGURE_FLAGS) \
-                          $(USE_STAGE1_CONFIGURE_FLAGS)   \
-                          $(COMMON_CONFIGURE_FLAGS)
-       $(CABAL) build     --distpref dist-install $(BUILD_FLAGS)
-
-install:
-       $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
-                          '$(prefix)' '$(bindir)' '$(libdir)'            \
-                       '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
-                       '$(docdir)' '$(htmldir)' '$(haddockdir)'
-                          --distpref dist-install                        \
-                          $(INSTALL_FLAGS)
-
-clean: distclean
-
-distclean:
-       -$(CABAL) clean --distpref dist-inplace
-       -$(CABAL) clean --distpref dist-install
-
-# XXX fix:
-#binary-dist:
-#      $(INSTALL_DIR)                      $(BIN_DIST_DIR)/utils/hsc2hs
-#      $(INSTALL_DATA)    Makefile         $(BIN_DIST_DIR)/utils/hsc2hs/
-#      $(INSTALL_DATA)    hsc2hs.sh        $(BIN_DIST_DIR)/utils/hsc2hs/
-#      $(INSTALL_DATA)    $(INSTALL_DATAS) $(BIN_DIST_DIR)/utils/hsc2hs/
-#      $(INSTALL_PROGRAM) $(HS_PROG)       $(BIN_DIST_DIR)/utils/hsc2hs/
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/cabal.mk