Create installation directory as first step.
[bpt/emacs.git] / nt / makefile.nt
1 #
2 # Top level makefile for building GNU Emacs on Windows NT
3 #
4 # This file is part of GNU Emacs.
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., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
20 #
21 # Geoff Voelker (voelker@cs.washington.edu) 11-20-93
22 # 9-6-94
23 !include makefile.def
24
25 ALL = addpm ddeclient runemacs cmdproxy addsection
26 !if $(MSVCNT11)
27 TRES = $(BLD)\emacs.res
28 !else
29 TRES = $(BLD)\emacs.rbj
30 !endif
31
32 !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
33 .c{$(BLD)}.obj:
34 $(CC) $(CFLAGS) -Fo$(OBJDIR)\i386\ $<
35 !ELSE
36 .c{$(BLD)}.obj::
37 $(CC) $(CFLAGS) -Fo$(OBJDIR)\i386\ $<
38 !ENDIF
39
40 addpm: $(BLD) $(BLD)\addpm.exe
41 $(BLD)\addpm.obj: addpm.c
42 $(BLD)\addpm.exe: $(BLD)\addpm.obj
43 $(LINK) -out:$@ -subsystem:console -entry:mainCRTStartup \
44 $(SYS_LDFLAGS) $** $(BASE_LIBS) $(ADVAPI32) user32.lib
45
46 ddeclient: $(BLD) $(BLD)\ddeclient.exe
47 $(BLD)\ddeclient.obj: ddeclient.c
48 $(BLD)\ddeclient.exe: $(BLD)\ddeclient.obj
49 $(LINK) -out:$@ -subsystem:console -entry:mainCRTStartup \
50 $(SYS_LDFLAGS) $** $(BASE_LIBS) $(ADVAPI32) user32.lib
51
52 cmdproxy: $(BLD) $(BLD)\cmdproxy.exe
53 $(BLD)\cmdproxy.obj: cmdproxy.c
54 $(BLD)\cmdproxy.exe: $(BLD)\cmdproxy.obj
55 $(LINK) -out:$@ -subsystem:console -entry:mainCRTStartup \
56 $(SYS_LDFLAGS) $** $(BASE_LIBS) user32.lib
57
58 addsection: $(BLD) $(BLD)\addsection.exe
59 $(BLD)\addsection.obj: addsection.c
60 $(BLD)\addsection.exe: $(BLD)\addsection.obj
61 $(LINK) -debug:full -out:$@ -subsystem:console -entry:mainCRTStartup \
62 $(SYS_LDFLAGS) $** $(BASE_LIBS) user32.lib
63
64 #
65 # The resource file. NT 3.10 requires the use of cvtres; even though
66 # it is not necessary on later versions, it is still ok to use it.
67 #
68 $(TRES): emacs.rc
69 $(RC) -Fo$(BLD)\emacs.res $**
70 !if !$(MSVCNT11)
71 $(CVTRES) -r -$(ARCH) -o $@ $(BLD)\emacs.res
72 !endif
73
74 runemacs: $(BLD) $(BLD)\runemacs.exe
75 $(BLD)\runemacs.obj: runemacs.c
76 $(BLD)\runemacs.exe: $(BLD)\runemacs.obj $(TRES)
77 $(LINK) -out:$@ -subsystem:windows -entry:WinMainCRTStartup \
78 $(SYS_LDFLAGS) $** $(BASE_LIBS) $(ADVAPI32) user32.lib
79
80 # Since Windows 95 does not support multiple commands on one command line
81 # (e.g., in for loops), we cannot use for loops any more.
82 # SUBDIRS = lib-src src lisp
83
84 #
85 # Build emacs
86 #
87 BUILD_CMD = $(MAKE) -f makefile.nt all
88 all: $(BLD) $(ALL)
89 cd ..\lib-src
90 $(BUILD_CMD)
91 cd ..\src
92 $(BUILD_CMD)
93 cd ..\lisp
94 $(BUILD_CMD)
95 cd ..\nt
96
97 $(INSTALL_DIR):
98 - mkdir $(INSTALL_DIR)
99
100 $(INSTALL_DIR)\bin:
101 - mkdir $(INSTALL_DIR)\bin
102
103 $(INSTALL_DIR)\bin\emacs.bat: emacs.bat.in
104 echo @echo off > $@
105 echo REM !!! Warning: This file automatically generated !!! >> emacs.bat
106 echo set emacs_dir=$(INSTALL_DIR)>> $@
107 type emacs.bat.in >> $@
108
109 $(INSTALL_DIR)\bin\debug.bat: debug.bat.in
110 echo @echo off > $@
111 echo REM !!! Warning: This file automatically generated !!! >> debug.bat
112 echo set emacs_dir=$(INSTALL_DIR)>> $@
113 type debug.bat.in >> $@
114
115 batch_files: $(INSTALL_DIR) \
116 $(INSTALL_DIR)\bin \
117 $(INSTALL_DIR)\bin\emacs.bat \
118 $(INSTALL_DIR)\bin\debug.bat
119
120 #
121 # Build and install emacs in INSTALL_DIR
122 #
123 INSTALL_CMD = $(MAKE) -f makefile.nt install
124 install: all $(INSTALL_DIR) batch_files
125 cd ..\lib-src
126 $(INSTALL_CMD)
127 cd ..\src
128 $(INSTALL_CMD)
129 cd ..\lisp
130 $(INSTALL_CMD)
131 cd ..\nt
132 - $(CP) $(BLD)\addpm.exe $(INSTALL_DIR)\bin
133 - $(CP) $(BLD)\ddeclient.exe $(INSTALL_DIR)\bin
134 - $(CP) $(BLD)\cmdproxy.exe $(INSTALL_DIR)\bin
135 - $(CP) $(BLD)\runemacs.exe $(INSTALL_DIR)\bin
136 - $(CP) ..\lib-src\fns-*.el $(INSTALL_DIR)\bin
137 - $(ADDPM) $(INSTALL_DIR)
138 - $(DEL) ..\same-dir.tst
139 - $(DEL) $(INSTALL_DIR)\same-dir.tst
140 - mkdir $(INSTALL_DIR)\etc\icons
141 - $(CP_DIR) icons $(INSTALL_DIR)\etc\icons
142 echo SameDirTest > $(INSTALL_DIR)\same-dir.tst
143 if not exist ..\same-dir.tst $(MAKE) -f makefile.nt real_install
144 - $(DEL) ..\same-dir.tst
145 - $(DEL) $(INSTALL_DIR)\same-dir.tst
146
147 #
148 # This installs executables from ..\bin into the installation directory
149 # without building anything.
150 #
151 fast_install: batch_files
152 - mkdir $(INSTALL_DIR)\data
153 $(CP) ..\lib-src\DOC $(INSTALL_DIR)\etc
154 - mkdir $(INSTALL_DIR)\bin
155 - $(CP) $(BLD)\addpm.exe $(INSTALL_DIR)\bin
156 - $(CP) $(BLD)\runemacs.exe $(INSTALL_DIR)\bin
157 - $(DEL) ..\same-dir.tst
158 - $(DEL) $(INSTALL_DIR)\same-dir.tst
159 echo SameDirTest > $(INSTALL_DIR)\same-dir.tst
160 if not exist ..\same-dir.tst $(CP) ..\bin\emacs.exe $(INSTALL_DIR)\bin
161 if not exist ..\same-dir.tst $(CP) ..\bin\etags.exe $(INSTALL_DIR)\bin
162 if not exist ..\same-dir.tst $(CP) ..\bin\ctags.exe $(INSTALL_DIR)\bin
163 if not exist ..\same-dir.tst nmake -f $(MAKE) real_install
164 - $(DEL) ..\same-dir.tst
165 - $(DEL) $(INSTALL_DIR)\same-dir.tst
166
167 real_install:
168 - $(DEL) ..\same-dir.tst
169 - $(DEL) $(INSTALL_DIR)\same-dir.tst
170 echo SameDirTest > $(INSTALL_DIR)\same-dir.tst
171 - mkdir $(INSTALL_DIR)\etc
172 - mkdir $(INSTALL_DIR)\info
173 - mkdir $(INSTALL_DIR)\lock
174 - mkdir $(INSTALL_DIR)\data
175 - mkdir $(INSTALL_DIR)\site-lisp
176 - mkdir $(INSTALL_DIR)\etc\icons
177 - $(CP_DIR) icons $(INSTALL_DIR)\etc\icons
178 if not exist ..\same-dir.tst $(CP_DIR) ..\etc $(INSTALL_DIR)\etc
179 if not exist ..\same-dir.tst $(CP_DIR) ..\info $(INSTALL_DIR)\info
180 - $(DEL) ..\same-dir.tst
181 - $(DEL) $(INSTALL_DIR)\same-dir.tst
182
183 #
184 # Maintenance
185 #
186 CLEAN_CMD = $(MAKE) -f makefile.nt clean
187 clean:; - $(DEL) *~ *.pdb
188 - $(DEL) *.orig
189 - $(DEL) *.rej
190 - $(DEL) *.crlf
191 - $(DEL_TREE) deleted
192 - $(DEL_TREE) obj
193 - $(DEL_TREE) obj-spd
194 - $(DEL_TREE) ..\bin
195 - $(DEL) ..\etc\DOC ..\etc\DOC-X
196 - $(DEL) emacs.bat
197 - $(DEL) debug.bat
198 cd ..\lib-src
199 $(CLEAN_CMD)
200 cd ..\src
201 $(CLEAN_CMD)
202 cd ..\lisp
203 $(CLEAN_CMD)
204 cd ..\nt