summaryrefslogtreecommitdiff
path: root/include/makeinclude/platform_win32_msvc.GNU
blob: 962f8870ec5408708de72f5d7b952fa4cdc9b08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# -*- Makefile -*-
# $Id$

# TODO:
# - per-source-file flag_overrides (gnu.mpd)

# Include this file from platform_macros.GNU to build with sh and GNU make
# and the Visual C++ compiler and linker.
# Tested with the MSYS shell and make from msysCORE-1.0.11-20080826.tar.gz and
# the Visual C++ 9 toolchain (Visual C++ 2008 Express Edition) - SP1.

# Assuming the msysCORE archive is extracted to c:\msys...
# Start the Visual C++ Command Prompt
# Set ACE_ROOT (TAO_ROOT, CIAO_ROOT, DDS_ROOT)
# Add C:\msys\bin to PATH along with %ACE_ROOT%\lib and %ACE_ROOT%\bin
# If necessary, generate GNUmakefiles with MPC (set MPC_ROOT, use -type gnuace)
# Run "make"

# - library naming
#   - dynamic: ACE.dll, ACE.lib is the "import library"
#   - static:  ACE.lib
#   - no "s" suffix added for static, so static and dynamic can't coexist
#   - no other modifiers are added to the name (no ACEd.dll, ACEmfc.dll)
# - user-customizable make variables
#   - everything in the "Defaults" section (plus inline)
#   - SUBSYSTEM: defaults to CONSOLE for exes, WINDOWS for libs
#   - CRT_TYPE: defaults to D (dynamic) for shared libs, T (static) for static

# Defaults
debug       ?= 1
optimize    ?= 0
#inline determined below, defaults to !debug
CPU         ?= X86
winnt       ?= 1
winregistry ?= 1
wfmo        ?= 1
qos         ?= 1

# Programs
CC  = cl
CXX = $(CC)
RC  = rc
LD  = link
DLD = $(LD)
AR  = $(LD)

# File naming
EXEEXT = .exe
SOEXT  = dll
OBJEXT = obj
LIBEXT = lib
LIB_PREFIX =
versioned_so = 0

# Need forward slashes for paths going through sh.exe
ACE_ROOT := $(subst \,/,$(ACE_ROOT))

# Options
PIC =
CC_OUTPUT_FLAG = -Fo
CC_OUTPUT_FLAG_SEP =
CPPFLAGS += -DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
CFLAGS += -Zc:wchar_t -nologo -W3 -EHsc -GR -wd4355 -Fd$(INTDIR)
ARFLAGS = -lib -nologo -machine:$(CPU)
MSVC_LDFLAGS = -incremental:no -nologo -subsystem:$(SUBSYSTEM) -machine:$(CPU)
ifeq (,$(BIN_UNCHECKED))
  SUBSYSTEM ?= WINDOWS
else
  SUBSYSTEM ?= CONSOLE
  REALCLEAN_FILES += $(BIN).manifest $(BIN_UNCHECKED).pdb
endif
ifeq (1,$(optimize))
  CFLAGS += -O2
else
  CFLAGS += -Ob0
endif
ifeq (1,$(static_libs_only))
  static_libs = 1
endif
ifeq (1,$(static_libs))
  shared_libs = 0
  shared_libs_only = 0
  CRT_TYPE ?= T
  INTDIR = $(VDIR)
else
  static_libs = 0
  static_libs_only = 0
  CRT_TYPE ?= D
  ifneq (,$(BIN_UNCHECKED))
    INTDIR = $(VDIR)
  else
    INTDIR = $(VSHDIR)
  endif
  MSVC_IMPLIB = $(LIB_NAME).lib
  MSVC_DLLFLAGS += -dll -implib:$(MSVC_IMPLIB)
  REALCLEAN_FILES += $(LIB_NAME).dll $(INSLIB)/$(LIB_NAME).dll $(LIB_NAME).exp
  REALCLEAN_FILES += $(LIB_NAME).dll.manifest
endif
ifneq (,$(LIB_NAME))
  REALCLEAN_FILES += $(LIB_NAME).lib $(INSLIB)/$(LIB_NAME).lib $(LIB_NAME).pdb
endif
ifeq (1,$(debug))
  CPPFLAGS += -D_DEBUG
  CFLAGS += -Zi -M$(CRT_TYPE)d -Gy -Gm
  inline ?= 0
  MSVC_LDFLAGS += -DEBUG
  MSVC_DLLFLAGS += -pdb:$(subst dll,pdb,$@)
  MSVC_EXEFLAGS += -pdb:$(subst exe,pdb,$@)
else
  CPPFLAGS += -DNDEBUG
  CFLAGS += -M$(CRT_TYPE)
  inline ?= 1
endif
CCFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
RC_INCLUDE_FLAG = -I
RC_OUTPUT_FLAG = -fo
SYSTEMLIBS += advapi32.lib user32.lib
MSVC_LINK = $(LD) $(SYSTEMLIBS) $(MSVC_LDFLAGS) $(patsubst -L%,-libpath:%, $(subst /,\,$(LDFLAGS))) $(patsubst -l%,%.lib,$(ACE_SHLIBS)) $(LIBS) -out:$@
define SOLINK.cc.override
$(MSVC_LINK) $(MSVC_DLLFLAGS) $^
	mt -nologo -manifest $@.manifest -outputresource:$@\;2
	@if test . != $(INSLIB) -a $(call PWD) != $(INSLIB) -a -r $(MSVC_IMPLIB) ; then \
		cp $(MSVC_IMPLIB) $(INSLIB) ; \
	fi
endef
define LINK.cc.override
$(MSVC_LINK) $(MSVC_EXEFLAGS) $(filter-out %.lib,$(filter-out %.a,$^)) $(patsubst -l%,%.lib,$(VLDLIBS)) $(POSTLINK)
	@if test -r $@.manifest ; then \
		mt -nologo -manifest $@.manifest -outputresource:$@\;1 ; \
	fi
endef
AR.cc.override = $(AR) $(ARFLAGS) -out:$@ $^ $(AREXTRA)

#this is not mingw32, but the makefiles in ACE should act like it is
mingw32 = 1