diff options
author | Andrew Innes <andrewi@gnu.org> | 2000-08-24 11:05:18 +0000 |
---|---|---|
committer | Andrew Innes <andrewi@gnu.org> | 2000-08-24 11:05:18 +0000 |
commit | 280d77218f53974f6f7c5d6f86f3825b30da19c2 (patch) | |
tree | dcca48d38787d6ad968f7f9571e43df8a09cf221 /nt | |
parent | 436b261dc589c3032e39554d5dc3c45de7275e3f (diff) |
New file.
Diffstat (limited to 'nt')
-rwxr-xr-x | nt/configure.bat | 346 | ||||
-rw-r--r-- | nt/gmake.defs | 220 | ||||
-rw-r--r-- | nt/makefile.w32-in | 128 | ||||
-rw-r--r-- | nt/nmake.defs | 213 |
4 files changed, 907 insertions, 0 deletions
diff --git a/nt/configure.bat b/nt/configure.bat new file mode 100755 index 00000000000..7d644fd840b --- /dev/null +++ b/nt/configure.bat @@ -0,0 +1,346 @@ +@echo off +rem ---------------------------------------------------------------------- +rem Configuration script for MS Windows 95/98 and NT/2000 +rem Copyright (C) 1999, 2000 Free Software Foundation, Inc. + +rem This file is part of GNU Emacs. + +rem GNU Emacs is free software; you can redistribute it and/or modify +rem it under the terms of the GNU General Public License as published by +rem the Free Software Foundation; either version 2, or (at your option) +rem any later version. + +rem GNU Emacs is distributed in the hope that it will be useful, +rem but WITHOUT ANY WARRANTY; without even the implied warranty of +rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +rem GNU General Public License for more details. + +rem You should have received a copy of the GNU General Public License +rem along with GNU Emacs; see the file COPYING. If not, write to the +rem Free Software Foundation, Inc., 59 Temple Place - Suite 330, +rem Boston, MA 02111-1307, USA. +rem ---------------------------------------------------------------------- +rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS: +rem +rem + MS Windows 95/98 or NT/2000 +rem + either MSVC 2.x or later, or gcc-2.95 or later (with gmake 3.75 +rem or later) and the Mingw32 and W32 API headers and libraries +rem +rem For reference, here is a list of which builds of gmake are known to +rem work or not, and whether they work in the presence and/or absence of +rem sh.exe. +rem +rem sh exists no sh +rem cygwin b20.1 make (3.75): okay[1] fails[2] +rem MSVC compiled gmake 3.77: okay okay +rem MSVC compiled gmake 3.78.1: okay okay +rem MSVC compiled gmake 3.79.1: okay okay +rem mingw32/gcc-2.92.2 make (3.77): okay okay +rem cygwin compiled gmake 3.77: okay[1] fails[2] +rem cygwin compiled gmake 3.78.1: okay fails[2] +rem cygwin compiled gmake 3.79.1: couldn't build make[3] +rem +rem [1] doesn't cope with makefiles with DOS line endings, so must mount +rem emacs source with text!=binary. +rem [2] fails when needs to invoke shell commands; okay invoking gcc etc. +rem [3] requires LC_MESSAGES support to build; maybe 2.95.x update to +rem cygwin provides this? +rem + +rem ---------------------------------------------------------------------- +rem See if the environment is large enough. We need 43 (?) bytes. +set $foo$=123456789_123456789_123456789_123456789_123 +if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv +set $foo$= + +rem ---------------------------------------------------------------------- +rem Make sure we are running in the nt subdir +if exist configure.bat goto start +echo You must run configure from the nt subdirectory. +goto end + +:start +rem ---------------------------------------------------------------------- +rem Default settings. +set prefix= +set nodebug=N +set noopt=N +set nocygwin=N +set COMPILER= +set usercflags= +set userldflags= +set sep1= +set sep2= + +rem ---------------------------------------------------------------------- +rem Handle arguments. +:again +if "%1" == "-h" goto usage +if "%1" == "--help" goto usage +if "%1" == "--prefix" goto setprefix +if "%1" == "--with-gcc" goto withgcc +if "%1" == "--with-msvc" goto withmsvc +if "%1" == "--no-debug" goto nodebug +if "%1" == "--no-opt" goto noopt +if "%1" == "--no-cygwin" goto nocygwin +if "%1" == "--cflags" goto usercflags +if "%1" == "--ldflags" goto userldflags +if "%1" == "" goto checkutils +:usage +echo Usage: configure [options] +echo Options: +echo. --prefix PREFIX install Emacs in directory PREFIX +echo. --with-gcc use GCC to compile Emacs +echo. --with-msvc use MSVC to compile Emacs +echo. --no-debug exclude debug info from executables +echo. --no-opt disable optimization +echo. --no-cygwin use -mno-cygwin option with GCC +echo. --cflags FLAG pass FLAG to compiler +echo. --ldflags FLAG pass FLAG to compiler when linking +goto end +rem ---------------------------------------------------------------------- +:setprefix +shift +set prefix=%1 +shift +goto again +rem ---------------------------------------------------------------------- +:withgcc +set COMPILER=gcc +shift +goto again +rem ---------------------------------------------------------------------- +:withmsvc +set COMPILER=cl +shift +goto again +rem ---------------------------------------------------------------------- +:nodebug +set nodebug=Y +shift +goto again +rem ---------------------------------------------------------------------- +:noopt +set noopt=Y +shift +goto again +rem ---------------------------------------------------------------------- +:nocygwin +set nocygwin=Y +shift +goto again +rem ---------------------------------------------------------------------- +:usercflags +shift +set usercflags=%usercflags%%sep1%%1 +set sep1= %nothing% +shift +goto again +rem ---------------------------------------------------------------------- +:userldflags +shift +set userldflags=%userldflags%%sep2%%1 +set sep2= %nothing% +shift +goto again + +rem ---------------------------------------------------------------------- +rem Check that necessary utilities (cp and rm) are present. +:checkutils +echo Checking for 'cp'... +cp configure.bat junk.bat +if not exist junk.bat goto needcp +echo Checking for 'rm'... +rm junk.bat +if exist junk.bat goto needrm +goto checkcompiler +:needcp +echo You need 'cp' (the Unix file copy program) to build Emacs. +goto end +:needrm +del junk.bat +echo You need 'rm' (the Unix file delete program) to build Emacs. +goto end + +rem ---------------------------------------------------------------------- +rem Auto-detect compiler if not specified, and validate GCC if chosen. +:checkcompiler +if (%COMPILER%)==(cl) goto genmakefiles +if (%COMPILER%)==(gcc) goto checkgcc + +echo Checking whether 'cl' is available... +echo main(){} >junk.c +cl -nologo -c junk.c +if exist junk.obj goto clOK + +echo Checking whether 'gcc' is available... +gcc -c junk.c +if not exist junk.o goto nocompiler +del junk.o + +:checkgcc +if (%nocygwin%) == (Y) goto checkw32api +echo Checking whether gcc requires '-mno-cygwin'... +echo #include "cygwin/version.h" >junk.c +echo main(){} >>junk.c +gcc -c junk.c +if not exist junk.o goto checkw32api +gcc -mno-cygwin -c junk.c +if exist junk.o set nocygwin=Y +del junk.o junk.c + +:checkw32api +rem ---------------------------------------------------------------------- +rem Older versions of the Windows API headers either don't have any of +rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1 +rem are like this), or have a typo in the definition of +rem IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this +rem problem). The gcc/mingw32 2.95.2 headers are okay, as are distros +rem of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least. +rem +echo Checking whether W32 API headers are too old... +echo #include "windows.h" >junk.c +echo test(PIMAGE_NT_HEADERS pHeader)>>junk.c +echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}>>junk.c +gcc -c junk.c +if exist junk.o goto gccOk + +:nocompiler +echo. +echo Configure failed. +echo To configure Emacs for Windows, you need to have either +echo gcc-2.95 or later with Mingw32 and the W32 API headers, +echo or MSVC 2.x or later. +del junk.c +goto end + +:gccOk +set COMPILER=gcc +del junk.c junk.o +echo Using 'gcc' +goto genmakefiles + +:clOk +set COMPILER=cl +del junk.c junk.obj +echo Using 'MSVC' +goto genmakefiles + +rem ---------------------------------------------------------------------- +:genmakefiles +echo Generating makefiles +if %COMPILER% == gcc set MAKECMD=gmake +if %COMPILER% == cl set MAKECMD=nmake + +rem Pass on chosen settings to makefiles. +echo # Start of settings from configure.bat >config.settings +echo COMPILER=%COMPILER% >>config.settings +if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings +if (%noopt%) == (Y) echo NOOPT=1 >>config.settings +if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings +if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix% >>config.settings +if not "(%usercflags%)" == "()" echo USER_CFLAGS=%usercflags% >>config.settings +if not "(%userldflags%)" == "()" echo USER_LDFLAGS=%userldflags% >>config.settings +echo # End of settings from configure.bat >>config.settings +echo. >>config.settings + +copy config.nt ..\src\config.h +if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h +if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h +copy paths.h ..\src\epaths.h + +rem gmake doesn't support "cd foo" in commands (except as part of a +rem compound statement which command.com doesn't support), but nmake +rem doesn't support the -C dir command line switch, so generate the +rem necessary makefile fragment for targets that involve changing dir. +rem +if %MAKECMD% == nmake goto gen1 + +echo. > make-frag +echo all-other-dirs: >> make-frag +echo. $(MAKE) -C ../lib-src all >> make-frag +echo. $(MAKE) -C ../src all >> make-frag +echo. $(MAKE) -C ../lisp all >> make-frag +echo. $(MAKE) -C ../leim all >> make-frag +echo. >> make-frag +echo clean-other-dirs: >> make-frag +echo. $(MAKE) -C ../lib-src clean >> make-frag +echo. $(MAKE) -C ../src clean >> make-frag +echo. $(MAKE) -C ../lisp clean >> make-frag +echo. $(MAKE) -C ../leim clean >> make-frag +echo. >> make-frag +echo install-other-dirs: >> make-frag +echo. $(MAKE) -C ../lib-src install >> make-frag +echo. $(MAKE) -C ../src install >> make-frag +echo. $(MAKE) -C ../lisp install >> make-frag +echo. $(MAKE) -C ../leim install >> make-frag +echo. >> make-frag +goto gen2 + +:gen1 +echo. > make-frag +echo all-other-dirs: >> make-frag +echo. cd ..\lib-src >> make-frag +echo. $(MAKE) all >> make-frag +echo. cd ..\src >> make-frag +echo. $(MAKE) all >> make-frag +echo. cd ..\lisp >> make-frag +echo. $(MAKE) all >> make-frag +echo. cd ..\leim >> make-frag +echo. $(MAKE) all >> make-frag +echo. cd ..\nt >> make-frag +echo. >> make-frag +echo clean-other-dirs: >> make-frag +echo. cd ..\lib-src >> make-frag +echo. $(MAKE) clean >> make-frag +echo. cd ..\src >> make-frag +echo. $(MAKE) clean >> make-frag +echo. cd ..\lisp >> make-frag +echo. $(MAKE) clean >> make-frag +echo. cd ..\leim >> make-frag +echo. $(MAKE) clean >> make-frag +echo. cd ..\nt >> make-frag +echo. >> make-frag +echo install-other-dirs: >> make-frag +echo. cd ..\lib-src >> make-frag +echo. $(MAKE) install >> make-frag +echo. cd ..\src >> make-frag +echo. $(MAKE) install >> make-frag +echo. cd ..\lisp >> make-frag +echo. $(MAKE) install >> make-frag +echo. cd ..\leim >> make-frag +echo. $(MAKE) install >> make-frag +echo. cd ..\nt >> make-frag +echo. >> make-frag + +:gen2 +copy /b config.settings+%MAKECMD%.defs+make-frag+..\nt\makefile.w32-in ..\nt\makefile +del make-frag +copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile +copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile +if not exist ..\lisp\Makefile.unix rename ..\lisp\Makefile Makefile.unix +if exist ..\lisp\makefile del /f ..\lisp\makefile +copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile +rem Use the default (no-op) Makefile.in if the nt version is not present. +if exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile +if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile +del config.settings + +echo. +echo Emacs successfully configured. +echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install. +goto end + +:SmallEnv +echo Your environment size is too small. Please enlarge it and rerun configure. +echo For example, type "command.com /e:2048" to have 2048 bytes available. +set $foo$= +:end +set prefix= +set nodebug= +set noopt= +set nocygwin= +set COMPILER= +set MAKECMD= +set usercflags= +set userldflags= diff --git a/nt/gmake.defs b/nt/gmake.defs new file mode 100644 index 00000000000..2517b31cf0b --- /dev/null +++ b/nt/gmake.defs @@ -0,0 +1,220 @@ +# +# Makefile definition file for building GNU Emacs on Windows NT +# +# GNU Emacs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Emacs; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Ensure 'all' is the default target +all: + +# NOTES +# +# I tried to force gmake to use the native shell for simplicity, by +# setting SHELL as below, but this didn't work reliably because of +# various case sensitivity niggles. Specifically, COMSPEC (which is in +# fact usually spelled ComSpec on NT, to make life difficult) typically +# references "cmd.exe" (on NT) when the file is actually called +# "CMD.EXE" on disk for hysterical raisons. As a result, GNU make +# thinks it doesn't exist (unless compiled with a switch to ignore +# case), and so doesn't change which shell it will invoke to execute +# commands. +# +# It would be possible, though very tedious using just gmake facilities, +# to convert the COMSPEC value to uppercase to solve this problem, but +# it isn't worth it. That is partly because, even when using the native +# shell, gmake tends to not be happy with backslashes in command +# strings. The obvious solution is to use forward slashes as much as +# possible, which can be made to work most of the time (putting +# filenames in quotes often helps), but there are still some internal +# cmd.exe commands like `del' and `copy' that won't work with them. +# Although it is possible to convert slashes to backslashes when +# necessary, gmake requires explicitly calling its subst function, which +# nmake does not understand). For this reason, it is simplest to +# mandate that rm and cp be available, so we can use Unix-format file +# names everywhere. (Fortunately both MS and GNU make, and the +# respective compilers, are happy with Unix-format names.) +# +# Since we cannot easily force the choice of a particular shell, we must +# make the effort to cope with whichever shell is being used. +# Fortunately, the only command we need to use that is shell specific is +# the testing of a file's existence for the purpose of working out when +# we are copying files to their original location. That particular +# requirement is abstracted easily enough. +# +# The only other problem area was the change of directory when running +# temacs to dump emacs.exe (where gmake doesn't support cd foo in any +# useful way), but that has been resolved by modifying the Windows +# unexec function slightly to not require the directory change while +# still allowing objects and binaries to be in subdirectories. + +# This doesn't work. +#SHELL:=$(COMSPEC) + +# Determine whether make is using sh or cmd/command as shell; cmd.exe +# will output "ECHO is on" when echo is given by itself, while sh will +# not produce any output. +sh_output := $(shell echo) +ifeq "$(findstring ECHO, $(sh_output))" "ECHO" +THE_SHELL = $(COMSPEC)$(ComSpec) +else +USING_SH = 1 +THE_SHELL = $(SHELL) +endif + +MAKEDIR = $(CURDIR) +ALL_DEPS = $^ +EMPTY = +SPACE = $(EMPTY) $(EMPTY) + +SUBSYSTEM_WINDOWS=-Wl,-subsystem,windows +SUBSYSTEM_CONSOLE=-Wl,-subsystem,console + +# INSTALL_DIR is the directory into which emacs will be installed. +# +ifndef INSTALL_DIR +INSTALL_DIR = $(MAKEDIR)/.. +endif + +# Determine the architecture we're running on. +# Define ARCH for our purposes; +# Define CPU for use by ntwin32.mak; +# Define CONFIG_H to the appropriate config.h for the system; +# +ifdef PROCESSOR_ARCHITECTURE +# We're on Windows NT +CPU = $(PROCESSOR_ARCHITECTURE) +CONFIG_H = config.nt +OS_TYPE = windowsnt + ifeq "$(PROCESSOR_ARCHITECTURE)" "x86" +ARCH = i386 +CPU = i386 + else + ifeq "$(PROCESSOR_ARCHITECTURE)" "MIPS" +ARCH = mips + else + ifeq "$(PROCESSOR_ARCHITECTURE)" "ALPHA" +ARCH = alpha + else + ifeq "$(PROCESSOR_ARCHITECTURE)" "PPC" +ARCH = ppc + else +error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)" + endif + endif + endif + endif +else +# We're on Windows 95 +ARCH = i386 +CPU = i386 +CONFIG_H = config.nt +OS_TYPE = windows95 +endif + +AR = ar -rsc +AR_OUT = +CC = gcc +CC_OUT = -o$(SPACE) +LINK = gcc +LINK_OUT = -o$(SPACE) +RC = windres -O coff +RC_OUT = -o$(SPACE) +RC_INCLUDE = --include-dir$(SPACE) + +libc = +baselibs = +O = o +A = a + +BASE_LIBS = $(libc) $(baselibs) + +ADVAPI32 = -ladvapi32 +COMDLG32 = -lcomdlg32 +GDI32 = -lgdi32 +MPR = -lmpr +SHELL32 = -lshell32 +USER32 = -luser32 +WSOCK32 = -lwsock32 + +ifdef NOOPT +DEBUG_CFLAGS = -DEMACSDEBUG +else +DEBUG_CFLAGS = +endif +CFLAGS = -I. -DWIN32_LEAN_AND_MEAN $(ARCH_CFLAGS) -D$(ARCH) \ + -D_CRTAPI1=_cdecl -D_ANONYMOUS_UNION -D_ANONYMOUS_STRUCT \ + $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) +EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1 -DORDINARY_LINK=1 + +# see comments in allocate_heap in w32heap.c before changing any of the +# -stack, -heap, or -image-base settings. +TEMACS_EXTRA_LINK = -Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -g $(SUBSYSTEM_CONSOLE) -Wl,-entry,__start -Wl,-Map,$(BLD)/temacs.map + +ifdef NOOPT +OBJDIR = oo +else +OBJDIR = oo-spd +endif +$(OBJDIR):; -mkdir "$(OBJDIR)" +BLD = $(OBJDIR)/$(ARCH) +$(BLD): $(OBJDIR) + -mkdir "$(BLD)" + +CP = cp -f +CP_DIR = cp -rf +DEL = rm +DEL_TREE = rm -r +ifdef USING_SH +IFNOTSAMEDIR = if [ ! -s ../same-dir.tst ] ; then +ENDIF = ; fi +else +IFNOTSAMEDIR = if not exist ../same-dir.tst +ENDIF = +endif + +# The location of the icon file +EMACS_ICON_PATH = ../nt/emacs.ico + +ifdef NODEBUG +DEBUG_FLAG = +else +DEBUG_FLAG = -g +endif + +ifdef NOCYGWIN +NOCYGWIN = -mno-cygwin +endif + +ifeq "$(ARCH)" "i386" +ifdef NOOPT +ARCH_CFLAGS = -D_X86_=1 -c $(DEBUG_FLAG) $(NOCYGWIN) +else +ARCH_CFLAGS = -D_X86_=1 -c $(DEBUG_FLAG) $(NOCYGWIN) -O -Os \ + -mcpu=i686 -fno-exceptions -fbuiltins \ + # -mpreferred-stack-boundary=2 \ + # -finline-functions \ + # -fomit-frame-pointer +endif +ARCH_LDFLAGS = $(SYS_LDFLAGS) +else +ERROR Unknown architecture type "$(ARCH)". +endif + +LINK_FLAGS = $(ARCH_LDFLAGS) $(NOCYGWIN) $(USER_LDFLAGS) + +.DEFAULT: + +$(BLD)/%.o: %.c + $(CC) $(CFLAGS) $(CC_OUT)$@ $< diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in new file mode 100644 index 00000000000..21f033ba7ed --- /dev/null +++ b/nt/makefile.w32-in @@ -0,0 +1,128 @@ +# +# Top level makefile for building GNU Emacs on Windows NT +# +# This file is part of GNU Emacs. +# +# GNU Emacs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Emacs; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +ALL = addpm ddeclient runemacs cmdproxy addsection preprep + +.PHONY: $(ALL) + +TRES = $(BLD)/emacs.res + +addpm: $(BLD) $(BLD)/addpm.exe +$(BLD)/addpm.exe: $(BLD)/addpm.$(O) + $(LINK) $(LINK_OUT)$@ \ + $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32) + +ddeclient: $(BLD) $(BLD)/ddeclient.exe +$(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O) + $(LINK) $(LINK_OUT)$@ \ + $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32) + +cmdproxy: $(BLD) $(BLD)/cmdproxy.exe +$(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O) + $(LINK) $(LINK_OUT)$@ \ + $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32) + +addsection: $(BLD) $(BLD)/addsection.exe +$(BLD)/addsection.exe: $(BLD)/addsection.$(O) + $(LINK) $(LINK_OUT)$@ \ + $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32) + +preprep: $(BLD) $(BLD)/preprep.exe +$(BLD)/preprep.exe: $(BLD)/preprep.$(O) + $(LINK) $(LINK_OUT)$@ \ + $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) + +# +# The resource file. NT 3.10 requires the use of cvtres; even though +# it is not necessary on later versions, it is still ok to use it. +# +$(TRES): emacs.rc + $(RC) $(RC_OUT)$(BLD)/emacs.res $(ALL_DEPS) + +runemacs: $(BLD) $(BLD)/runemacs.exe +$(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES) + $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \ + $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32) + +which-sh: + @echo Using $(THE_SHELL) as shell. + +# +# Build emacs +# +all: which-sh $(BLD) $(ALL) all-other-dirs + +$(INSTALL_DIR): + - mkdir "$(INSTALL_DIR)" + +$(INSTALL_DIR)/bin: + - mkdir "$(INSTALL_DIR)/bin" + +# +# Build and install emacs in INSTALL_DIR +# +install: all $(INSTALL_DIR)/bin install-other-dirs + - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin + - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin + - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin + - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin + - $(CP) ../lib-src/fns-*.el $(INSTALL_DIR)/bin + - "$(INSTALL_DIR)/bin/addpm" /q + - $(DEL) ../same-dir.tst + - $(DEL) $(INSTALL_DIR)/same-dir.tst + - mkdir "$(INSTALL_DIR)/etc/icons" + - $(CP_DIR) icons $(INSTALL_DIR)/etc/icons + echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst" + $(IFNOTSAMEDIR) $(MAKE) real_install $(ENDIF) + - $(DEL) ../same-dir.tst + - $(DEL) $(INSTALL_DIR)/same-dir.tst + +real_install: + - $(DEL) ../same-dir.tst + - $(DEL) $(INSTALL_DIR)/same-dir.tst + echo SameDirTest > $(INSTALL_DIR)/same-dir.tst + - mkdir "$(INSTALL_DIR)/etc" + - mkdir "$(INSTALL_DIR)/info" + - mkdir "$(INSTALL_DIR)/lock" + - mkdir "$(INSTALL_DIR)/data" + - mkdir "$(INSTALL_DIR)/site-lisp" + - mkdir "$(INSTALL_DIR)/etc/icons" + - $(CP_DIR) icons $(INSTALL_DIR)/etc/icons + $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR)/etc $(ENDIF) + $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR)/info $(ENDIF) + - $(DEL) ../same-dir.tst + - $(DEL) $(INSTALL_DIR)/same-dir.tst + +# +# Maintenance +# +clean: clean-other-dirs + - $(DEL) *~ *.pdb + - $(DEL_TREE) $(OBJDIR) + - $(DEL) ../etc/DOC ../etc/DOC-X + +cleanall: clean + - $(DEL_TREE) obj + - $(DEL_TREE) obj-spd + - $(DEL_TREE) oo + - $(DEL_TREE) oo-spd + +realclean: cleanall + - $(DEL_TREE) ../bin diff --git a/nt/nmake.defs b/nt/nmake.defs new file mode 100644 index 00000000000..66291c0a9e3 --- /dev/null +++ b/nt/nmake.defs @@ -0,0 +1,213 @@ +# +# Makefile definition file for building GNU Emacs on Windows NT +# +# GNU Emacs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Emacs; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Ensure 'all' is the default target +all: + +THE_SHELL = $(COMSPEC) + +ALL_DEPS = $** + +SUBSYSTEM_WINDOWS=-subsystem:windows +SUBSYSTEM_CONSOLE=-subsystem:console + +# INSTALL_DIR is the directory into which emacs will be installed. +# +!ifndef INSTALL_DIR +INSTALL_DIR = $(MAKEDIR)/.. +!endif + +# Allow detection of builds with MSVC 5 or later, so we can +# speed up compiles (see rule at end). +# +_NMAKE_VER_5=162 +_NMAKE_VER_4=0 + +!IFNDEF _NMAKE_VER +_NMAKE_VER=$(_NMAKE_VER_4) +!ENDIF + +# Check that the INCLUDE and LIB environment variables are set. +# +!ifndef INCLUDE +!error The INCLUDE environment variable needs to be set. +!endif +!ifndef LIB +!error The LIB environment variable needs to be set. +!endif + +# Determine the architecture we're running on. +# Define ARCH for our purposes; +# Define CPU for use by ntwin32.mak; +# Define CONFIG_H to the appropriate config.h for the system; +# +!ifdef PROCESSOR_ARCHITECTURE +# We're on Windows NT +CPU = $(PROCESSOR_ARCHITECTURE) +CONFIG_H = config.nt +OS_TYPE = windowsnt +! if "$(PROCESSOR_ARCHITECTURE)" == "x86" +ARCH = i386 +CPU = i386 +! else +! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS" +ARCH = mips +! else +! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA" +ARCH = alpha +! else +! if "$(PROCESSOR_ARCHITECTURE)" == "PPC" +ARCH = ppc +! else +! error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)" +! endif +! endif +! endif +! endif +!else +# We're on Windows 95 +ARCH = i386 +CPU = i386 +CONFIG_H = config.nt +OS_TYPE = windows95 +!endif + +AR = lib +AR_OUT = -out: +CC = cl +CC_OUT = -Fo +LINK = link +LINK_OUT = -out: +RC = rc +RC_OUT = -Fo +RC_INCLUDE = -i + +libc = libc.lib +baselibs = +O = obj +A = lib + +BASE_LIBS = $(libc) $(baselibs) oldnames.lib + +ADVAPI32 = advapi32.lib +COMDLG32 = comdlg32.lib +GDI32 = gdi32.lib +MPR = mpr.lib +SHELL32 = shell32.lib +USER32 = user32.lib +WSOCK32 = wsock32.lib + +!ifdef NOOPT +DEBUG_CFLAGS = -DEMACSDEBUG +!else +DEBUG_CFLAGS = +!endif +CFLAGS = -I. -DWIN32_LEAN_AND_MEAN $(ARCH_CFLAGS) -D$(ARCH) \ + -D_CRTAPI1=_cdecl -D_ANONYMOUS_UNION -D_ANONYMOUS_STRUCT \ + $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) +EMACS_EXTRA_C_FLAGS = + +SYS_LDFLAGS = -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net + +# see comments in allocate_heap in w32heap.c before changing any of the +# -stack, -heap, or -base settings. +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) + +!ifdef NOOPT +OBJDIR = obj +!else +OBJDIR = obj-spd +!endif +$(OBJDIR):; -mkdir $(OBJDIR) +BLD = $(OBJDIR)/$(ARCH) +$(BLD): $(OBJDIR) + -mkdir "$(BLD)" + +CP = cp -f +CP_DIR = cp -rf +IFNOTSAMEDIR = if not exist ..\same-dir.tst +ENDIF = +DEL = rm +DEL_TREE = rm -r + +# The location of the icon file +EMACS_ICON_PATH = ../nt/emacs.ico + +!ifdef NODEBUG +DEBUG_FLAG = +!else +DEBUG_FLAG = -Zi +!endif + +!if "$(ARCH)" == "i386" +!ifdef NOOPT +ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG) +!else +ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG) +!endif +ARCH_LDFLAGS = $(SYS_LDFLAGS) + +!else +!if "$(ARCH)" == "mips" +ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0 +ARCH_LDFLAGS = $(SYS_LDFLAGS) + +!else +!if "$(ARCH)" == "alpha" +!if "$(BUILD_TYPE)" == "spd" +ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl= +!else +ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl= +!endif +ARCH_LDFLAGS = $(SYS_LDFLAGS) + +!else +!if "$(ARCH)" == "ppc" +# These flags are a guess...if they don't work, please send me mail. +ARCH_CFLAGS = -D_PPC_=1 -c -Ze -Zi -W2 -Od +ARCH_LDFLAGS = $(SYS_LDFLAGS) + +!else +!ERROR Unknown architecture type "$(ARCH)". +!endif +!endif +!endif +!endif + +LINK_FLAGS = $(ARCH_LDFLAGS) $(USER_LDFLAGS) + +# From MSVC 5.0 onwards, it seem base relocation information is not included, +# at least in release builds. We need to ensure the reloc info is included +# in order to use the MSVC profiler. +!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)") +EXTRA_LINK = +!ELSE +EXTRA_LINK = -profile +!ENDIF + +# +# If the compiler supports compiling multiple .c files to .o files at +# one time, use this feature. +# +!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)") +.c{$(BLD)}.obj: + $(CC) $(CFLAGS) -Fo$(BLD)\ $< +!ELSE +.c{$(BLD)}.obj:: + $(CC) $(CFLAGS) -Fo$(BLD)\ $< +!ENDIF |