Files
harbour-core/config/linux/gcc.mk
Przemysław Czerpak 1eb4121bd9 2017-05-19 16:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* config/android/gcc.mk
  * config/global.mk
  * config/linux/gcc.mk
  * config/postinst.hb
  * contrib/hbpost.hbm
    ! removed version number from dynamic libraries for Android.
      Pure Linux style dynamic library numbers in Android systems can be used
      only with system libraries but it's not supported inside .apk packages
      so our dynamic libraries were unusable for Android programmers unless
      someone plans to install more then one version of Harbour dynamic
      libraries as Android system libraries. It's rather unusual situation
      and I believe that in such case he can easy create such libraries
      building Harbour for Linux with NDK.
    * enabled by default building contrib dynamic libraries in Harbour
      Android build.
    + added -Wl,--no-undefined to linker parameters when dynamic libraries
      are created to verify if dynamic libraries can be used in Android .apk
      packages during Harbour build process.
    ; After above modification dynamic (*.so) libraries created in Harbour
      build process can be used in .apk packages. It means that projects
      like HDroidGUI do not longer need their own custom versions of
      libharbour.so but can use the one from standard Harbour Android build.
      They can also use Harbour contrib dynamic libraries.
    ; TODO: add support for automatic NDK detection in Harbour build process
    ; TODO: add to HBMK2 basic support for generating .apk packages

  * contrib/gtqtc/gtqtc.hbp
    * disabled dynamic GTQTC library in Android builds until we set explicit
      bindings with QT/C++ dynamic libs
2017-05-19 16:08:57 +02:00

89 lines
2.5 KiB
Makefile

ifeq ($(HB_CMP),)
ifeq ($(HB_BUILD_MODE),cpp)
HB_CMP := g++
else
HB_CMP := gcc
endif
endif
OBJ_EXT := .o
LIB_PREF := lib
LIB_EXT := .a
HB_DYN_COPT := -DHB_DYNLIB -fPIC
CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCSUFFIX)
CC_IN := -c
CC_OUT := -o
CFLAGS += -I. -I$(HB_HOST_INC)
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -W -Wall
else
CFLAGS += -Wmissing-braces -Wreturn-type -Wformat
ifneq ($(HB_BUILD_MODE),cpp)
CFLAGS += -Wimplicit-int -Wimplicit-function-declaration
endif
endif
ifneq ($(HB_BUILD_OPTIM),no)
CFLAGS += -O3
endif
ifeq ($(HB_BUILD_DEBUG),yes)
CFLAGS += -g
endif
LD := $(CC)
LD_OUT := -o
LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir))
LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib))
LDFLAGS += $(LIBPATHS)
AR := $(HB_CCPREFIX)ar
ifeq ($(HB_SHELL),sh)
AR_RULE = ( $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) )
else
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define library_object
@$(ECHO) $(ECHOQUOTE)$(subst \,/,$(file))$(ECHOQUOTE) >> __lib__.tmp
endef
define create_library
$(if $(wildcard __lib__.tmp),@$(RM) __lib__.tmp,)
$(foreach file,$^,$(library_object))
( $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ @__lib__.tmp $(ARSTRIP) ) || ( $(RM) $(subst /,$(DIRSEP),$(LIB_DIR)/$@) && $(FALSE) )
endef
AR_RULE = $(create_library)
endif
DY := $(CC)
DFLAGS += -shared $(LIBPATHS)
DY_OUT := -o$(subst x,x, )
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib))
ifeq ($(HB_SHELL),sh)
DY_RULE = $(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && ([ "$(@F)" = "$(notdir $(DYN_FILE_NVR))" ] || $(LN) $(@F) $(DYN_FILE_NVR)) && ([ "$(@F)" = "$(notdir $(DYN_FILE_CPT))" ] || $(LN) $(@F) $(DYN_FILE_CPT))
else
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define dynlib_object
@$(ECHO) $(ECHOQUOTE)INPUT($(subst \,/,$(file)))$(ECHOQUOTE) >> __dyn__.tmp
endef
define create_dynlib
$(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,)
$(foreach file,$^,$(dynlib_object))
$(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ __dyn__.tmp $(DLIBS) $(DYSTRIP) && $(LN) $(subst /,$(DIRSEP),$(DYN_DIR)/$@ $(DYN_FILE_NVR)) && $(LN) $(subst /,$(DIRSEP),$(DYN_DIR)/$@ $(DYN_FILE_CPT))
endef
DY_RULE = $(create_dynlib)
endif
include $(TOP)$(ROOT)config/rules.mk