Files
harbour-core/harbour/config/common/watcom.mk
Viktor Szakats 9cd0df326e 2009-09-07 21:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* config/common/watcom.mk
    ! Upped -p linker option (from 64 to 72) to not choke on hbrtl
      in some certain build situations.
      Thanks to Tamas Tevesz for report/testing.
2009-09-07 19:22:27 +00:00

128 lines
3.9 KiB
Makefile

#
# $Id$
#
# GNU Make file for Open Watcom C/C++ compiler
# (shell specific rules)
# ---------------------------------------------------------------
# See option docs here:
# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/cpopts.html
# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlink.html
# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlib.html
# ---------------------------------------------------------------
# NOTE: Hack to force no extension for Linux binaries created on non-Linux hosts.
# Otherwise they become '.elf'. [vszakats]
ifeq ($(HB_PLATFORM),linux)
ifneq ($(HB_HOST_PLAT),linux)
BIN_EXT := .
endif
endif
AR := wlib
ARFLAGS := -q -p=72 -c -n
comma := ,
LDFILES_COMMA = $(subst $(subst x,x, ),$(comma) ,$(^F))
LDLIBS_COMMA := $(subst $(subst x,x, ),$(comma) ,$(strip $(LDLIBS)))
LD_RULE = $(LD) $(LDFLAGS) $(HB_LDFLAGS) $(HB_USER_LDFLAGS) NAME $(BIN_DIR)/$@ FILE $(LDFILES_COMMA) $(if $(LDLIBS_COMMA), LIB $(LDLIBS_COMMA),)
AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) $(LIB_DIR)/$@ $(foreach file,$(^F),-+$(file))
ifeq ($(HB_SHELL),os2)
# maximum size of command line in OS2 is limited to 1024 characters
# the trick with divided 'wordlist' is workaround for it:
# -$(if $(wordlist 1,100,$(^F)), @$(ECHO) $(ECHOQUOTE)$(wordlist 1,100,$(addprefix -+,$(^F)))$(ECHOQUOTE) >> __lib__.tmp,)
# -$(if $(wordlist 101,200,$(^F)), @$(ECHO) $(ECHOQUOTE)$(wordlist 101,200,$(addprefix -+,$(^F)))$(ECHOQUOTE) >> __lib__.tmp,)
# -$(if $(wordlist 201,300,$(^F)), @$(ECHO) $(ECHOQUOTE)$(wordlist 301,300,$(addprefix -+,$(^F)))$(ECHOQUOTE) >> __lib__.tmp,)
# anyhow OS/2 port# of GNU make 3.81 seems to have bug and GPFs when total
# commands length is too big so for %i in ( *$(OBJ_EXT) ) do ... below is
# ugly workaround for both problems
define create_library
@$(ECHO) $(ECHOQUOTE)$(LIB_DIR)/$@$(ECHOQUOTE) > __lib__.tmp
for %f in ( *$(OBJ_EXT) ) do @$(ECHO) $(ECHOQUOTE)-+%f$(ECHOQUOTE) >> __lib__.tmp
$(AR) $(ARFLAGS) $(HB_USER_AFLAGS) @__lib__.tmp
endef
AR_RULE = $(create_library)
endif
ifeq ($(HB_SHELL),dos)
# NOTE: The empty line directly before 'endef' HAVE TO exist!
# It causes that every command will be separated by LF
define link_file
@$(ECHO) $(ECHOQUOTE)FILE $(file)$(ECHOQUOTE) >> __link__.tmp
endef
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define link_lib
@$(ECHO) $(ECHOQUOTE)LIB $(lib)$(ECHOQUOTE) >> __link__.tmp
endef
define link_exe_file
@$(ECHO) $(ECHOQUOTE)$(LDFLAGS) $(HB_LDFLAGS) NAME $(BIN_DIR)/$@$(ECHOQUOTE) > __link__.tmp
$(foreach file,$(^F),$(link_file))
$(foreach lib,$(LDLIBS),$(link_lib))
-$(LD) @__link__.tmp
endef
LD_RULE = $(link_exe_file) $(HB_USER_LDFLAGS)
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define lib_object
@$(ECHO) $(ECHOQUOTE)-+$(file)$(ECHOQUOTE) >> __lib__.tmp
endef
define create_library
@$(ECHO) $(ECHOQUOTE)$(LIB_DIR)/$@$(ECHOQUOTE) > __lib__.tmp
$(foreach file,$(^F),$(lib_object))
$(AR) $(ARFLAGS) $(HB_USER_AFLAGS) @__lib__.tmp
endef
AR_RULE = $(create_library)
endif
ifeq ($(CC),wcc386)
ifneq ($(HB_HOST_PLAT),linux)
CC_RULE = $(CC) $(CC_FLAGS) $(subst /,\,$(HB_USER_CFLAGS)) $(CC_OUT)$(<F:.c=$(OBJ_EXT)) $(CC_IN)$(subst /,\,$<)
endif
endif
include $(TOP)$(ROOT)config/rules.mk
ifeq ($(CC),wcc386)
ifneq ($(HB_HOST_PLAT),linux)
CC_FLAGS := $(subst /,\,$(CC_FLAGS))
endif
endif
ANYDOS := no
ifeq ($(HB_SHELL),dos)
ANYDOS := yes
endif
ifeq ($(HB_PLATFORM),dos)
ANYDOS := yes
endif
ifeq ($(ANYDOS),yes)
# disable DOS/4GW Banner
export DOS4G := quiet
# work arround to DOS command line size limit
ifeq ($(CC),wcc386)
export WCC386 := $(strip $(CC_FLAGS))
else
export WPP386 := $(strip $(CC_FLAGS))
endif
CC_FLAGS :=
export HARBOURCMD := $(HB_FLAGS)
HB_FLAGS :=
endif