*** empty log message ***
[emacs.git] / nt / makefile.def
blob6fb05dfd20a63c4224259ab0c81d5e8f1b1062c4
2 # Makefile definition file for building GNU Emacs on Windows NT
3 # Copyright (c) 1994-2001 Free Software Foundation, Inc.
4 #
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.
9 #
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.
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
17 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA.
20 # Geoff Voelker (voelker@cs.washington.edu) 9-6-94
23 # BEGIN CONFIGURATION
26 # Define the following to build the GUI version
28 NTGUI=1
30 # Set INSTALL_DIR to be the directory into which you want emacs installed.
32 !ifndef INSTALL_DIR
33 INSTALL_DIR = C:\emacs
34 !endif
36 # Define MSVCNT11 to be nonzero if you are using the MSVCNT 1.1 environment.
37 # MSVCNT11 = 1
38 !ifndef MSVCNT11
39 MSVCNT11 = 0
40 !endif
43 # END CONFIGURATION
47 # Allow detection of builds with MSVC 5 or later
49 _NMAKE_VER_5=162
50 _NMAKE_VER_4=0
52 !IFNDEF _NMAKE_VER
53 _NMAKE_VER=$(_NMAKE_VER_4)
54 !ENDIF
56 # Check that the INCLUDE and LIB environment variables are set.
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
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;
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
101 # Include ntwin32.mak. So far, this file seems to be supported by every
102 # Microsoft compiler on NT and Windows 95 and properly defines the executable
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
105 # file, too. For now I'll assume that they do.
107 !include <ntwin32.mak>
109 # Using cvtres is necessary on NT 3.10 and doesn't hurt on later platforms.
110 CVTRES = cvtres.exe
111 AR = $(implib)
112 # The assignment $(CC) = $(cc) fails even though variables are case sensitive.
113 LINK_TMP = $(link)
114 LINK = $(LINK_TMP)
115 CC_TMP = $(cc)
116 CC = $(CC_TMP)
118 # advapi32.lib is left off of $(baselibs) on NT 3.10
119 !if "$(baselibs)" == "kernel32.lib "
120 ADVAPI32 = advapi32.lib
121 !else
122 ADVAPI32 =
123 !endif
125 # Older ntwin32.mak files do not define libc; do it for them.
126 !ifndef libc
127 libc = libc.lib
128 !endif
130 # The base libraries for compiling Emacs on NT. With MSVC, this should
131 # include oldnames.lib.
132 !if $(MSVCNT11)
133 BASE_LIBS = $(libc) $(baselibs) oldnames.lib
134 !else
135 BASE_LIBS = $(libc) $(baselibs) -nodefaultlib:oldnames.lib
136 !endif
138 # We want any debugging info in the executable.
139 !if "$(LINK)" == "link32"
140 SYS_LDFLAGS = -nologo
141 !else
142 SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10
143 !endif
145 # Tag the executables to run out of the swapfile when execute off CD or network shares
146 SYS_LDFLAGS = $(SYS_LDFLAGS) -swaprun:cd -swaprun:net
148 INC = -I.
149 !if "$(BUILD_TYPE)" == "spd"
150 CFLAGS_COMMON = -nologo $(INC) $(ARCH_CFLAGS) $(LOCAL_FLAGS) -DWIN32_LEAN_AND_MEAN -D$(ARCH) -Fd$(BLD)\vc.pdb
151 !else
152 CFLAGS_COMMON = -nologo $(INC) $(ARCH_CFLAGS) $(LOCAL_FLAGS) -DWIN32_LEAN_AND_MEAN -D$(ARCH) -Fd$(BLD)\vc.pdb -DEMACSDEBUG
153 !endif
154 !if $(MSVCNT11)
155 CFLAGS = $(CFLAGS_COMMON) -D_CRTAPI1=_cdecl
156 !else
157 CFLAGS = $(CFLAGS_COMMON) -D_CRTAPI1=_cdecl
158 !endif
160 !ifdef BUILD_TYPE
161 OBJDIR = obj-$(BUILD_TYPE)
162 !else
163 OBJDIR = obj
164 !endif
165 $(OBJDIR):; -mkdir $(OBJDIR)
166 BLD = $(OBJDIR)\$(ARCH)
167 $(BLD): $(OBJDIR)
168 -mkdir $(BLD)
170 CP = copy
171 CP_DIR = xcopy /f/r/i/e/d/k
173 !if "$(OS_TYPE)" == "windows95"
174 DEL = deltree /y
175 DEL_TREE = deltree /y
176 !else
177 DEL = del
178 # NT better way of killing a deltree
179 DEL_TREE = rd /s/q
180 !endif
182 # Lets us add icons to the GNU Emacs folder
183 ADDPM = ..\nt\$(BLD)\addpm.exe
185 !if "$(ARCH)" == "i386"
186 !if "$(BUILD_TYPE)" == "spd"
187 ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Oxsb2 -G6dF -Zi -Zp8
188 !else
189 ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Od -G3d -Zi -Zp8
190 !endif
191 ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
193 !else
194 !if "$(ARCH)" == "mips"
195 ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
196 ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
198 !else
199 !if "$(ARCH)" == "alpha"
200 !if "$(BUILD_TYPE)" == "spd"
201 ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=
202 !else
203 ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=
204 !endif
205 ARCH_LDFLAGS = -align:0x2000 $(SYS_LDFLAGS)
207 !else
208 !if "$(ARCH)" == "ppc"
209 # These flags are a guess...if they don't work, please send me mail.
210 ARCH_CFLAGS = -D_PPC_=1 -c -Ze -Zi -W2 -Od
211 ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
213 !else
214 !ERROR Unknown architecture type "$(ARCH)".
215 !endif
216 !endif
217 !endif
218 !endif
221 # If the compiler supports compiling multiple .c files to .o files at
222 # one time, use this feature.
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