From 88259ac5475b41c4d790add383869b53c38da4a2 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 21 Aug 2009 19:44:47 +0000 Subject: [PATCH] 2009-08-21 21:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/linux/gcc.mk + Added experimental dynamic lib creation. ; Please review this. If okay we can probably move this logic to all other *nix platforms and compilers. Maybe even os2/gcc. --- harbour/ChangeLog | 7 +++++++ harbour/config/linux/gcc.mk | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6e78989e1a..07f6698787 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,13 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-21 21:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * config/linux/gcc.mk + + Added experimental dynamic lib creation. + ; Please review this. If okay we can probably move this logic + to all other *nix platforms and compilers. + Maybe even os2/gcc. + 2009-08-21 21:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/darwin/gcc.mk + Added experimental dynamic lib creation. diff --git a/harbour/config/linux/gcc.mk b/harbour/config/linux/gcc.mk index 3f4516f8c0..976c1e3798 100644 --- a/harbour/config/linux/gcc.mk +++ b/harbour/config/linux/gcc.mk @@ -83,4 +83,22 @@ AR := $(HB_CCPREFIX)ar ARFLAGS := AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) crs $(LIB_DIR)/$@ $(^F) || ( $(RM) $(LIB_DIR)/$@ && false ) +DY := $(CC) +DFLAGS := -shared -fPIC +DY_OUT := -o$(subst x,x, ) +DLIBS := + +# NOTE: The empty line directly before 'endef' HAVE TO exist! +define dyn_object + @$(ECHO) $(ECHOQUOTE)$(subst \,/,$(file))$(ECHOQUOTE) >> __dyn__.tmp + +endef +define create_dynlib + $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,) + $(foreach file,$^,$(dyn_object)) + $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ @__dyn__.tmp +endef + +DY_RULE = $(create_dynlib) + include $(TOP)$(ROOT)config/rules.mk