root/trunk/nt/gmake.mw32.defs
| Revision 4214, 7.9 kB (checked in by miyoshi, 1 year ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | # -*- Makefile -*- definition file for building GNU Emacs on the |
| 2 | # Microsoft W32 API. |
| 3 | # Copyright (c) 2000, 2001, 2002, 2003, 2004, |
| 4 | # 2005 Free Software Foundation, Inc. |
| 5 | # |
| 6 | # GNU Emacs is free software; you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; either version 2, or (at your option) |
| 9 | # any later version. |
| 10 | # |
| 11 | # GNU Emacs is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with GNU Emacs; see the file COPYING. If not, write to |
| 18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | # Boston, MA 02110-1301, USA. |
| 20 | |
| 21 | # Ensure 'all' is the default target |
| 22 | all: |
| 23 | |
| 24 | # NOTES |
| 25 | # |
| 26 | # I tried to force gmake to use the native shell for simplicity, by |
| 27 | # setting SHELL as below, but this didn't work reliably because of |
| 28 | # various case sensitivity niggles. Specifically, COMSPEC (which is in |
| 29 | # fact usually spelled ComSpec on NT, to make life difficult) typically |
| 30 | # references "cmd.exe" (on NT) when the file is actually called |
| 31 | # "CMD.EXE" on disk for hysterical raisons. As a result, GNU make |
| 32 | # thinks it doesn't exist (unless compiled with a switch to ignore |
| 33 | # case), and so doesn't change which shell it will invoke to execute |
| 34 | # commands. |
| 35 | # |
| 36 | # It would be possible, though very tedious using just gmake facilities, |
| 37 | # to convert the COMSPEC value to uppercase to solve this problem, but |
| 38 | # it isn't worth it. That is partly because, even when using the native |
| 39 | # shell, gmake tends to not be happy with backslashes in command |
| 40 | # strings. The obvious solution is to use forward slashes as much as |
| 41 | # possible, which can be made to work most of the time (putting |
| 42 | # filenames in quotes often helps), but there are still some internal |
| 43 | # cmd.exe commands like `del' and `copy' that won't work with them. |
| 44 | # Although it is possible to convert slashes to backslashes when |
| 45 | # necessary, gmake requires explicitly calling its subst function, which |
| 46 | # nmake does not understand). For this reason, it is simplest to |
| 47 | # mandate that rm and cp be available, so we can use Unix-format file |
| 48 | # names everywhere. (Fortunately both MS and GNU make, and the |
| 49 | # respective compilers, are happy with Unix-format names.) |
| 50 | # |
| 51 | # Since we cannot easily force the choice of a particular shell, we must |
| 52 | # make the effort to cope with whichever shell is being used. |
| 53 | # Fortunately, the only command we need to use that is shell specific is |
| 54 | # the testing of a file's existence for the purpose of working out when |
| 55 | # we are copying files to their original location. That particular |
| 56 | # requirement is abstracted easily enough. |
| 57 | # |
| 58 | # The only other problem area was the change of directory when running |
| 59 | # temacs to dump emacs.exe (where gmake doesn't support cd foo in any |
| 60 | # useful way), but that has been resolved by modifying the Windows |
| 61 | # unexec function slightly to not require the directory change while |
| 62 | # still allowing objects and binaries to be in subdirectories. |
| 63 | |
| 64 | # This doesn't work. |
| 65 | #SHELL:=$(COMSPEC) |
| 66 | |
| 67 | include ../nt/meadow.defs |
| 68 | |
| 69 | # Determine whether make is using sh or cmd/command as shell; cmd.exe |
| 70 | # will output "ECHO is on" when echo is given by itself, while sh will |
| 71 | # not produce any output. |
| 72 | sh_output := $(shell echo) |
| 73 | ifeq "$(findstring ECHO, $(sh_output))" "ECHO" |
| 74 | THE_SHELL = $(COMSPEC)$(ComSpec) |
| 75 | SHELLTYPE=CMD |
| 76 | else |
| 77 | USING_SH = 1 |
| 78 | THE_SHELL = $(SHELL) |
| 79 | SHELLTYPE=SH |
| 80 | endif |
| 81 | |
| 82 | MAKETYPE=gmake |
| 83 | |
| 84 | # The following "ifeq" does not appear to DTRT, and therefore breaks |
| 85 | # the build on mingw32. Also the -m option does not exist in many |
| 86 | # (reasonably recent even) versions of Cygwin. These issues need to be |
| 87 | # remedied before putting this cygpath kludge back in. |
| 88 | |
| 89 | # Convert CURDIR to native file name, if in Cygwin format |
| 90 | ifeq "$(shell cygpath $(CURDIR))" "$(CURDIR)" |
| 91 | CURDIR := $(shell cygpath -m $(CURDIR)) |
| 92 | endif |
| 93 | |
| 94 | THISDIR = . |
| 95 | |
| 96 | # Cygwin has changed quoting rules somewhat since b20, in a way that |
| 97 | # affects makefiles using sh as the command processor, so we need to |
| 98 | # detect which rules to use. |
| 99 | # Now Meadow2 requires new Cygwin and suppress this noisy warnings. |
| 100 | ifdef USING_SH |
| 101 | NEW_CYGWIN = 1 |
| 102 | endif |
| 103 | |
| 104 | ALL_DEPS = $^ |
| 105 | EMPTY = |
| 106 | SPACE = $(EMPTY) $(EMPTY) |
| 107 | |
| 108 | SUBSYSTEM_WINDOWS=-Wl,-subsystem,windows |
| 109 | SUBSYSTEM_CONSOLE=-Wl,-subsystem,console |
| 110 | |
| 111 | # INSTALL_DIR is the directory into which emacs will be installed. |
| 112 | # |
| 113 | ifndef INSTALL_DIR |
| 114 | INSTALL_DIR = c:/Meadow |
| 115 | endif |
| 116 | |
| 117 | INSTALL_DIR_M = $(shell cygpath -u $(INSTALL_DIR)) |
| 118 | INSTALL_DIR_M_DOS = $(shell cygpath -w $(INSTALL_DIR_M)) |
| 119 | INSTALL_DIR_DOS = $(shell cygpath -w $(INSTALL_DIR)) |
| 120 | |
| 121 | export EMACSLOADPATH |
| 122 | |
| 123 | # Determine the architecture we're running on. |
| 124 | # Define ARCH for our purposes; |
| 125 | # Define CPU for use by ntwin32.mak; |
| 126 | # Define CONFIG_H to the appropriate config.h for the system; |
| 127 | # |
| 128 | ifdef PROCESSOR_ARCHITECTURE |
| 129 | # We're on Windows NT |
| 130 | CPU = $(PROCESSOR_ARCHITECTURE) |
| 131 | CONFIG_H = config.nt |
| 132 | OS_TYPE = windowsnt |
| 133 | ifeq "$(PROCESSOR_ARCHITECTURE)" "x86" |
| 134 | ARCH = i386 |
| 135 | CPU = i386 |
| 136 | else |
| 137 | ifeq "$(PROCESSOR_ARCHITECTURE)" "MIPS" |
| 138 | ARCH = mips |
| 139 | else |
| 140 | ifeq "$(PROCESSOR_ARCHITECTURE)" "ALPHA" |
| 141 | ARCH = alpha |
| 142 | else |
| 143 | ifeq "$(PROCESSOR_ARCHITECTURE)" "PPC" |
| 144 | ARCH = ppc |
| 145 | else |
| 146 | error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)" |
| 147 | endif |
| 148 | endif |
| 149 | endif |
| 150 | endif |
| 151 | else |
| 152 | # We're on Windows 95 |
| 153 | ARCH = i386 |
| 154 | CPU = i386 |
| 155 | CONFIG_H = config.nt |
| 156 | OS_TYPE = windows95 |
| 157 | endif |
| 158 | |
| 159 | AR = ar -rsc |
| 160 | AR_OUT = |
| 161 | CC = gcc |
| 162 | CC_OUT = -o$(SPACE) |
| 163 | LINK = gcc |
| 164 | LINK_OUT = -o$(SPACE) |
| 165 | RC = windres -O coff |
| 166 | RC_OUT = -o$(SPACE) |
| 167 | RC_INCLUDE = --include-dir$(SPACE) |
| 168 | |
| 169 | libc = |
| 170 | baselibs = |
| 171 | O = o |
| 172 | A = a |
| 173 | |
| 174 | BASE_LIBS = $(libc) $(baselibs) |
| 175 | |
| 176 | ADVAPI32 = -ladvapi32 |
| 177 | COMCTL32 = -lcomctl32 |
| 178 | COMDLG32 = -lcomdlg32 |
| 179 | GDI32 = -lgdi32 |
| 180 | MPR = -lmpr |
| 181 | SHELL32 = -lshell32 |
| 182 | USER32 = -luser32 |
| 183 | WSOCK32 = -lwsock32 |
| 184 | WINSPOOL = -lwinspool |
| 185 | OLE32 = -lole32 |
| 186 | UUID = -luuid |
| 187 | |
| 188 | ifdef NOOPT |
| 189 | DEBUG_CFLAGS = -DEMACSDEBUG |
| 190 | else |
| 191 | DEBUG_CFLAGS = |
| 192 | endif |
| 193 | CFLAGS = -I. -DWIN32_LEAN_AND_MEAN $(ARCH_CFLAGS) -D$(ARCH) \ |
| 194 | -D_CRTAPI1=_cdecl \ |
| 195 | $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) |
| 196 | CFLAGS += -DMEADOW="\"$(MEADOW_VERSION)\"" \ |
| 197 | -DMEADOW_VERSION_STRING=$(MEADOW_VERSION_STRING) \ |
| 198 | -DW32_VER4 -DWINVER=$(WINVER) |
| 199 | |
| 200 | EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1 |
| 201 | |
| 202 | # see comments in allocate_heap in w32heap.c before changing any of the |
| 203 | # -stack, -heap, or -image-base settings. |
| 204 | TEMACS_EXTRA_LINK = -Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 $(SUBSYSTEM_CONSOLE) -Wl,-entry,__start -Wl,-Map,$(BLD)/temacs.map |
| 205 | |
| 206 | ifdef NOOPT |
| 207 | OBJDIR = oo |
| 208 | else |
| 209 | OBJDIR = oo-spd |
| 210 | endif |
| 211 | $(OBJDIR):; -mkdir "$(OBJDIR)" |
| 212 | BLD = $(OBJDIR)/$(ARCH) |
| 213 | stamp_BLD: $(OBJDIR) |
| 214 | -mkdir "$(BLD)" |
| 215 | echo $(BLD) > $@ |
| 216 | |
| 217 | COMPILER_TEMP_FILES = |
| 218 | |
| 219 | CP = cp -f |
| 220 | ifeq "$(OS_TYPE)" "windows95" |
| 221 | CP_DIR = xcopy /f/r/i/e/d/k/y |
| 222 | else |
| 223 | CP_DIR = xcopy /f/r/i/e/d/k/y /EXCLUDE:"..\nt\excludes.Meadow" |
| 224 | endif |
| 225 | DEL = rm -f |
| 226 | DEL_TREE = rm -rf |
| 227 | MV = mv -f |
| 228 | |
| 229 | ifdef USING_SH |
| 230 | |
| 231 | IFNOTSAMEDIR = if [ ! -s ../same-dir.tst ] ; then |
| 232 | FOREACH = for f in |
| 233 | FORVAR = $${f} |
| 234 | FORDO = ; do |
| 235 | ENDFOR = ; done |
| 236 | ENDIF = ; fi |
| 237 | ARGQUOTE = ' |
| 238 | ifdef NEW_CYGWIN |
| 239 | DQUOTE = " |
| 240 | else |
| 241 | DQUOTE = "" |
| 242 | endif |
| 243 | |
| 244 | else |
| 245 | |
| 246 | IFNOTSAMEDIR = if not exist ../same-dir.tst |
| 247 | FOREACH = for %%f in ( |
| 248 | FORVAR = %%f |
| 249 | FORDO = ) do |
| 250 | ENDFOR = |
| 251 | ENDIF = |
| 252 | ARGQUOTE = " |
| 253 | DQUOTE = \" |
| 254 | |
| 255 | endif |
| 256 | |
| 257 | ifdef NODEBUG |
| 258 | DEBUG_FLAG = |
| 259 | DEBUG_LINK = -s |
| 260 | else |
| 261 | DEBUG_FLAG = -gstabs+ -g3 |
| 262 | DEBUG_LINK = -gstabs+ -g3 |
| 263 | endif |
| 264 | |
| 265 | ifdef NOCYGWIN |
| 266 | NOCYGWIN = -mno-cygwin |
| 267 | endif |
| 268 | |
| 269 | ifeq "$(ARCH)" "i386" |
| 270 | ifdef NOOPT |
| 271 | ARCH_CFLAGS = -D_X86_=1 -c $(DEBUG_FLAG) $(NOCYGWIN) |
| 272 | else |
| 273 | ARCH_CFLAGS = -D_X86_=1 -c $(DEBUG_FLAG) $(NOCYGWIN) $(MCPU_FLAG) -O2 \ |
| 274 | # -fbuiltin \ |
| 275 | # -finline-functions \ |
| 276 | # -fomit-frame-pointer |
| 277 | endif |
| 278 | ARCH_LDFLAGS = $(SYS_LDFLAGS) |
| 279 | else |
| 280 | ERROR Unknown architecture type "$(ARCH)". |
| 281 | endif |
| 282 | |
| 283 | LINK_FLAGS = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(NOCYGWIN) $(USER_LDFLAGS) |
| 284 | |
| 285 | export XMFLAGS |
| 286 | |
| 287 | .DEFAULT: |
| 288 | |
| 289 | $(BLD)/%.o: %.c |
| 290 | $(CC) $(CFLAGS) $(CC_OUT)$@ $< |
Note: See TracBrowser for help on using the browser.
