Update FSF's address.
[bpt/emacs.git] / nt / nmake.defs
1 # -*- Makefile -*- definition file for building GNU Emacs on Windows NT.
2 # Copyright (c) 2000-2001 Free Software Foundation, Inc.
3 #
4 # GNU Emacs is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # GNU Emacs is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Emacs; see the file COPYING. If not, write to
16 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 # Boston, MA 02110-1301, USA.
18
19 # Ensure 'all' is the default target
20 all:
21
22 THE_SHELL = $(COMSPEC)
23 SHELLTYPE=CMD
24
25 MAKETYPE=nmake
26
27 CURDIR = $(MAKEDIR:\=/)
28 THISDIR = $(MAKEDIR)
29
30 ALL_DEPS = $**
31
32 SUBSYSTEM_WINDOWS=-subsystem:windows
33 SUBSYSTEM_CONSOLE=-subsystem:console
34
35 # INSTALL_DIR is the directory into which emacs will be installed.
36 #
37 !ifndef INSTALL_DIR
38 INSTALL_DIR = $(CURDIR)/..
39 !endif
40
41 # Ensure EMACSLOADPATH is defined in the environment.
42 #
43 !if [set EMACSLOADPATH=foo]
44 !endif
45
46 # Allow detection of builds with MSVC 5 or later, so we can
47 # speed up compiles (see rule at end).
48 #
49 _NMAKE_VER_5=162
50 _NMAKE_VER_4=0
51
52 !IFNDEF _NMAKE_VER
53 _NMAKE_VER=$(_NMAKE_VER_4)
54 !ENDIF
55
56 # Check that the INCLUDE and LIB environment variables are set.
57 #
58 !ifndef INCLUDE
59 !error The INCLUDE environment variable needs to be set.
60 !endif
61 !ifndef LIB
62 !error The LIB environment variable needs to be set.
63 !endif
64
65 # Determine the architecture we're running on.
66 # Define ARCH for our purposes;
67 # Define CPU for use by ntwin32.mak;
68 # Define CONFIG_H to the appropriate config.h for the system;
69 #
70 !ifdef PROCESSOR_ARCHITECTURE
71 # We're on Windows NT
72 CPU = $(PROCESSOR_ARCHITECTURE)
73 CONFIG_H = config.nt
74 OS_TYPE = windowsnt
75 ! if "$(PROCESSOR_ARCHITECTURE)" == "x86"
76 ARCH = i386
77 CPU = i386
78 ! else
79 ! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
80 ARCH = mips
81 ! else
82 ! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
83 ARCH = alpha
84 ! else
85 ! if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
86 ARCH = ppc
87 ! else
88 ! error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
89 ! endif
90 ! endif
91 ! endif
92 ! endif
93 !else
94 # We're on Windows 95
95 ARCH = i386
96 CPU = i386
97 CONFIG_H = config.nt
98 OS_TYPE = windows95
99 !endif
100
101 AR = lib
102 AR_OUT = -out:
103 CC = cl
104 CC_OUT = -Fo
105 LINK = link
106 LINK_OUT = -out:
107 RC = rc
108 RC_OUT = -Fo
109 RC_INCLUDE = -i
110
111 libc = libc.lib
112 baselibs =
113 O = obj
114 A = lib
115
116 BASE_LIBS = $(libc) $(baselibs) oldnames.lib
117
118 ADVAPI32 = advapi32.lib
119 COMDLG32 = comdlg32.lib
120 GDI32 = gdi32.lib
121 MPR = mpr.lib
122 SHELL32 = shell32.lib
123 USER32 = user32.lib
124 WSOCK32 = wsock32.lib
125 WINMM = winmm.lib
126 WINSPOOL = winspool.lib
127
128 !ifdef NOOPT
129 DEBUG_CFLAGS = -DEMACSDEBUG
130 !else
131 DEBUG_CFLAGS =
132 !endif
133 CFLAGS = -I. -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0400 $(ARCH_CFLAGS) -D$(ARCH) \
134 -D_CRTAPI1=_cdecl $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
135 EMACS_EXTRA_C_FLAGS =
136
137 SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
138
139 # see comments in allocate_heap in w32heap.c before changing any of the
140 # -stack, -heap, or -base settings.
141 TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -debug:full -debugtype:both -pdb:$(BLD)\temacs.pdb -machine:$(ARCH) $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
142
143 !ifdef NOOPT
144 OBJDIR = obj
145 !else
146 OBJDIR = obj-spd
147 !endif
148 $(OBJDIR):; -mkdir $(OBJDIR)
149 BLD = $(OBJDIR)/$(ARCH)
150 $(BLD): $(OBJDIR)
151 -mkdir "$(BLD)"
152
153 COMPILER_TEMP_FILES = *.pdb
154
155 CP = cp -f
156 CP_DIR = cp -rf
157 IFNOTSAMEDIR = if not exist ..\same-dir.tst
158 ENDIF =
159 FOREACH = for %%f in (
160 FORVAR = %%f
161 FORDO = ) do
162 ENDFOR =
163 ARGQUOTE = "
164 # "
165 DQUOTE = \"
166 DEL = rm
167 DEL_TREE = rm -r
168
169 !ifdef NODEBUG
170 DEBUG_FLAG =
171 DEBUG_LINK =
172 !else
173 DEBUG_FLAG = -Zi
174 DEBUG_LINK = -debug:full -debugtype:both
175 !endif
176
177 !if "$(ARCH)" == "i386"
178 !ifdef NOOPT
179 ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
180 !else
181 ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
182 !endif
183 ARCH_LDFLAGS = $(SYS_LDFLAGS)
184
185 !else
186 !if "$(ARCH)" == "mips"
187 ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
188 ARCH_LDFLAGS = $(SYS_LDFLAGS)
189
190 !else
191 !if "$(ARCH)" == "alpha"
192 !if "$(BUILD_TYPE)" == "spd"
193 ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=
194 !else
195 ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=
196 !endif
197 ARCH_LDFLAGS = $(SYS_LDFLAGS)
198
199 !else
200 !if "$(ARCH)" == "ppc"
201 # These flags are a guess...if they don't work, please send me mail.
202 ARCH_CFLAGS = -D_PPC_=1 -c -Ze -Zi -W2 -Od
203 ARCH_LDFLAGS = $(SYS_LDFLAGS)
204
205 !else
206 !ERROR Unknown architecture type "$(ARCH)".
207 !endif
208 !endif
209 !endif
210 !endif
211
212 LINK_FLAGS = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(USER_LDFLAGS)
213
214 # From MSVC 5.0 onwards, it seem base relocation information is not included,
215 # at least in release builds. We need to ensure the reloc info is included
216 # in order to use the MSVC profiler.
217 !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
218 EXTRA_LINK =
219 !ELSE
220 EXTRA_LINK = -profile
221 !ENDIF
222
223 #
224 # If the compiler supports compiling multiple .c files to .o files at
225 # one time, use this feature.
226 #
227 !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
228 .c{$(BLD)}.obj:
229 $(CC) $(CFLAGS) -Fo$(BLD)\ $<
230 !ELSE
231 .c{$(BLD)}.obj::
232 $(CC) $(CFLAGS) -Fo$(BLD)\ $<
233 !ENDIF
234
235 # arch-tag: fefa49b0-c23c-46c7-9094-cab2a405058e