summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2009-04-29 15:15:53 +0000
committerDuncan Coutts <duncan@well-typed.com>2009-04-29 15:15:53 +0000
commit442f06cc8f9f729d33a8de3aa14cdaf80545808e (patch)
treec8e4ea7bc1c4ba464f8482db53608edb962dec75 /rules
parent7f995ef4d41815cd2d9fab774a638b5493d33910 (diff)
downloadhaskell-442f06cc8f9f729d33a8de3aa14cdaf80545808e.tar.gz
Build library packages as shared libs
when we configure ghc with --enable-shared
Diffstat (limited to 'rules')
-rw-r--r--rules/build-package-data.mk4
-rw-r--r--rules/build-package-way.mk11
-rw-r--r--rules/build-package.mk8
3 files changed, 20 insertions, 3 deletions
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index a260138286..2f1a83aca2 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -12,6 +12,10 @@
define build-package-data # args: $1 = dir, $2 = distdir
+ifeq "$(BuildSharedLibs)" "YES"
+$1_$2_CONFIGURE_FLAGS += --enable-shared
+endif
+
ifeq "$(HSCOLOUR_SRCS)" "YES"
$1_$2_CONFIGURE_FLAGS += --with-hscolour="$$(HSCOLOUR)"
endif
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index 5fb3cdf9ee..41496db915 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -26,6 +26,16 @@ $1_$2_$3_MKSTUBOBJS = find $1/$2/build -name "*_stub.$$($3_osuf)" -print
# HACK ^^^ we tried to use $(wildcard), but apparently it fails due to
# make using cached directory contents, or something.
+ifeq "$3" "dyn"
+# Link a dynamic library
+$$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_dyn_C_OBJS) $$($1_$2_dyn_S_OBJS) $$(ALL_RTS_LIBS)
+ $$(RM) $$@
+ $$($1_$2_HC) $$($1_$2_dyn_C_OBJS) $$($1_$2_dyn_S_OBJS) $$($1_$2_$3_HS_OBJS) \
+ `$$($1_$2_$3_MKSTUBOBJS)` \
+ -shared -dynamic \
+ -no-auto-link-packages $$(addprefix -package,$$($1_$2_DEPS)) \
+ -o $$@
+else
# Build the ordinary .a library
ifeq "$$($1_$2_SplitObjs)" "YES"
$$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS)
@@ -36,6 +46,7 @@ $$($1_$2_$3_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS)
$$(RM) $$@
echo $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_$3_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | xargs $$(AR) $$(EXTRA_AR_ARGS) $$@
endif
+endif
$(call all-target,$1_$2,all_$1_$2_$3)
$(call all-target,$1_$2_$3,$$($1_$2_$3_LIB))
diff --git a/rules/build-package.mk b/rules/build-package.mk
index 863dc73f2d..fb7d9d230c 100644
--- a/rules/build-package.mk
+++ b/rules/build-package.mk
@@ -28,8 +28,6 @@
# libraries/base_dist_CC_OPTS = -Iinclude ...
# libraries/base_dist_LD_OPTS = -package ghc-prim-0.1.0.0
-# TODO: soext
-
define build-package
# $1 = dir
# $2 = distdir
@@ -123,10 +121,14 @@ $1_$2_SplitObjs = NO
endif
endif
-# C and S files are built the "v" vanlilla way
+# C and S files are built the "v" vanlilla way and possibly also the "dyn" way.
$(call c-objs,$1,$2,v)
$(call distdir-opts,$1,$2,$3)
$(call c-suffix-rules,$1,$2,v,YES)
+ifeq "$(BuildSharedLibs)" "YES"
+$(call c-objs,$1,$2,dyn)
+$(call c-suffix-rules,$1,$2,dyn,YES)
+endif
# Now generate all the build rules for each way in this directory:
$$(foreach way,$$($1_$2_WAYS),$$(eval $$(call build-package-way,$1,$2,$$(way),$3)))