X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rules%2Fbuild-package-way.mk;h=ef4477fcecf95493b99d0b5e765400f0d58d68e2;hb=92b7b8a604b2ccca0c6502c74af477378ef6aad6;hp=95ec21b6b7ab6f3153c7721bfb0649b41a2a9323;hpb=f34c33e7f3e0bcf916f96635c9b2e2ee186155b8;p=ghc-hetmet.git diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index 95ec21b..ef4477f 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -26,6 +26,15 @@ $(call hs-objs,$1,$2,$3) $1_$2_$3_LIB = $1/$2/build/libHS$$($1_PACKAGE)-$$($1_$2_VERSION)$$($3_libsuf) $$($1_PACKAGE)-$($1_$2_VERSION)_$2_$3_LIB = $$($1_$2_$3_LIB) +# hack: the DEPS_LIBS mechanism assumes that the distdirs for packges +# that depend on each other are the same, but that is not the case for +# ghc where we use stage1/stage2 rather than dist/dist-install. +# Really we should use a consistent scheme for distdirs, but in the +# meantime we work around it by defining ghc-_dist-install_way_LIB: +ifeq "$$($1_PACKAGE) $2" "ghc stage2" +$$($1_PACKAGE)-$($1_$2_VERSION)_dist-install_$3_LIB = $$($1_$2_$3_LIB) +endif + # All the .a/.so library file dependencies for this library $1_$2_$3_DEPS_LIBS=$$(foreach dep,$$($1_$2_DEPS),$$($$(dep)_$2_$3_LIB)) @@ -42,23 +51,36 @@ $1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_ $1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS) ifeq "$3" "dyn" + # Link a dynamic library +# On windows we have to supply the extra libs this one links to when building it. +ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) "$$($1_$2_HC)" $$($1_$2_$3_ALL_OBJS) \ `$$($1_$2_$3_MKSTUBOBJS)` \ -shared -dynamic -dynload deploy \ + $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) \ -no-auto-link-packages $$(addprefix -package,$$($1_$2_DEPS)) \ -o $$@ else +$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) + "$$($1_$2_HC)" $$($1_$2_$3_ALL_OBJS) \ + `$$($1_$2_$3_MKSTUBOBJS)` \ + -shared -dynamic -dynload deploy \ + -dylib-install-name $(ghclibdir)/`basename "$$@" | sed 's/^libHS//;s/[-]ghc.*//'`/`basename "$$@"` \ + -no-auto-link-packages $$(addprefix -package,$$($1_$2_DEPS)) \ + -o $$@ +endif +else # Build the ordinary .a library ifeq "$$($1_$2_SplitObjs)" "YES" $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) "$$(RM)" $$(RM_OPTS) $$@ - (echo $$($1_$2_$3_NON_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)`; $$(FIND) $$(patsubst %.$$($3_osuf),%_$$($3_osuf)_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print) | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@ + (echo $$($1_$2_$3_NON_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)`; $$(FIND) $$(patsubst %.$$($3_osuf),%_$$($3_osuf)_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR)" $$(AR_OPTS) $$(EXTRA_AR_ARGS) $$@ else $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) "$$(RM)" $$(RM_OPTS) $$@ - echo $$($1_$2_$3_ALL_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@ + echo $$($1_$2_$3_ALL_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR)" $$(AR_OPTS) $$(EXTRA_AR_ARGS) $$@ endif endif