diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /boehm-gc/Makefile.DLLs | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'boehm-gc/Makefile.DLLs')
-rw-r--r-- | boehm-gc/Makefile.DLLs | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/boehm-gc/Makefile.DLLs b/boehm-gc/Makefile.DLLs new file mode 100644 index 000000000..011f49d3b --- /dev/null +++ b/boehm-gc/Makefile.DLLs @@ -0,0 +1,107 @@ +#-----------------------------------------------------------------------------# + +# Makefile.DLLs, version 0.4. + +# Contributed by Fergus Henderson. + +# This Makefile contains rules for creating DLLs on Windows using gnu-win32. + +#-----------------------------------------------------------------------------# + +# This rule creates a `.def' file, which lists the symbols that are exported +# from the DLL. We use `nm' to get a list of all the exported text (`T') +# symbols and data symbols -- including uninitialized data (`B'), +# initialized data (`D'), read-only data (`R'), and common blocks (`C'). +%.def: %.a + echo EXPORTS > $@ + nm $< | grep '^........ [BCDRT] _' | sed 's/[^_]*_//' >> $@ + +# We need to use macros to access global data: +# the user of the DLL must refer to `foo' as `(*__imp_foo)'. +# This rule creates a `_globals.h' file, which contains macros +# for doing this. + +SYM_PREFIX = $(firstword $(SYM_PREFIX-$*) $*) +DLL_MACRO = $(SYM_PREFIX)_USE_DLL +IMP_MACRO = $(SYM_PREFIX)_IMP +GLOBAL_MACRO = $(SYM_PREFIX)_GLOBAL + +%_globals.h: %.a + echo "/* automatically generated by Makefile.DLLs */" > $@ + echo "#if defined(__GNUC__) && defined(_WIN32) \\" >> $@ + echo " && defined($(DLL_MACRO))" >> $@ + echo "# define $(IMP_MACRO)(name) __imp_##name" >> $@ + echo "# define $(GLOBAL_MACRO)(name) (*$(IMP_MACRO)(name))" >> $@ + echo "#else" >> $@ + echo "# define $(GLOBAL_MACRO)(name) name" >> $@ + echo "#endif" >> $@ + echo "" >> $@ + for sym in `nm $< | grep '^........ [BCDR] _' | sed 's/[^_]*_//'`; do \ + echo "#define $$sym $(GLOBAL_MACRO)($$sym)" >> $@; \ + done + +# This rule creates the export object file (`foo.exp') which contains the +# jump table array; this export object file becomes part of the DLL. +# This rule also creates the import library (`foo_dll.a') which contains small +# stubs for all the functions exported by the DLL which jump to them via the +# jump table. Executables that will use the DLL must be linked against this +# stub library. +%.exp %_dll.a : %.def + dlltool $(DLLTOOLFLAGS) $(DLLTOOLFLAGS-$*) \ + --def $< \ + --dllname $*.dll \ + --output-exp $*.exp \ + --output-lib $*_dll.a + +# The `sed' commands below are to convert DOS-style `C:\foo\bar' +# pathnames into Unix-style `//c/foo/bar' pathnames. +CYGWIN32_LIBS = $(shell echo \ + -L`dirname \`gcc -print-file-name=libgcc.a | \ + sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \ + -L`dirname \`gcc -print-file-name=libcygwin.a | \ + sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \ + -L`dirname \`gcc -print-file-name=libkernel32.a | \ + sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \ + -lgcc -lcygwin -lkernel32 -lgcc) + +RELOCATABLE=yes + +ifeq "$(strip $(RELOCATABLE))" "yes" + +# to create relocatable DLLs, we need to do two passes +%.dll: %.exp %.a dll_fixup.o dll_init.o + $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $*.base \ + -e _dll_entry@12 dll_init.o \ + dll_fixup.o $*.exp $*.a \ + $(LDLIBS) $(LDLIBS-$*) \ + $(CYGWIN32_LIBS) + $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll --base-file $*.base -o $@ \ + -e _dll_entry@12 dll_init.o \ + dll_fixup.o $*.exp $*.a \ + $(LDLIBS) $(LDLIBS-$*) \ + $(CYGWIN32_LIBS) + rm -f $*.base +else + +%.dll: %.exp %.a dll_fixup.o dll_init.o + $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $@ \ + -e _dll_entry@12 dll_init.o \ + dll_fixup.o $*.exp $*.a \ + $(LDLIBS) $(LDLIBS-$*) \ + $(CYGWIN32_LIBS) + +endif + +# This black magic piece of assembler needs to be linked in in order to +# properly terminate the list of imported DLLs. +dll_fixup.s: + echo '.section .idata$$3' > dll_fixup.s + echo '.long 0,0,0,0, 0,0,0,0' >> dll_fixup.s + +# This bit is necessary to provide an initialization function for the DLL. +dll_init.c: + echo '__attribute__((stdcall))' > dll_init.c + echo 'int dll_entry(int handle, int reason, void *ptr)' >> dll_init.c + echo '{return 1; }' >> dll_init.c + +dont_throw_away: dll_fixup.o dll_init.o |