From 1f5b18a8949ecfc942dac4c71f2358b955bde2fe Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 24 Apr 2016 16:29:50 -0400 Subject: build system: PE targets: added import library version support. --- sysinfo/os/any-os.mk | 3 ++- sysinfo/os/bsd.mk | 3 ++- sysinfo/os/darwin.mk | 3 ++- sysinfo/os/linux.mk | 3 ++- sysinfo/os/midipix.mk | 7 +------ sysinfo/os/mingw.mk | 6 +----- sysinfo/os/pe.mk | 48 +++++++++++++++++++++++++++++++++++++++++++ sysinfo/toolchain/binutils.mk | 1 + sysinfo/toolchain/llvm.mk | 1 + 9 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 sysinfo/os/pe.mk (limited to 'sysinfo') diff --git a/sysinfo/os/any-os.mk b/sysinfo/os/any-os.mk index c052f31..cf8ec00 100644 --- a/sysinfo/os/any-os.mk +++ b/sysinfo/os/any-os.mk @@ -7,5 +7,6 @@ OS_IMPLIB_EXT = .invalid OS_LIBDEF_EXT = .invalid OS_ARCHIVE_EXT = .a OS_SONAME = symlink +OS_BINFMT = ELF -.PHONY: $(SHARED_IMPLIB) +.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK) diff --git a/sysinfo/os/bsd.mk b/sysinfo/os/bsd.mk index 694c54f..6e8fac0 100644 --- a/sysinfo/os/bsd.mk +++ b/sysinfo/os/bsd.mk @@ -7,5 +7,6 @@ OS_IMPLIB_EXT = .invalid OS_LIBDEF_EXT = .invalid OS_ARCHIVE_EXT = .a OS_SONAME = symlink +OS_BINFMT = ELF -.PHONY: $(SHARED_IMPLIB) +.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK) diff --git a/sysinfo/os/darwin.mk b/sysinfo/os/darwin.mk index 7ccdfde..5a0b99e 100644 --- a/sysinfo/os/darwin.mk +++ b/sysinfo/os/darwin.mk @@ -7,7 +7,8 @@ OS_IMPLIB_EXT = .invalid OS_LIBDEF_EXT = .invalid OS_ARCHIVE_EXT = .a OS_SONAME = symlink +OS_BINFMT = MACHO CFLAGS_OS += -D_DARWIN_C_SOURCE -.PHONY: $(SHARED_IMPLIB) +.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK) diff --git a/sysinfo/os/linux.mk b/sysinfo/os/linux.mk index e2dcd2e..082026b 100644 --- a/sysinfo/os/linux.mk +++ b/sysinfo/os/linux.mk @@ -7,5 +7,6 @@ OS_IMPLIB_EXT = .invalid OS_LIBDEF_EXT = .invalid OS_ARCHIVE_EXT = .a OS_SONAME = symlink +OS_BINFMT = ELF -.PHONY: $(SHARED_IMPLIB) +.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK) diff --git a/sysinfo/os/midipix.mk b/sysinfo/os/midipix.mk index 098ac68..d99b249 100644 --- a/sysinfo/os/midipix.mk +++ b/sysinfo/os/midipix.mk @@ -7,9 +7,4 @@ OS_IMPLIB_EXT = .lib.a OS_LIBDEF_EXT = .so.def OS_ARCHIVE_EXT = .a OS_SONAME = copy - -LDFLAGS_CONFIG += -mout-implib - -install-implib: shared-implib - mkdir -p $(DESTDIR)$(LIBDIR) - cp $(SHARED_IMPLIB) $(DESTDIR)$(LIBDIR) +OS_BINFMT = PE \ No newline at end of file diff --git a/sysinfo/os/mingw.mk b/sysinfo/os/mingw.mk index a40239f..6ade8d5 100644 --- a/sysinfo/os/mingw.mk +++ b/sysinfo/os/mingw.mk @@ -7,10 +7,6 @@ OS_IMPLIB_EXT = .dll.a OS_LIBDEF_EXT = .def OS_ARCHIVE_EXT = .a OS_SONAME = copy +OS_BINFMT = PE CFLAGS_PIC = -LDFLAGS_CONFIG += -Wl,--out-implib,$(SHARED_IMPLIB) - -install-implib: shared-implib - mkdir -p $(DESTDIR)$(LIBDIR) - cp $(SHARED_IMPLIB) $(DESTDIR)$(LIBDIR) diff --git a/sysinfo/os/pe.mk b/sysinfo/os/pe.mk new file mode 100644 index 0000000..0b50df2 --- /dev/null +++ b/sysinfo/os/pe.mk @@ -0,0 +1,48 @@ +LDFLAGS_IMPLIB += -Wl,--output-def +LDFLAGS_IMPLIB += -Wl,$(IMPLIB_DEF) + +implib: implib-ver implib-soname implib-solink + +implib-ver: shared-lib $(IMPLIB_VER) + +implib-soname: shared-lib $(IMPLIB_SONAME) + +implib-solink: shared-lib $(IMPLIB_SOLINK) + +$(IMPLIB_DEF): shared-lib + +$(IMPLIB_VER): $(IMPLIB_DEF) + $(DLLTOOL) -l $(IMPLIB_VER) -d $(IMPLIB_DEF) -D $(DSO_VER) + +$(IMPLIB_SONAME): $(IMPLIB_DEF) + $(DLLTOOL) -l $(IMPLIB_SONAME) -d $(IMPLIB_DEF) -D $(DSO_SONAME) + +$(IMPLIB_SOLINK): $(IMPLIB_SONAME) + rm -f $(IMPLIB_SOLINK).tmp + ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp + mv $(IMPLIB_SOLINK).tmp $(IMPLIB_SOLINK) + +install-implib: install-implib-ver \ + install-implib-soname \ + install-implib-solink + +install-implib-ver: implib-ver + mkdir -p $(DESTDIR)$(LIBDIR) + cp $(IMPLIB_VER) $(DESTDIR)$(LIBDIR) + +install-implib-soname: implib-soname + mkdir -p $(DESTDIR)$(LIBDIR) + cp $(IMPLIB_SONAME) $(DESTDIR)$(LIBDIR) + +install-implib-solink: implib-soname + mkdir -p $(DESTDIR)$(LIBDIR) + rm -f $@.tmp + ln -s $(IMP_SONAME) $@.tmp + mv $@.tmp $(DESTDIR)$(LIBDIR)/$(IMP_SOLINK) + +clean-implib: + rm -f $(SHARED_LIB) + rm -f $(IMPLIB_DEF) + rm -f $(IMPLIB_VER) + rm -f $(IMPLIB_SONAME) + rm -f $(IMPLIB_SOLINK) diff --git a/sysinfo/toolchain/binutils.mk b/sysinfo/toolchain/binutils.mk index a29ac0c..3232915 100644 --- a/sysinfo/toolchain/binutils.mk +++ b/sysinfo/toolchain/binutils.mk @@ -15,3 +15,4 @@ CXXFILT = $(CROSS_COMPILE)c++filt ELFEDIT = $(CROSS_COMPILE)elfedit OBJCOPY = $(CROSS_COMPILE)objcopy READELF = $(CROSS_COMPILE)readelf +DLLTOOL = $(CROSS_COMPILE)dlltool diff --git a/sysinfo/toolchain/llvm.mk b/sysinfo/toolchain/llvm.mk index 3c805a8..65b5396 100644 --- a/sysinfo/toolchain/llvm.mk +++ b/sysinfo/toolchain/llvm.mk @@ -15,3 +15,4 @@ CXXFILT = $(CROSS_COMPILE)c++filt ELFEDIT = $(CROSS_COMPILE)elfedit OBJCOPY = $(CROSS_COMPILE)objcopy READELF = $(CROSS_COMPILE)readelf +DLLTOOL = $(CROSS_COMPILE)dlltool -- cgit v1.2.3