summaryrefslogtreecommitdiff
path: root/build-0.3/cxx/gnu/o-l.make
diff options
context:
space:
mode:
Diffstat (limited to 'build-0.3/cxx/gnu/o-l.make')
-rw-r--r--build-0.3/cxx/gnu/o-l.make25
1 files changed, 23 insertions, 2 deletions
diff --git a/build-0.3/cxx/gnu/o-l.make b/build-0.3/cxx/gnu/o-l.make
index e378a4d..ea3e1d1 100644
--- a/build-0.3/cxx/gnu/o-l.make
+++ b/build-0.3/cxx/gnu/o-l.make
@@ -1,6 +1,5 @@
# file : build/cxx/gnu/o-l.make
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC
# license : GNU GPL v2; see accompanying LICENSE file
$(call include,$(bld_root)/cxx/gnu/configuration.make)
@@ -42,10 +41,14 @@ $(out_base)/%.l.o.clean:
else
+mingw := $(if $(filter $(cxx_gnu_target_os),mingw32 mingw64),y,n)
+
$(out_base)/%.l: ld := $(cxx_gnu)
$(out_base)/%.l: ld_options := $(cxx_gnu_optimization_options) $(cxx_gnu_debugging_options)
+ifeq ($(mingw),n)
$(out_base)/%.l: c_pic_options := -fPIC
$(out_base)/%.l: cxx_pic_options := -fPIC
+endif
$(out_base)/%.l: comma_ := ,
$(out_base)/%.l: expand-l = $(if $(subst n,,$(cxx_rpath)),\
@@ -57,6 +60,9 @@ $(out_base)/%.l:
else
$(out_base)/%.l: | $$(dir $$@).
endif
+ifeq ($(mingw),n)
+# Standard version.
+#
$(call message,ld $@,$(ld) -shared \
$(cxx_extra_options) $(ld_options) $(cxx_ld_extra_options) \
-o $(@D)/lib$(basename $(@F)).so -Wl$(comma_)-soname=lib$(basename $(@F)).so \
@@ -64,9 +70,24 @@ $(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(cxx_extra_lib
$(call message,,echo "$(@D)/lib$(basename $(@F)).so" >$@)
$(call message,,echo "rpath:$(@D)" >>$@)
$(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.so %.l,$^))" | xargs -n 1 echo >>$@)
+else
+# MinGW version.
+#
+ $(call message,ld $@,$(ld) -shared \
+$(cxx_extra_options) $(ld_options) $(cxx_ld_extra_options) \
+-o $(@D)/$(basename $(@F)).dll -Wl$(comma_)--out-implib$(comma_)$(@D)/lib$(basename $(@F)).a \
+$(foreach f,$^,$(if $(patsubst %.l,,$f),$f,$(call expand-l,$f))) $(cxx_extra_libs))
+ $(call message,,echo "$(@D)/lib$(basename $(@F)).a" >$@)
+ $(call message,,echo "rpath:$(@D)" >>$@)
+ $(call message,,echo "$(patsubst %.l,`cat %.l`,$(filter %.a %.l,$^))" | xargs -n 1 echo >>$@)
+endif
$(out_base)/%.l.o.clean:
+ifeq ($(mingw),n)
$(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,lib%.so,$(@F)),$(basename $(basename $@)))
+else
+ $(call message,rm $$1,rm -f $$1 $(@D)/$(patsubst %.l.o.clean,%.dll,$(@F)) $(@D)/$(patsubst %.l.o.clean,lib%.a,$(@F)),$(basename $(basename $@)))
+endif
endif
endif