Update nt/INSTALL for the latest changes in configury.
[bpt/emacs.git] / nt / nmake.defs
CommitLineData
bd6766d3 1# -*- Makefile -*- definition file for building GNU Emacs on Windows NT.\r
ba318903 2# Copyright (C) 2000-2014 Free Software Foundation, Inc.\r
eef0be9e
GM
3\r
4# This file is part of GNU Emacs.\r
5\r
6# GNU Emacs is free software: you can redistribute it and/or modify\r
7# it under the terms of the GNU General Public License as published by\r
8# the Free Software Foundation, either version 3 of the License, or\r
9# (at your option) any later version.\r
10\r
11# GNU Emacs is distributed in the hope that it will be useful,\r
12# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
14# GNU General Public License for more details.\r
15\r
16# You should have received a copy of the GNU General Public License\r
17# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.\r
18\r
039f725c
AI
19\r
20# Ensure 'all' is the default target\r
21all:\r
22\r
23THE_SHELL = $(COMSPEC)\r
24SHELLTYPE=CMD\r
a879f0ea 25SWITCHCHAR=/\r
039f725c
AI
26\r
27MAKETYPE=nmake\r
28\r
29CURDIR = $(MAKEDIR:\=/)\r
30THISDIR = $(MAKEDIR)\r
e5a69fd0 31DIRNAME =\r
039f725c
AI
32\r
33ALL_DEPS = $**\r
34\r
35SUBSYSTEM_WINDOWS=-subsystem:windows\r
36SUBSYSTEM_CONSOLE=-subsystem:console\r
37\r
38# INSTALL_DIR is the directory into which emacs will be installed.\r
39#\r
40!ifndef INSTALL_DIR\r
41INSTALL_DIR = $(CURDIR)/..\r
42!endif\r
43\r
44# Ensure EMACSLOADPATH is defined in the environment.\r
45#\r
46!if [set EMACSLOADPATH=foo]\r
47!endif\r
48\r
49# Allow detection of builds with MSVC 5 or later, so we can\r
50# speed up compiles (see rule at end).\r
51#\r
52_NMAKE_VER_5=162\r
53_NMAKE_VER_4=0\r
54\r
55!IFNDEF _NMAKE_VER\r
56_NMAKE_VER=$(_NMAKE_VER_4)\r
57!ENDIF\r
58\r
59# Check that the INCLUDE and LIB environment variables are set.\r
60#\r
61!ifndef INCLUDE\r
62!error The INCLUDE environment variable needs to be set.\r
63!endif\r
64!ifndef LIB\r
65!error The LIB environment variable needs to be set.\r
66!endif\r
67\r
68# Determine the architecture we're running on.\r
177c0ea7 69# Define ARCH for our purposes;\r
039f725c
AI
70# Define CPU for use by ntwin32.mak;\r
71# Define CONFIG_H to the appropriate config.h for the system;\r
72#\r
73!ifdef PROCESSOR_ARCHITECTURE\r
74# We're on Windows NT\r
75CPU = $(PROCESSOR_ARCHITECTURE)\r
76CONFIG_H = config.nt\r
77OS_TYPE = windowsnt\r
78! if "$(PROCESSOR_ARCHITECTURE)" == "x86"\r
79ARCH = i386\r
80CPU = i386\r
81! else\r
82! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"\r
83ARCH = mips\r
84! else\r
85! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"\r
86ARCH = alpha\r
87! else\r
88! if "$(PROCESSOR_ARCHITECTURE)" == "PPC"\r
89ARCH = ppc\r
90! else\r
62aba0d4
FP
91! if "$(PROCESSOR_ARCHITECTURE)" == "AMD64"\r
92ARCH = AMD64\r
93! else\r
94! error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"\r
95! endif\r
039f725c
AI
96! endif\r
97! endif\r
98! endif\r
99! endif\r
100!else\r
101# We're on Windows 95\r
102ARCH = i386\r
103CPU = i386\r
104CONFIG_H = config.nt\r
105OS_TYPE = windows95\r
106!endif\r
107\r
108AR = lib\r
109AR_OUT = -out:\r
110CC = cl\r
111CC_OUT = -Fo\r
112LINK = link\r
113LINK_OUT = -out:\r
62aba0d4 114RC = rc $(ARCH_RCFLAGS)\r
039f725c
AI
115RC_OUT = -Fo\r
116RC_INCLUDE = -i\r
117\r
a6fc3b5c
EZ
118USE_CRT_DLL = 1\r
119\r
53761081 120!if $(USE_CRT_DLL)\r
a6fc3b5c
EZ
121libc = msvcrt$(D).lib\r
122EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1\r
123!else\r
124libc = libcmt$(D).lib\r
125EMACS_EXTRA_C_FLAGS= -D_MT\r
126!endif\r
177c0ea7 127baselibs =\r
039f725c
AI
128O = obj\r
129A = lib\r
130\r
131BASE_LIBS = $(libc) $(baselibs) oldnames.lib\r
132\r
133ADVAPI32 = advapi32.lib\r
fc2554aa 134COMCTL32 = comctl32.lib\r
039f725c
AI
135COMDLG32 = comdlg32.lib\r
136GDI32 = gdi32.lib\r
137MPR = mpr.lib\r
138SHELL32 = shell32.lib\r
139USER32 = user32.lib\r
140WSOCK32 = wsock32.lib\r
a71f59c1 141WINMM = winmm.lib\r
0e664bca 142WINSPOOL = winspool.lib\r
a71f59c1 143OLE32 = ole32.lib\r
b7612703 144UNISCRIBE = usp10.lib\r
f4c45b4f 145UUID = uuid.lib\r
039f725c
AI
146\r
147!ifdef NOOPT\r
148DEBUG_CFLAGS = -DEMACSDEBUG\r
149!else\r
177c0ea7 150DEBUG_CFLAGS =\r
039f725c 151!endif\r
7d0170c8 152\r
06523364
EZ
153MWINDOWS = -subsystem:windows -entry:mainCRTStartup\r
154\r
62aba0d4 155CFLAGS = -I. $(ARCH_CFLAGS) -D_CRT_SECURE_NO_WARNINGS \\r
0566bc95 156 $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)\r
62aba0d4 157ESC_CFLAGS = -I. $(ARCH_CFLAGS) -D_CRT_SECURE_NO_WARNINGS \\r
0566bc95 158 $(DEBUG_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)\r
039f725c 159\r
a6fc3b5c 160#SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj\r
62aba0d4 161SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj\r
039f725c
AI
162\r
163# see comments in allocate_heap in w32heap.c before changing any of the\r
164# -stack, -heap, or -base settings.\r
62aba0d4
FP
165!if "$(ARCH)" == "i386"\r
166TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -pdb:$(BLD)\temacs.pdb -machine:x86 $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)\r
167!elseif "$(ARCH)" == "AMD64"\r
168TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x400000000 -pdb:$(BLD)\temacs.pdb -machine:x64 $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)\r
169!endif\r
039f725c
AI
170\r
171!ifdef NOOPT\r
172OBJDIR = obj\r
173!else\r
174OBJDIR = obj-spd\r
175!endif\r
176$(OBJDIR):; -mkdir $(OBJDIR)\r
177BLD = $(OBJDIR)/$(ARCH)\r
596cbf7e 178stamp_BLD: $(OBJDIR)\r
039f725c 179 -mkdir "$(BLD)"\r
596cbf7e 180 echo $(BLD) > $@\r
039f725c
AI
181\r
182COMPILER_TEMP_FILES = *.pdb\r
183\r
184CP = cp -f\r
185CP_DIR = cp -rf\r
e5a69fd0 186IFNOTSAMEDIR = if not exist ..\$(DIRNAME)_same-dir.tst\r
039f725c
AI
187ENDIF =\r
188FOREACH = for %%f in (\r
189FORVAR = %%f\r
190FORDO = ) do\r
191ENDFOR =\r
192ARGQUOTE = "\r
33d786f9 193# "\r
039f725c
AI
194DQUOTE = \"\r
195DEL = rm\r
196DEL_TREE = rm -r\r
197\r
198!ifdef NODEBUG\r
177c0ea7
JB
199DEBUG_FLAG =\r
200DEBUG_LINK =\r
a6fc3b5c 201D =\r
039f725c
AI
202!else\r
203DEBUG_FLAG = -Zi\r
a6fc3b5c
EZ
204DEBUG_LINK = -debug\r
205D = d\r
039f725c
AI
206!endif\r
207\r
75197633
CS
208# gcc-specific pragma (ignore for MSVC)\r
209PRAGMA_SYSTEM_HEADER =\r
210\r
039f725c
AI
211!if "$(ARCH)" == "i386"\r
212!ifdef NOOPT\r
a6fc3b5c
EZ
213#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)\r
214ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)\r
039f725c 215!else\r
a6fc3b5c
EZ
216#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)\r
217ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy -Gd $(DEBUG_FLAG)\r
039f725c
AI
218!endif\r
219ARCH_LDFLAGS = $(SYS_LDFLAGS)\r
62aba0d4
FP
220EMACS_HEAPSIZE = 27\r
221EMACS_PURESIZE = 5000000\r
222EMACS_MANIFEST = emacs-x86.manifest\r
039f725c
AI
223\r
224!else\r
225!if "$(ARCH)" == "mips"\r
226ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0\r
227ARCH_LDFLAGS = $(SYS_LDFLAGS)\r
62aba0d4
FP
228EMACS_HEAPSIZE = 27\r
229EMACS_PURESIZE = 5000000\r
230EMACS_MANIFEST = emacs-mips.manifest\r
039f725c
AI
231\r
232!else\r
233!if "$(ARCH)" == "alpha"\r
234!if "$(BUILD_TYPE)" == "spd"\r
235ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=\r
236!else\r
237ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=\r
238!endif\r
239ARCH_LDFLAGS = $(SYS_LDFLAGS)\r
62aba0d4
FP
240EMACS_HEAPSIZE = 27\r
241EMACS_PURESIZE = 5000000\r
242EMACS_MANIFEST = emacs-alpha.manifest\r
039f725c
AI
243\r
244!else\r
245!if "$(ARCH)" == "ppc"\r
246# These flags are a guess...if they don't work, please send me mail.\r
039f725c 247ARCH_LDFLAGS = $(SYS_LDFLAGS)\r
62aba0d4
FP
248EMACS_HEAPSIZE = 27\r
249EMACS_PURESIZE = 5000000\r
250EMACS_MANIFEST = emacs-ppc.manifest\r
251\r
252!else\r
253!if "$(ARCH)" == "AMD64"\r
254!ifdef NOOPT\r
255ARCH_CFLAGS = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl -Zp8 -W2 -Od -Gd -Wp64 $(DEBUG_FLAG)\r
256!else\r
257ARCH_CFLAGS = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl -Zp8 -W2 -O2x -GF -Gy -Gd $(DEBUG_FLAG)\r
258!endif\r
259ARCH_LDFLAGS = $(SYS_LDFLAGS) -machine:x64\r
260ARCH_RCFLAGS = -DWIN64\r
261EMACS_HEAPSIZE = 42\r
262EMACS_PURESIZE = 10000000\r
263EMACS_MANIFEST = emacs-x64.manifest\r
039f725c
AI
264\r
265!else\r
266!ERROR Unknown architecture type "$(ARCH)".\r
267!endif\r
268!endif\r
269!endif\r
270!endif\r
62aba0d4 271!endif\r
039f725c
AI
272\r
273LINK_FLAGS = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(USER_LDFLAGS)\r
274\r
275# From MSVC 5.0 onwards, it seem base relocation information is not included,\r
276# at least in release builds. We need to ensure the reloc info is included\r
277# in order to use the MSVC profiler.\r
278!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")\r
279EXTRA_LINK =\r
280!ELSE\r
281EXTRA_LINK = -profile\r
282!ENDIF\r
283\r
284#\r
285# If the compiler supports compiling multiple .c files to .o files at\r
286# one time, use this feature.\r
287#\r
288!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")\r
289.c{$(BLD)}.obj:\r
290 $(CC) $(CFLAGS) -Fo$(BLD)\ $<\r
291!ELSE\r
292.c{$(BLD)}.obj::\r
293 $(CC) $(CFLAGS) -Fo$(BLD)\ $<\r
294!ENDIF\r