Build system refactoring
authorIan Lynagh <ian@well-typed.com>
Sat, 20 Apr 2013 13:16:27 +0000 (14:16 +0100)
committerIan Lynagh <ian@well-typed.com>
Sat, 20 Apr 2013 16:10:10 +0000 (17:10 +0100)
.gitignore
configure.ac
gmp/ghc.mk
mkGmpDerivedConstants/Makefile [new file with mode: 0644]
mkGmpDerivedConstants/ghc.mk [new file with mode: 0644]
mkGmpDerivedConstants/mkGmpDerivedConstants.c [moved from cbits/mkGmpDerivedConstants.c with 100% similarity]

index 012224d..a5e5768 100644 (file)
@@ -4,7 +4,7 @@ config.log
 config.status
 configure
 dist-install/
-ghc.mk
+^/ghc.mk
 gmp/config.mk
 integer-gmp.buildinfo
 cbits/GmpDerivedConstants.h
index 5593ca2..b91154a 100644 (file)
@@ -1,7 +1,7 @@
 AC_INIT([Haskell integer (GMP)], [0.1], [libraries@haskell.org], [integer])
 
 # Safety check: Ensure that we are in the correct source directory.
-AC_CONFIG_SRCDIR([cbits/mkGmpDerivedConstants.c])
+AC_CONFIG_SRCDIR([cbits/gmp-wrappers.cmm])
 
 AC_CANONICAL_TARGET
 
index d98eb8e..54b6d08 100644 (file)
@@ -49,14 +49,10 @@ ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
 include libraries/integer-gmp/gmp/config.mk
 endif
 
-libraries/integer-gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS))
-libraries/integer-gmp_CC_OPTS += $(addprefix -L,$(GMP_LIB_DIRS))
+libraries/integer-gmp_dist-install_EXTRA_HC_OPTS += -Ilibraries/integer-gmp/mkGmpDerivedConstants/dist
 
-libraries/integer-gmp/cbits/mkGmpDerivedConstants$(exeext): libraries/integer-gmp/cbits/mkGmpDerivedConstants.c
-       "$(CC_STAGE1)" $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) $(libraries/integer-gmp_CC_OPTS) $< -o $@
-
-libraries/integer-gmp/cbits/GmpDerivedConstants.h: libraries/integer-gmp/cbits/mkGmpDerivedConstants$(exeext)
-       $< > $@
+gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS))
+gmp_CC_OPTS += $(addprefix -L,$(GMP_LIB_DIRS))
 
 # Compile GMP only if we don't have it already
 #
@@ -82,8 +78,8 @@ endif
 endif
 
 define GmpDerivedConstants-dependencies # args: $1 = way
-$$(libraries/integer-gmp_dist-install_$1_CMM_OBJS): libraries/integer-gmp/cbits/GmpDerivedConstants.h
-$$(libraries/integer-gmp_dist-install_$1_C_OBJS):   libraries/integer-gmp/cbits/GmpDerivedConstants.h
+$$(libraries/integer-gmp_dist-install_$1_CMM_OBJS): $$$$(GmpDerivedConstants_HEADER)
+$$(libraries/integer-gmp_dist-install_$1_C_OBJS):   $$$$(GmpDerivedConstants_HEADER)
 endef
 
 $(foreach w,$(GhcLibWays),$(eval $(call GmpDerivedConstants-dependencies,$w)))
@@ -92,9 +88,8 @@ ifneq "$(HaveLibGmp)" "YES"
 ifneq "$(HaveFrameworkGMP)" "YES"
 $(libraries/integer-gmp_dist-install_depfile_c_asm): libraries/integer-gmp/gmp/gmp.h
 
-libraries/integer-gmp/cbits/mkGmpDerivedConstants$(exeext): libraries/integer-gmp/gmp/gmp.h
-
-libraries/integer-gmp_CC_OPTS += -I$(TOP)/libraries/integer-gmp/gmp
+gmp_CC_OPTS += -Ilibraries/integer-gmp/gmp
+gmp_CC_OPTS += -Ilibraries/integer-gmp/mkGmpDerivedConstants/dist
 
 libraries/integer-gmp_dist-install_EXTRA_OBJS += libraries/integer-gmp/gmp/objs/*.o
 
@@ -110,6 +105,8 @@ libraries/integer-gmp_dist-install_EXTRA_OBJS += libraries/integer-gmp/gmp/objs/
 endif
 endif
 
+libraries/integer-gmp_dist-install_EXTRA_CC_OPTS += $(gmp_CC_OPTS)
+
 # 2007-09-26
 #     set -o igncr 
 # is not a valid command on non-Cygwin-systems.
diff --git a/mkGmpDerivedConstants/Makefile b/mkGmpDerivedConstants/Makefile
new file mode 100644 (file)
index 0000000..0650bb3
--- /dev/null
@@ -0,0 +1,15 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2009 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+dir = libraries/integer-gmp/mkGmpDerivedConstants
+TOP = ../../..
+include $(TOP)/mk/sub-makefile.mk
diff --git a/mkGmpDerivedConstants/ghc.mk b/mkGmpDerivedConstants/ghc.mk
new file mode 100644 (file)
index 0000000..9903aa6
--- /dev/null
@@ -0,0 +1,26 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2009 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+libraries/integer-gmp/mkGmpDerivedConstants_dist_C_SRCS          = mkGmpDerivedConstants.c
+libraries/integer-gmp/mkGmpDerivedConstants_dist_PROGNAME        = mkGmpDerivedConstants
+libraries/integer-gmp/mkGmpDerivedConstants_dist_TOPDIR          = YES
+libraries/integer-gmp/mkGmpDerivedConstants_dist_INSTALL         = YES
+libraries/integer-gmp/mkGmpDerivedConstants_dist_INSTALL_INPLACE = YES
+libraries/integer-gmp/mkGmpDerivedConstants_dist_EXTRA_CC_OPTS += $(gmp_CC_OPTS)
+
+$(eval $(call build-prog,libraries/integer-gmp/mkGmpDerivedConstants,dist,1))
+
+GmpDerivedConstants_HEADER = libraries/integer-gmp/mkGmpDerivedConstants/dist/GmpDerivedConstants.h
+
+$(GmpDerivedConstants_HEADER): $(mkGmpDerivedConstants_INPLACE)
+       $< > $@
+