Files
harbour-core/harbour/config/w32/mingw32.cf
Ryszard Glab d12a8aa83c 2008-01-31 18:47 UTC+0100 Ryszard Glab <harbour//rglab.pl>
* config/hpux/gcc.cf
   * config/darwin/gcc.cf
   * config/dos/owatcom.cf
   * config/dos/watcom.cf
   * config/dos/bcc16.cf
   * config/dos/rsx32.cf
   * config/dos/djgpp.cf
   * config/linux/owatcom.cf
   * config/linux/gcc.cf
   * config/os2/gcc.cf
   * config/os2/icc.cf
   * config/sunos/gcc.cf
   * config/bsd/gcc.cf
   * config/w32/msvc.cf
   * config/w32/owatcom.cf
   * config/w32/watcom.cf
   * config/w32/bcc32.cf
   * config/w32/gcc.cf
   * config/w32/xcc.cf
   * config/w32/rsxnt.cf
   * config/w32/cemgw.cf
   * config/w32/pocc.cf
   * config/w32/mingw32.cf
      * fixed to link contrib libraries (all contrib libraries are
        placed in lib/<arch>/<compiler> directory)
        NOTE:
        OS/2 users: the names of libraries have 'hbgf' prefix
2008-01-31 17:44:30 +00:00

147 lines
3.3 KiB
CFEngine3

#
# $Id$
#
include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf
OBJ_EXT = .o
EXE_EXT = .exe
LIB_PREF = lib
LIB_EXT = .a
CC = $(CCPREFIX)gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE) -mno-cygwin
CFLAGS = -Wall -W
LD = $(CCPREFIX)gcc
LD_OUT = -o
LINKPATHS =
LDLIBS =
# Add all libraries specified in CONTRIBS and LIBS.
ifeq ($(HB_LIB_COMPILE),)
LINKPATHS += -L$(LIB_DIR)
else
LINKPATHS += -L$(HB_LIB_COMPILE)
endif
LDLIBS += $(foreach lib, $(CONTRIBS), -l$(subst lib,,$(lib)))
LDLIBS += $(foreach lib, $(LIBS), -l$(lib))
# If LIBS specifies the rdd library, add all DB drivers.
ifeq ($(findstring rdd,$(LIBS)),rdd)
LDLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
endif
# Add the standard C main() entry
ifeq ($(HB_MAIN),std)
ifeq ($(findstring vm,$(LIBS)),vm)
ifneq ($(HB_GT_LIB),gtwvt)
LDLIBS += -lhbmainstd
endif
endif
endif
# Add the specified GT driver library
ifeq ($(findstring rtl,$(LIBS)),rtl)
LDLIBS += $(foreach gt, $(HB_GT_LIBS), -l$(gt))
endif
# HB_SCREEN_LIB: empty, or one of ncurses, slang
# HB_SCREEN_LIB=ncurses
# HB_SCREEN_LIB=slang
ifneq ($(HB_SCREEN_LIB),)
LDLIBS += -l$(HB_SCREEN_LIB)
endif
# Add the optional user path(s)
ifneq ($(LNK_USR_PATH),)
LINKPATHS += $(foreach path, $(LNK_USR_PATH), -L$(path))
endif
# Add the optional user libarary (or libraries)
ifneq ($(LNK_USR_LIB),)
LDLIBS += $(foreach lib, $(LNK_USR_LIB), -l$(lib))
endif
# This library is needed for CharToOemBuff() and OemToCharBuff() support.
SYSLIBS = -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 \
-lole32 -loleaut32 -luuid -lmpr -lwsock32 -lws2_32 -lmapi32
# NOTE: The empty line directly before 'endef' HAVE TO exist!
# It causes that every echo command will be separated by LF
define lib_object
echo. ADDMOD $(file) >> __lib__.tmp
endef
# We have to use script to overcome the DOS limit of max 128 characters
# in commmand line
define create_library
echo. CREATE $(LIB_DIR)/$@ > __lib__.tmp
$(foreach file, $(^F), $(lib_object))
echo. SAVE >> __lib__.tmp
echo. END >> __lib__.tmp
$(AR) $(ARFLAGS) -M < __lib__.tmp
endef
# NOTE: The empty line below HAVE TO exist!
define link_file
echo. $(file) >> __link__.tmp
endef
define search_dir
echo. SEARCH_DIR($(file)) >> __link__.tmp
endef
ifneq ($(strip $(LDLIBS)),)
define libs_list
echo. GROUP( >> __link__.tmp
$(foreach file, $(LDLIBS), $(link_file))
echo. ) >> __link__.tmp
endef
else
libs_list=
endif
define link_exe_file
echo. INPUT( >> __link__.tmp
$(foreach file, $(^F), $(link_file))
echo. ) >> __link__.tmp
$(libs_list)
$(foreach file, $(subst -L,,$(LINKPATHS)), $(search_dir))
echo. GROUP( >> __link__.tmp
$(foreach file, $(SYSLIBS), $(link_file))
echo. ) >> __link__.tmp
-$(LD) $(LDFLAGS) $(L_USR) $(LD_OUT)$@ __link__.tmp
endef
LDFLAGS = -mno-cygwin
AR = $(CCPREFIX)ar
ARFLAGS = $(A_USR)
RANLIB = $(CCPREFIX)ranlib
ifeq ($(SHLVL),) # COMMAND.COM - length of command line is limited
ifneq ($(OS),Windows_NT)
AR_RULE = $(create_library)
LD_RULE = $(link_exe_file)
endif
endif
ifeq ($(AR_RULE),)
AR_RULE = $(AR) $(ARFLAGS) cr $(LIB_DIR)/$@ $(^F) && $(RANLIB) $(LIB_DIR)/$@ || $(RM) $(LIB_DIR)/$@
# our libs have a lot of cross referenced now and we have to group them
# until we won't have cleaned them
LINKLIBS = $(LINKPATHS) -Wl,--start-group $(LDLIBS) -Wl,--end-group $(SYSLIBS)
endif
include $(TOP)$(ROOT)config/rules.cf