Sync to HEAD
[bpt/emacs.git] / nt / makefile.def
CommitLineData
efdeeb2b
GV
1#
2# Makefile definition file for building GNU Emacs on Windows NT
2821d967 3# Copyright (c) 1994-2001 Free Software Foundation, Inc.
177c0ea7 4#
efdeeb2b
GV
5# GNU Emacs is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2, or (at your option)
8# any later version.
177c0ea7 9#
efdeeb2b
GV
10# GNU Emacs is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
177c0ea7 14#
efdeeb2b
GV
15# You should have received a copy of the GNU General Public License
16# along with GNU Emacs; see the file COPYING. If not, write to
bf2b146b
EN
17# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18# Boston, MA 02111-1307, USA.
efdeeb2b
GV
19#
20# Geoff Voelker (voelker@cs.washington.edu) 9-6-94
21
22#
23# BEGIN CONFIGURATION
24#
25
0492cf29
GV
26# Define the following to build the GUI version
27#
28NTGUI=1
29
43648015 30# Set INSTALL_DIR to be the directory into which you want emacs installed.
efdeeb2b 31#
43648015
GV
32!ifndef INSTALL_DIR
33INSTALL_DIR = C:\emacs
34!endif
efdeeb2b 35
d51bca10
RS
36# Define MSVCNT11 to be nonzero if you are using the MSVCNT 1.1 environment.
37# MSVCNT11 = 1
d7a4f4fe 38!ifndef MSVCNT11
d51bca10 39MSVCNT11 = 0
d7a4f4fe 40!endif
d51bca10 41
efdeeb2b
GV
42#
43# END CONFIGURATION
44#
43648015 45
ec465548
GV
46#
47# Allow detection of builds with MSVC 5 or later
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
43648015
GV
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.
177c0ea7 66# Define ARCH for our purposes;
43648015
GV
67# Define CPU for use by ntwin32.mak;
68# Define CONFIG_H to the appropriate config.h for the system;
efdeeb2b 69#
43648015
GV
70!ifdef PROCESSOR_ARCHITECTURE
71# We're on Windows NT
72CPU = $(PROCESSOR_ARCHITECTURE)
73CONFIG_H = config.nt
27493233 74OS_TYPE = windowsnt
43648015
GV
75! if "$(PROCESSOR_ARCHITECTURE)" == "x86"
76ARCH = i386
77CPU = i386
78! else
79! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
80ARCH = mips
81! else
82! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
83ARCH = alpha
84! else
85! if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
86ARCH = 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
95ARCH = i386
96CPU = i386
ff4fcfcd 97CONFIG_H = config.nt
27493233 98OS_TYPE = windows95
43648015
GV
99!endif
100
101# Include ntwin32.mak. So far, this file seems to be supported by every
27493233 102# Microsoft compiler on NT and Windows 95 and properly defines the executable
177c0ea7
JB
103# names and libraries necessary to build Emacs. I do not have access
104# to any other vendor compilers, so I do not know if they supply this
43648015
GV
105# file, too. For now I'll assume that they do.
106#
107!include <ntwin32.mak>
efdeeb2b 108
43648015
GV
109# Using cvtres is necessary on NT 3.10 and doesn't hurt on later platforms.
110CVTRES = cvtres.exe
111AR = $(implib)
112# The assignment $(CC) = $(cc) fails even though variables are case sensitive.
113LINK_TMP = $(link)
114LINK = $(LINK_TMP)
115CC_TMP = $(cc)
116CC = $(CC_TMP)
117
118# advapi32.lib is left off of $(baselibs) on NT 3.10
119!if "$(baselibs)" == "kernel32.lib "
120ADVAPI32 = advapi32.lib
121!else
122ADVAPI32 =
123!endif
124
125# Older ntwin32.mak files do not define libc; do it for them.
126!ifndef libc
127libc = libc.lib
128!endif
129
130# The base libraries for compiling Emacs on NT. With MSVC, this should
131# include oldnames.lib.
d51bca10
RS
132!if $(MSVCNT11)
133BASE_LIBS = $(libc) $(baselibs) oldnames.lib
134!else
d7a4f4fe 135BASE_LIBS = $(libc) $(baselibs) -nodefaultlib:oldnames.lib
d51bca10 136!endif
43648015
GV
137
138# We want any debugging info in the executable.
139!if "$(LINK)" == "link32"
9e598d89 140SYS_LDFLAGS = -nologo
43648015 141!else
9e598d89 142SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10
43648015
GV
143!endif
144
ec465548
GV
145# Tag the executables to run out of the swapfile when execute off CD or network shares
146SYS_LDFLAGS = $(SYS_LDFLAGS) -swaprun:cd -swaprun:net
147
43648015 148INC = -I.
d7a4f4fe 149!if "$(BUILD_TYPE)" == "spd"
5f0fcedb 150CFLAGS_COMMON = -nologo $(INC) $(ARCH_CFLAGS) $(LOCAL_FLAGS) -DWIN32_LEAN_AND_MEAN -D$(ARCH) -Fd$(BLD)\vc.pdb
d7a4f4fe 151!else
5f0fcedb 152CFLAGS_COMMON = -nologo $(INC) $(ARCH_CFLAGS) $(LOCAL_FLAGS) -DWIN32_LEAN_AND_MEAN -D$(ARCH) -Fd$(BLD)\vc.pdb -DEMACSDEBUG
d7a4f4fe 153!endif
d51bca10
RS
154!if $(MSVCNT11)
155CFLAGS = $(CFLAGS_COMMON) -D_CRTAPI1=_cdecl
156!else
5f0fcedb 157CFLAGS = $(CFLAGS_COMMON) -D_CRTAPI1=_cdecl
d51bca10 158!endif
efdeeb2b 159
b5e9eb93
GV
160!ifdef BUILD_TYPE
161OBJDIR = obj-$(BUILD_TYPE)
162!else
efdeeb2b 163OBJDIR = obj
b5e9eb93 164!endif
43648015 165$(OBJDIR):; -mkdir $(OBJDIR)
efdeeb2b
GV
166BLD = $(OBJDIR)\$(ARCH)
167$(BLD): $(OBJDIR)
168 -mkdir $(BLD)
169
170CP = copy
0fc02397 171CP_DIR = xcopy /f/r/i/e/d/k
efdeeb2b 172
27493233 173!if "$(OS_TYPE)" == "windows95"
b2bc29b1
GV
174DEL = deltree /y
175DEL_TREE = deltree /y
176!else
177DEL = del
ec465548
GV
178# NT better way of killing a deltree
179DEL_TREE = rd /s/q
b2bc29b1 180!endif
efdeeb2b 181
01b96d5c
GV
182# Lets us add icons to the GNU Emacs folder
183ADDPM = ..\nt\$(BLD)\addpm.exe
184
43648015 185!if "$(ARCH)" == "i386"
b5e9eb93 186!if "$(BUILD_TYPE)" == "spd"
ec465548 187ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Oxsb2 -G6dF -Zi -Zp8
b5e9eb93 188!else
ebf8a96d 189ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Od -G3d -Zi -Zp8
b5e9eb93 190!endif
43648015 191ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
efdeeb2b 192
43648015
GV
193!else
194!if "$(ARCH)" == "mips"
195ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
196ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
efdeeb2b 197
43648015
GV
198!else
199!if "$(ARCH)" == "alpha"
d7a4f4fe
GV
200!if "$(BUILD_TYPE)" == "spd"
201ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=
202!else
203ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=
204!endif
43648015
GV
205ARCH_LDFLAGS = -align:0x2000 $(SYS_LDFLAGS)
206
207!else
208!if "$(ARCH)" == "ppc"
209# These flags are a guess...if they don't work, please send me mail.
210ARCH_CFLAGS = -D_PPC_=1 -c -Ze -Zi -W2 -Od
211ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
212
213!else
214!ERROR Unknown architecture type "$(ARCH)".
215!endif
216!endif
217!endif
218!endif
967c164c
GV
219
220#
221# If the compiler supports compiling multiple .c files to .o files at
222# one time, use this feature.
223#
224!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
225.c{$(BLD)}.obj:
226 $(CC) $(CFLAGS) -Fo$(BLD)\ $<
227!ELSE
228.c{$(BLD)}.obj::
229 $(CC) $(CFLAGS) -Fo$(BLD)\ $<
230!ENDIF
6b61353c
KH
231
232# arch-tag: a8aa26d5-5f28-4263-b42a-6f91acb7d824