Include <stdlib.h> if available.
[bpt/emacs.git] / nt / makefile.def
1 #
2 # Makefile definition file for building GNU Emacs on Windows NT
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., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18 #
19 # Geoff Voelker (voelker@cs.washington.edu) 9-6-94
20
21 #
22 # BEGIN CONFIGURATION
23 #
24
25 # Define the following to build the GUI version
26 #
27 NTGUI=1
28
29 # Set INSTALL_DIR to be the directory into which you want emacs installed.
30 #
31 !ifndef INSTALL_DIR
32 INSTALL_DIR = C:\emacs
33 !endif
34
35 # Define MSVCNT11 to be nonzero if you are using the MSVCNT 1.1 environment.
36 # MSVCNT11 = 1
37 !ifndef MSVCNT11
38 MSVCNT11 = 0
39 !endif
40
41 #
42 # END CONFIGURATION
43 #
44
45 # Check that the INCLUDE and LIB environment variables are set.
46 #
47 !ifndef INCLUDE
48 !error The INCLUDE environment variable needs to be set.
49 !endif
50 !ifndef LIB
51 !error The LIB environment variable needs to be set.
52 !endif
53
54 # Determine the architecture we're running on.
55 # Define ARCH for our purposes;
56 # Define CPU for use by ntwin32.mak;
57 # Define CONFIG_H to the appropriate config.h for the system;
58 #
59 !ifdef PROCESSOR_ARCHITECTURE
60 # We're on Windows NT
61 CPU = $(PROCESSOR_ARCHITECTURE)
62 CONFIG_H = config.nt
63 OS_TYPE = windowsnt
64 ! if "$(PROCESSOR_ARCHITECTURE)" == "x86"
65 ARCH = i386
66 CPU = i386
67 ! else
68 ! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
69 ARCH = mips
70 ! else
71 ! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
72 ARCH = alpha
73 ! else
74 ! if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
75 ARCH = ppc
76 ! else
77 !error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
78 ! endif
79 ! endif
80 ! endif
81 ! endif
82 !else
83 # We're on Windows 95
84 ARCH = i386
85 CPU = i386
86 CONFIG_H = config.nt
87 OS_TYPE = windows95
88 !endif
89
90 # Include ntwin32.mak. So far, this file seems to be supported by every
91 # Microsoft compiler on NT and Windows 95 and properly defines the executable
92 # names and libraries necessary to build Emacs. I do not have access
93 # to any other vendor compilers, so I do not know if they supply this
94 # file, too. For now I'll assume that they do.
95 #
96 !include <ntwin32.mak>
97
98 # Using cvtres is necessary on NT 3.10 and doesn't hurt on later platforms.
99 CVTRES = cvtres.exe
100 AR = $(implib)
101 # The assignment $(CC) = $(cc) fails even though variables are case sensitive.
102 LINK_TMP = $(link)
103 LINK = $(LINK_TMP)
104 CC_TMP = $(cc)
105 CC = $(CC_TMP)
106
107 # advapi32.lib is left off of $(baselibs) on NT 3.10
108 !if "$(baselibs)" == "kernel32.lib "
109 ADVAPI32 = advapi32.lib
110 !else
111 ADVAPI32 =
112 !endif
113
114 # Older ntwin32.mak files do not define libc; do it for them.
115 !ifndef libc
116 libc = libc.lib
117 !endif
118
119 # The base libraries for compiling Emacs on NT. With MSVC, this should
120 # include oldnames.lib.
121 !if $(MSVCNT11)
122 BASE_LIBS = $(libc) $(baselibs) oldnames.lib
123 !else
124 BASE_LIBS = $(libc) $(baselibs) -nodefaultlib:oldnames.lib
125 !endif
126
127 # We want any debugging info in the executable.
128 !if "$(LINK)" == "link32"
129 SYS_LDFLAGS =
130 !else
131 SYS_LDFLAGS = -release -incremental:no -version:3.10
132 !endif
133
134 INC = -I.
135 !if "$(BUILD_TYPE)" == "spd"
136 CFLAGS_COMMON = -nologo $(INC) $(ARCH_CFLAGS) $(LOCAL_FLAGS) -DWIN32_LEAN_AND_MEAN -D$(ARCH) -Fd$(BLD)\vc.pdb
137 !else
138 CFLAGS_COMMON = -nologo $(INC) $(ARCH_CFLAGS) $(LOCAL_FLAGS) -DWIN32_LEAN_AND_MEAN -D$(ARCH) -Fd$(BLD)\vc.pdb -DEMACSDEBUG
139 !endif
140 !if $(MSVCNT11)
141 CFLAGS = $(CFLAGS_COMMON) -D_CRTAPI1=_cdecl
142 !else
143 CFLAGS = $(CFLAGS_COMMON) -D_CRTAPI1=_cdecl
144 !endif
145 !ifdef NTGUI
146 CFLAGS = $(CFLAGS) -DHAVE_NTGUI=1
147 !endif
148
149 !ifdef BUILD_TYPE
150 OBJDIR = obj-$(BUILD_TYPE)
151 !else
152 OBJDIR = obj
153 !endif
154 $(OBJDIR):; -mkdir $(OBJDIR)
155 BLD = $(OBJDIR)\$(ARCH)
156 $(BLD): $(OBJDIR)
157 -mkdir $(BLD)
158
159 CP = copy
160 CP_DIR = xcopy /f/r/i/e/d
161
162 !if "$(OS_TYPE)" == "windows95"
163 DEL = deltree /y
164 DEL_TREE = deltree /y
165 !else
166 DEL = del
167 # This is completely braindamaged, but it's the only routine known to be there
168 DEL_TREE = echo y | rmdir /s
169 !endif
170
171 # The location of the icon file
172 EMACS_ICON_PATH = ..\nt\emacs.ico
173
174 # Lets us add icons to the GNU Emacs folder
175 ADDPM = ..\nt\$(BLD)\addpm.exe
176
177 !if "$(ARCH)" == "i386"
178 !if "$(BUILD_TYPE)" == "spd"
179 ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Oxsb2 -G5dF -Zi
180 !else
181 ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -G3d -Zi -Od
182 !endif
183 ARCH_LDFLAGS = -align:0x1000 $(SYS_LDFLAGS)
184
185 !else
186 !if "$(ARCH)" == "mips"
187 ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
188 ARCH_LDFLAGS = -align:0x1000 $(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 = -align:0x2000 $(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 = -align:0x1000 $(SYS_LDFLAGS)
204
205 !else
206 !ERROR Unknown architecture type "$(ARCH)".
207 !endif
208 !endif
209 !endif
210 !endif