Files
harbour-core/harbour/config/win/msvc.mk
Viktor Szakats 43d25e7367 2010-06-17 19:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* config/wce/mingwarm.mk
  * config/wce/msvcarm.mk
  * config/win/mingw.mk
  * config/win/icc.mk
  * config/win/cygwin.mk
  * config/win/msvc.mk
    ! Removed delete command which was called when $(AR) command failed.
        (usually: '|| $(RM) $(subst /,$(DIRSEP),$(LIB_DIR)/$@)')
     This fixes three issues:
      - It won't force GNU Make into using cmd shell (in fact temporary batch file)
        to execute these commands, thus it won't hit cmd shell length limitations
        on NT and W2K systems (maybe Win9x also? TOCHECK).
      - Build process will properly stop in case $(AR) (lib assembly) command
        fails, instead of deleting the wrong lib and continuing with the build.
        Best would be to delete it and fail, but I found no clean way to do this.
      - This incorrect variation is no longer used: '|| $(RM) $(LIB_DIR)/$@'
        (pathsep conversion is missing)
     NOTE: If someone can recommend a way to fail the build after deleting 
           the partial lib, all above logic can be reintroduced, but in this 
           case the lib creation cmds need to be rewritten like mingw to 
           avoid long cmdline lengths.
           IOW I'm looking for a win shell equivalent of this sequence:
              AR_RULE = $(AR) ... || ( $(RM) ... && **false** )
           where **false** is something which creates no output and returns
           non-zero errorlevel.

  * ChangeLog
    + More explanation to prev log entry.
2010-06-17 17:04:00 +00:00

107 lines
2.3 KiB
Makefile

#
# $Id$
#
OBJ_EXT := .obj
LIB_PREF :=
LIB_EXT := .lib
HB_DYN_COPT := -DHB_DYNLIB
CC := cl.exe
CC_IN := -c
CC_OUT := -Fo
CFLAGS += -I. -I$(HB_INC_COMPILE)
CFLAGS += -nologo
# MSVS 2005 SP1 also supports it, but we only enable it for 2008 and upper.
ifeq ($(filter $(HB_COMPILER_VER),1200 1300 1310 1400),)
LDFLAGS += -nxcompat -dynamicbase -fixed:no
DFLAGS += -nxcompat -dynamicbase
endif
ifeq ($(HB_BUILD_MODE),c)
CFLAGS += -TC
endif
ifeq ($(HB_BUILD_MODE),cpp)
CFLAGS += -TP
endif
# Build in C++ mode by default
ifeq ($(HB_BUILD_MODE),)
CFLAGS += -TP
endif
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -W4 -wd4127
else
CFLAGS += -W2
endif
ifneq ($(HB_BUILD_OPTIM),no)
ifneq ($(filter $(HB_COMPILER_VER),1200 1300 1310),)
CFLAGS += -Ogt2yb1p -GX- -G6
else
CFLAGS += -O2
endif
endif
ifeq ($(HB_BUILD_DEBUG),yes)
CFLAGS += -Zi
LDFLAGS += -debug
DFLAGS += -debug
endif
ifneq ($(filter $(HB_COMPILER_VER),1200 1300 1310),)
ifeq ($(HB_BUILD_DEBUG),yes)
CFLAGS += -MTd
else
CFLAGS += -MT
endif
endif
RC := rc.exe
RC_OUT := -fo$(subst x,x, )
# Windows SDK 7.0 also supports it, but we cannot detect it.
ifeq ($(filter $(HB_COMPILER_VER),1200 1300 1310 1400 1500),)
RCFLAGS += -nologo
endif
# # NOTE: -GA flag should be disabled when building MT _.dlls_,
# # as it creates bad code according to MS docs [vszakats].
# ifneq ($(filter $(HB_COMPILER_VER),1200),)
# CFLAGS += -GA
# endif
LD := link.exe
LD_OUT := -out:
LIBPATHS := -libpath:$(LIB_DIR)
LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),$(lib)$(LIB_EXT))
LDFLAGS += -nologo $(LIBPATHS)
AR := lib.exe
AR_RULE = $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) -nologo -out:$(LIB_DIR)/$@ $(^F)
DY := $(LD)
DFLAGS += -nologo -dll -subsystem:console $(LIBPATHS)
DY_OUT := $(LD_OUT)
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),$(lib)$(LIB_EXT))
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define dynlib_object
@$(ECHO) $(ECHOQUOTE)$(file)$(ECHOQUOTE) >> __dyn__.tmp
endef
define create_dynlib
$(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,)
$(foreach file,$^,$(dynlib_object))
$(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)"$(subst /,$(DIRSEP),$(DYN_DIR)/$@)" -implib:"$(IMP_FILE)" @__dyn__.tmp $(DLIBS)
endef
DY_RULE = $(create_dynlib)
include $(TOP)$(ROOT)config/rules.mk